disable other buttons in 'extension settings' tab if extension is disabled

This commit is contained in:
Tamius Han 2018-09-20 22:02:15 +02:00
parent d1d8945aac
commit 51c1255eed
2 changed files with 35 additions and 25 deletions

View File

@ -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

View File

@ -52,38 +52,41 @@
<a id="_ext_global_options_disabled" class="button _ext _ext_global_options _disabled" >Never</a>
</div>
<div class="row">
<span class="label">Enable autodetection:</span>
<div class="button-row">
<a id="_ar_global_options_blacklist" class="button _autoAr _ar_global_options _blacklist">Always</a>
<a id="_ar_global_options_whitelist" class="button _autoAr _ar_global_options _whitelist">On whitelisted sites</a>
<a id="_ar_global_options_disabled" class="button _autoAr _ar_global_options _disabled" >Never</a>
<div id="_ext_only_when_ext_enabled">
<div class="row">
<span class="label">Enable autodetection:</span>
<div class="button-row">
<a id="_ar_global_options_blacklist" class="button _autoAr _ar_global_options _blacklist">Always</a>
<a id="_ar_global_options_whitelist" class="button _autoAr _ar_global_options _whitelist">On whitelisted sites</a>
<a id="_ar_global_options_disabled" class="button _autoAr _ar_global_options _disabled" >Never</a>
</div>
</div>
</div>
<!-- TODO: default aspect ratio settings -->
<!-- TODO: default aspect ratio settings -->
<span class="label experimental">Default stretching mode</span>
<div class="button-row">
<a id="_stretch_global_none" class="button _stretch _ar_stretch_global _none w24">Never<br/><span id="_b_stretch_default_none_key" class="smallcaps small darker"></span></a>
<a id="_stretch_global_basic" class="button _stretch _ar_stretch_global _basic w24">Basic<br/><span id="_b_stretch_default_basic_key" class="smallcaps small darker"></span></a>
<a id="_stretch_global_hybrid" class="button _stretch _ar_stretch_global _hybrid w24">Hybrid<br/><span id="_b_stretch_default_hybrid_key" class="smallcaps small darker"></span></a>
<a id="_stretch_global_conditional" class="button _stretch _ar_stretch_global _conditional w24">Thin borders<br/><span id="_b_stretch_default_conditional_key" class="smallcaps small darker"></span></a>
</div>
</div>
<div class="row">
<span class="label experimental">Default stretching mode</span>
<div class="button-row">
<a id="_stretch_global_none" class="button _stretch _ar_stretch_global _none w24">Never<br/><span id="_b_stretch_default_none_key" class="smallcaps small darker"></span></a>
<a id="_stretch_global_basic" class="button _stretch _ar_stretch_global _basic w24">Basic<br/><span id="_b_stretch_default_basic_key" class="smallcaps small darker"></span></a>
<a id="_stretch_global_hybrid" class="button _stretch _ar_stretch_global _hybrid w24">Hybrid<br/><span id="_b_stretch_default_hybrid_key" class="smallcaps small darker"></span></a>
<a id="_stretch_global_conditional" class="button _stretch _ar_stretch_global _conditional w24">Thin borders<br/><span id="_b_stretch_default_conditional_key" class="smallcaps small darker"></span></a>
</div>
</div>
<!-- VIDEO ALIGNMENT -->
<div class="row">
<span class="label">Video alignment:</span>
<div class="button-row">
<a id="_align_ext_left" class="button _align_ext _align_ext_left">Left</a>
<a id="_align_ext_center" class="button _align_ext _align_ext_center">Center</a>
<a id="_align_ext_right" class="button _align_ext _align_ext_right">Right</a>
<!-- VIDEO ALIGNMENT -->
<div class="row">
<span class="label">Video alignment:</span>
<div class="button-row">
<a id="_align_ext_left" class="button _align_ext _align_ext_left">Left</a>
<a id="_align_ext_center" class="button _align_ext _align_ext_center">Center</a>
<a id="_align_ext_right" class="button _align_ext _align_ext_right">Right</a>
</div>
</div>
</div>
</div>
</div>
<!-- SITE SETTINGS -->
<div id="_menu_settings_site" class="suboption hidden">
<div class="row">