From af4ec5c169f4758cd52f0db82aaa25dca061067e Mon Sep 17 00:00:00 2001 From: hackademix Date: Mon, 13 Aug 2018 01:33:40 +0200 Subject: "High contrast appearance" option to override high contrast themes auto-detection. --- src/ui/options.js | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'src/ui/options.js') diff --git a/src/ui/options.js b/src/ui/options.js index 79e6cb7..31cf5c3 100644 --- a/src/ui/options.js +++ b/src/ui/options.js @@ -8,6 +8,9 @@ let version = browser.runtime.getManifest().version; document.querySelector("#version").textContent = _("Version", version); // simple general options + + let opt = UI.wireOption; + opt("global", o => { if (o) { policy.enforced = !o.checked; @@ -30,7 +33,6 @@ }); opt("xss"); - { let button = document.querySelector("#btn-reset"); button.onclick = async () => { @@ -173,29 +175,6 @@ // UTILITY FUNCTIONS - async function opt(name, storage = "sync", onchange) { - let input = document.querySelector(`#opt-${name}`); - if (!input) { - debug("Checkbox not found %s", name); - return; - } - if (typeof storage === "function") { - input.onchange = e => storage(input); - input.checked = storage(null); - } else { - let obj = UI[storage]; - if (!obj) log(storage); - input.checked = obj[name]; - if (onchange) onchange(input.checked); - input.onchange = async () => { - obj[name] = input.checked; - await UI.updateSettings({[storage]: obj}); - if (onchange) onchange(obj[name]); - } - } - } - - function updateRawPolicyEditor() { if (!UI.local.debug) return; -- cgit v1.2.3