From 51c1255eed3fb82d05b0bdd4e84774411d599b74 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 20 Sep 2018 22:02:15 +0200 Subject: [PATCH] disable other buttons in 'extension settings' tab if extension is disabled --- res/popup/js/popup.js | 9 +++++++- res/popup/popup.html | 51 +++++++++++++++++++++++-------------------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/res/popup/js/popup.js b/res/popup/js/popup.js index cca3f8c..470884c 100644 --- a/res/popup/js/popup.js +++ b/res/popup/js/popup.js @@ -176,6 +176,11 @@ function configurePopupTabs(site) { MenuTab.videoSettings.classList.remove('disabled'); } + // we assume that these two can be shown. If extension or site are disabled, we'll + // add 'disabled' class later down the line: + document.getElementById("_site_only_when_site_enabled").classList.remove("disabled"); + document.getElementById("_ext_only_when_ext_enabled").classList.remove("disabled"); + if (! extensionEnabledForSite) { MenuTab.videoSettings.classList.add('disabled'); @@ -184,6 +189,9 @@ function configurePopupTabs(site) { if (! extensionEnabled) { MenuTab.siteSettings.classList.add('disabled'); + + // also disable extra settings for extension + document.getElementById("_ext_only_when_ext_enabled").classList.add("disabled"); if (!selectedMenu) { openMenu('extensionSettings'); } @@ -196,7 +204,6 @@ function configurePopupTabs(site) { } else { MenuTab.videoSettings.classList.remove('disabled'); MenuTab.siteSettings.classList.remove('disabled'); - document.getElementById("_site_only_when_site_enabled").classList.remove("disabled"); // if popup isn't being opened for the first time, there's no reason to switch // we're already in this tab diff --git a/res/popup/popup.html b/res/popup/popup.html index e282f58..6b6dcbd 100644 --- a/res/popup/popup.html +++ b/res/popup/popup.html @@ -52,38 +52,41 @@ Never -
- Enable autodetection: -
- Always - On whitelisted sites - Never +
+
+ Enable autodetection: +
-
- + - Default stretching mode - -
+
+ Default stretching mode + +
- -
- Video alignment: -
- Left - Center - Right + +
+ Video alignment: +
+ Left + Center + Right +
+
-