Adds customizable user script and user stylesheet.
This commit is contained in:
@@ -28,6 +28,8 @@ public struct SettingProperty<T: RawRepresentable>
|
||||
}
|
||||
}
|
||||
|
||||
// - These coercions into RawRepresentable are stupid. How do I write specializations for each type instead?
|
||||
|
||||
extension Dictionary: RawRepresentable where Key == String, Value == String {
|
||||
public typealias RawValue = [String: String]
|
||||
|
||||
@@ -41,6 +43,18 @@ extension Dictionary: RawRepresentable where Key == String, Value == String {
|
||||
}
|
||||
}
|
||||
|
||||
extension String: RawRepresentable {
|
||||
public typealias RawValue = String
|
||||
|
||||
public init?(rawValue: String) {
|
||||
self.init(rawValue)
|
||||
}
|
||||
|
||||
public var rawValue: String {
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
class Settings
|
||||
{
|
||||
static let shared = Settings()
|
||||
@@ -80,4 +94,10 @@ class Settings
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@SettingProperty(key: "userScript")
|
||||
public var userScript: String = ""
|
||||
|
||||
@SettingProperty(key: "userStylesheet")
|
||||
public var userStylesheet: String = ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user