Adds customizable user script and user stylesheet.

This commit is contained in:
James Magahern
2021-12-16 18:40:45 -08:00
parent 026306b6df
commit b79f0ac5db
7 changed files with 143 additions and 2 deletions

View File

@@ -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 = ""
}