Configured colours and added additional images to ready app for iOS 13 dark mode

This commit is contained in:
Deniz Duezgoeren
2019-10-08 21:37:42 +02:00
parent b7bc097664
commit 85efe3955d
310 changed files with 6512 additions and 4492 deletions
+4 -4
View File
@@ -1288,8 +1288,8 @@ open class Element: Node {
return super.copy(clone: clone, parent: parent)
}
override public var hashValue: Int {
return super.hashValue ^ _tag.hashValue
}
override public func hash(into hasher: inout Hasher) {
super.hash(into: &hasher)
hasher.combine(_tag)
}
}
+17 -31
View File
@@ -214,14 +214,9 @@ open class Elements: NSCopying {
* @see #outerHtml()
*/
open func html()throws->String {
let sb: StringBuilder = StringBuilder()
for element: Element in this {
if (sb.length != 0) {
sb.append("\n")
}
sb.append(try element.html())
}
return sb.toString()
var text = try this.reduce("") {result, name in "\(result)\(try name.html())\n"}
text.removeLast()
return text
}
/**
@@ -584,33 +579,24 @@ extension Elements: Equatable {
}
/**
* Elements IteratorProtocol.
* Elements RandomAccessCollection
*/
public struct ElementsIterator: IteratorProtocol {
/// Elements reference
let elements: Elements
//current element index
var index = 0
/// Initializer
init(_ countdown: Elements) {
self.elements = countdown
extension Elements: RandomAccessCollection {
public subscript(position: Int) -> Element {
return this[position]
}
/// Advances to the next element and returns it, or `nil` if no next element
mutating public func next() -> Element? {
let result = index < elements.size() ? elements.get(index) : nil
index += 1
return result
public var startIndex: Int {
return this.startIndex
}
}
/**
* Elements Extension Sequence.
*/
extension Elements: Sequence {
/// Returns an iterator over the elements of this sequence.
public func makeIterator() -> ElementsIterator {
return ElementsIterator(self)
public var endIndex: Int {
return this.endIndex
}
/// The number of Element objects in the collection.
/// Equivalent to `size()`
public var count: Int {
return this.count
}
}
+2 -2
View File
@@ -134,7 +134,7 @@ public class Entities {
// return codeVals[nameKeys.index(of: s)!]
// }
// }
guard let index = nameKeys.index(of: name) else {
guard let index = nameKeys.firstIndex(of: name) else {
return empty
}
return codeVals[index]
@@ -146,7 +146,7 @@ public class Entities {
var index = -1
for s in codeKeys {
if s == codepoint {
index = codeKeys.index(of: codepoint)!
index = codeKeys.firstIndex(of: codepoint)!
}
}
+3 -3
View File
@@ -440,12 +440,12 @@ public class Evaluator {
open override func toString() -> String {
if (a == 0) {
return ":\(getPseudoClass)(\(b))"
return ":\(getPseudoClass())(\(b))"
}
if (b == 0) {
return ":\(getPseudoClass)(\(a))"
return ":\(getPseudoClass())(\(a))"
}
return ":\(getPseudoClass)(\(a)\(b))"
return ":\(getPseudoClass())(\(a)\(b))"
}
open func getPseudoClass() -> String {
+10 -4
View File
@@ -750,9 +750,15 @@ open class Node: Equatable, Hashable {
}
open func tail(_ node: Node, _ depth: Int)throws {
// When compiling a release optimized swift linux 4.2 version the "saves a void hit."
// causes a SIL error. Removing optimization on linux until a fix is found.
#if os(Linux)
try node.outerHtmlTail(accum, depth, out)
#else
if (!(node.nodeName() == OuterHtmlVisitor.text)) { // saves a void hit.
try node.outerHtmlTail(accum, depth, out)
}
#endif
}
}
@@ -772,10 +778,10 @@ open class Node: Equatable, Hashable {
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
public var hashValue: Int {
return description.hashValue ^ (baseUri?.hashValue ?? 31)
}
public func hash(into hasher: inout Hasher) {
hasher.combine(description)
hasher.combine(baseUri)
}
}
extension Node: CustomStringConvertible {
+5 -6
View File
@@ -110,9 +110,8 @@ public class OrderedDictionary<Key: Hashable, Value: Equatable>: MutableCollecti
return valueForKey(key: key)
}
// required var for the Hashable protocol
public var hashValue: Int {
return 0
public func hash(into hasher: inout Hasher) {
hasher.combine(_orderedKeys)
}
public func hashCode() -> Int {
@@ -158,7 +157,7 @@ public class OrderedDictionary<Key: Hashable, Value: Equatable>: MutableCollecti
@discardableResult
public func removeValueForKey(key: Key) -> Value? {
if let index = _orderedKeys.index(of: key) {
if let index = _orderedKeys.firstIndex(of: key) {
guard let currentValue = _keysToValues[key] else {
fatalError("Inconsistency error occured in OrderedDictionary")
}
@@ -200,7 +199,7 @@ public class OrderedDictionary<Key: Hashable, Value: Equatable>: MutableCollecti
}
public func indexForKey(key: Key) -> Index? {
return _orderedKeys.index(of: key)
return _orderedKeys.firstIndex(of: key)
}
public func elementAtIndex(index: Index) -> Element? {
@@ -233,7 +232,7 @@ public class OrderedDictionary<Key: Hashable, Value: Equatable>: MutableCollecti
let adjustedIndex: Int
let currentValue: Value?
if let currentIndex = _orderedKeys.index(of: key) {
if let currentIndex = _orderedKeys.firstIndex(of: key) {
currentValue = _keysToValues[key]
adjustedIndex = (currentIndex < index - 1) ? index - 1 : index
+8 -4
View File
@@ -119,19 +119,23 @@ public class QueryParser {
}
private func consumeSubQuery() -> String {
let sq: StringBuilder = StringBuilder()
var sq = ""
while (!tq.isEmpty()) {
if (tq.matches("(")) {
sq.append("(").append(tq.chompBalanced("(", ")")).append(")")
sq.append("(")
sq.append(tq.chompBalanced("(", ")"))
sq.append(")")
} else if (tq.matches("[")) {
sq.append("[").append(tq.chompBalanced("[", "]")).append("]")
sq.append("[")
sq.append(tq.chompBalanced("[", "]"))
sq.append("]")
} else if (tq.matchesAny(QueryParser.combinators)) {
break
} else {
sq.append(tq.consume())
}
}
return sq.toString()
return sq
}
private func findElements()throws {
+10 -13
View File
@@ -19,7 +19,9 @@ open class StringUtil {
}
// memoised padding up to 10
fileprivate static var padding: [String] = ["", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "]
fileprivate static let padding: [String] = ["", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "]
private static let empty = ""
private static let space = " "
/**
* Join a collection of strings by a seperator
@@ -66,20 +68,15 @@ open class StringUtil {
*/
public static func padding(_ width: Int) -> String {
if(width <= 0) {
return ""
if width <= 0 {
return empty
}
if (width < padding.count) {
if width < padding.count {
return padding[width]
}
var out: [Character] = [Character]()
for _ in 0..<width {
out.append(" ")
}
return String(out)
return String.init(repeating: space, count: width)
}
/**
@@ -231,7 +228,7 @@ open class StringUtil {
if(base == nil || base?.scheme == nil) {
let abs = URL(string: relUrl)
return abs != nil && abs?.scheme != nil ? abs!.absoluteURL.absoluteString : ""
return abs != nil && abs?.scheme != nil ? abs!.absoluteURL.absoluteString : empty
} else {
let url = resolve(base!, relUrl: relUrl)
if(url != nil) {
@@ -244,7 +241,7 @@ open class StringUtil {
return ext
}
return ""
return empty
}
// try {
+11 -2
View File
@@ -239,8 +239,17 @@ open class Tag: Hashable {
///
/// Hash values are not guaranteed to be equal across different executions of
/// your program. Do not save hash values to use during a future execution.
public var hashValue: Int {
return _tagName.hashValue ^ _isBlock.hashValue ^ _formatAsBlock.hashValue ^ _canContainBlock.hashValue ^ _canContainInline.hashValue ^ _empty.hashValue ^ _selfClosing.hashValue ^ _preserveWhitespace.hashValue ^ _formList.hashValue ^ _formSubmit.hashValue
public func hash(into hasher: inout Hasher) {
hasher.combine(_tagName)
hasher.combine(_isBlock)
hasher.combine(_formatAsBlock)
hasher.combine(_canContainBlock)
hasher.combine(_canContainInline)
hasher.combine(_empty)
hasher.combine(_selfClosing)
hasher.combine(_preserveWhitespace)
hasher.combine(_formList)
hasher.combine(_formSubmit)
}
open func toString() -> String {
+2 -2
View File
@@ -639,8 +639,8 @@ open class TypedValue {
}
extension TypedValue: Hashable {
public var hashValue: Int {
return value.hashValue
public func hash(into hasher: inout Hasher) {
hasher.combine(value)
}
}