From 93a20486990210d910743b01ffe18023d085f6a9 Mon Sep 17 00:00:00 2001 From: hackademix Date: Wed, 29 Jul 2020 16:10:09 +0200 Subject: [PATCH] Fixed buggy policy references in the Options dialog. --- src/ui/options.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ui/options.js b/src/ui/options.js index 1342af0..1a16e29 100644 --- a/src/ui/options.js +++ b/src/ui/options.js @@ -144,14 +144,17 @@ // SITES UI let sitesUI = new UI.Sites(document.getElementById("sites")); + UI.onSettings = () => { + policy = UI.policy; + sitesUI.render(policy.sites); + } { sitesUI.onChange = () => { if (UI.local.debug) { updateRawPolicyEditor(); } }; - let sites = policy.sites; - sitesUI.render(sites); + sitesUI.render(policy.sites); let newSiteForm = document.querySelector("#form-newsite"); let newSiteInput = newSiteForm.newsite; @@ -194,7 +197,7 @@ if (!policyEditor.onchange) policyEditor.onchange = (e) => { let ed = e.currentTarget try { - policy = new Policy(JSON.parse(ed.value)); + UI.policy = policy = new Policy(JSON.parse(ed.value)); UI.updateSettings({policy}); sitesUI.render(policy.sites); ed.className = "";