Add Mozilla VPN & Proxy permissions block to options.html

This commit is contained in:
Lesley Norton
2021-12-04 16:32:00 -06:00
parent 07d7b0cad4
commit 3c3b5ae705
4 changed files with 99 additions and 32 deletions
+11 -1
View File
@@ -17,6 +17,16 @@ document.querySelectorAll("[data-permission-id]").forEach( async(el) => {
});
});
async function maybeShowPermissionsWarningIcon() {
const bothMozillaVpnPermissionsEnabled = await MozillaVPN.bothPermissionsEnabled();
if (!bothMozillaVpnPermissionsEnabled) {
const permissionsWarningEl = document.querySelector(".moz-vpn-proxy-permissions-title");
if (permissionsWarningEl) {
permissionsWarningEl.classList.add("show-warning");
}
}
}
async function enableDisableSync() {
const checkbox = document.querySelector("#syncCheck");
await browser.storage.local.set({syncEnabled: !!checkbox.checked});
@@ -81,7 +91,7 @@ document.addEventListener("DOMContentLoaded", setupOptions);
document.querySelector("#syncCheck").addEventListener( "change", enableDisableSync);
document.querySelector("#replaceTabCheck").addEventListener( "change", enableDisableReplaceTab);
document.querySelector("button").addEventListener("click", resetOnboarding);
maybeShowPermissionsWarningIcon();
for (let i=0; i < NUMBER_OF_KEYBOARD_SHORTCUTS; i++) {
document.querySelector("#open_container_"+i)
.addEventListener("change", storeShortcutChoice);