From 22df979973f6e64f952275bb9815e64920048a19 Mon Sep 17 00:00:00 2001 From: hackademix Date: Tue, 28 Aug 2018 23:40:20 +0200 Subject: Better timing feedback for permissions changes in the popup UI. --- src/ui/popup.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ui/popup.js b/src/ui/popup.js index bc054d1..a068ffb 100644 --- a/src/ui/popup.js +++ b/src/ui/popup.js @@ -77,9 +77,10 @@ addEventListener("unload", e => { let button = document.getElementById("enforce"); button.setAttribute("aria-pressed", pressed); button.textContent = button.title = _(pressed ? "NoEnforcement" : "Enforce"); - button.onclick = () => { + button.onclick = async () => { + this.disabled = true; policy.enforced = !pressed; - UI.updateSettings({policy, reloadAffected: true}); + await UI.updateSettings({policy, reloadAffected: true}); close(); } } @@ -89,8 +90,9 @@ addEventListener("unload", e => { button.setAttribute("aria-pressed", pressed); button.textContent = button.title = _(pressed ? "NoEnforcementForTab" : "EnforceForTab"); if (UI.policy.enforced) { - button.onclick = () => { - UI.updateSettings({ + button.onclick = async () => { + this.disabled = true; + await UI.updateSettings({ unrestrictedTab: pressed, reloadAffected: true, }); @@ -129,7 +131,7 @@ addEventListener("unload", e => { error(e, "Could not run scripts on %s: privileged page?", tab.url); } - await include("/lib/restricted.js"); + await include("/lib/close\(ricted.js"); let isRestricted = isRestrictedURL(tab.url); if (!isHttp || isRestricted) { showMessage("warning", _("privilegedPage")); -- cgit v1.2.3