disable needless controls by status of checkboxes
This commit is contained in:
parent
0e6817b375
commit
d71eb160da
@ -12,6 +12,29 @@ Components.utils.import('resource://treestyletab-modules/lib/namespace.jsm');
|
|||||||
var animationManager = getNamespaceFor('piro.sakura.ne.jp')['piro.sakura.ne.jp'].animationManager;
|
var animationManager = getNamespaceFor('piro.sakura.ne.jp')['piro.sakura.ne.jp'].animationManager;
|
||||||
var prefs = getNamespaceFor('piro.sakura.ne.jp')['piro.sakura.ne.jp'].prefs;
|
var prefs = getNamespaceFor('piro.sakura.ne.jp')['piro.sakura.ne.jp'].prefs;
|
||||||
|
|
||||||
|
|
||||||
|
function syncEnabledState(aElement, aEnabled)
|
||||||
|
{
|
||||||
|
if (typeof aElement == 'string')
|
||||||
|
aElement = document.getElementById(aElement);
|
||||||
|
if (typeof aEnabled == 'string')
|
||||||
|
aEnabled = (new Function('return '+aEnabled)).call(aElement);
|
||||||
|
|
||||||
|
aElement.getAttribute('sync-enabled-state-targets')
|
||||||
|
.replace(/$\s+|\s+$/g, '')
|
||||||
|
.split(/\s+/)
|
||||||
|
.map(function(aId) {
|
||||||
|
if (!aId)
|
||||||
|
return;
|
||||||
|
var target = document.getElementById(aId);
|
||||||
|
if (aEnabled)
|
||||||
|
target.removeAttribute('disabled');
|
||||||
|
else
|
||||||
|
target.setAttribute('disabled', true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var gGroupBookmarkRadio,
|
var gGroupBookmarkRadio,
|
||||||
gGroupBookmarkUnderParent,
|
gGroupBookmarkUnderParent,
|
||||||
gGroupBookmarkType,
|
gGroupBookmarkType,
|
||||||
@ -266,15 +289,7 @@ function onSyncMaxTreeLevelPrefToUI(aTarget)
|
|||||||
if (UIValue)
|
if (UIValue)
|
||||||
textbox.value = value;
|
textbox.value = value;
|
||||||
|
|
||||||
[textbox, textbox.previousSibling, textbox.nextSibling].forEach(
|
syncEnabledState(aTarget, UIValue);
|
||||||
UIValue ?
|
|
||||||
function(aNode) {
|
|
||||||
aNode.removeAttribute('disabled');
|
|
||||||
} :
|
|
||||||
function(aNode) {
|
|
||||||
aNode.setAttribute('disabled', true);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
aTarget.sync = false;
|
aTarget.sync = false;
|
||||||
return UIValue;
|
return UIValue;
|
||||||
@ -294,6 +309,10 @@ function initAutoHidePane()
|
|||||||
|
|
||||||
updateAutoHideModeLabel();
|
updateAutoHideModeLabel();
|
||||||
onTabbarTransparencyScaleChange();
|
onTabbarTransparencyScaleChange();
|
||||||
|
|
||||||
|
syncEnabledState('extensions.treestyletab.tabbar.autoShow.mousemove-check', 'this.checked');
|
||||||
|
syncEnabledState('extensions.treestyletab.tabbar.autoShow.accelKeyDown-check', 'this.checked');
|
||||||
|
syncEnabledState('extensions.treestyletab.tabbar.autoShow.feedback-check', 'this.checked');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChangeAutoHideMode()
|
function onChangeAutoHideMode()
|
||||||
@ -331,7 +350,7 @@ var gUndoCloseTabSetRadioSet;
|
|||||||
|
|
||||||
function initTreePane()
|
function initTreePane()
|
||||||
{
|
{
|
||||||
updateCloseRootBehaviorCheck();
|
syncEnabledState('extensions.treestyletab.closeParentBehavior-radiogroup', 'this.value == 0');
|
||||||
|
|
||||||
gUndoCloseTabSetRadioSet = new RadioSet(
|
gUndoCloseTabSetRadioSet = new RadioSet(
|
||||||
'extensions.treestyletab.undoCloseTabSet.behavior',
|
'extensions.treestyletab.undoCloseTabSet.behavior',
|
||||||
@ -349,16 +368,6 @@ function initTreePane()
|
|||||||
focusMode.setAttribute('collapsed', true);
|
focusMode.setAttribute('collapsed', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCloseRootBehaviorCheck()
|
|
||||||
{
|
|
||||||
var closeParentBehavior = document.getElementById('extensions.treestyletab.closeParentBehavior-radiogroup').value;
|
|
||||||
var closeRootBehavior = document.getElementById('extensions.treestyletab.closeRootBehavior-check');
|
|
||||||
if (closeParentBehavior == 0)
|
|
||||||
closeRootBehavior.removeAttribute('disabled');
|
|
||||||
else
|
|
||||||
closeRootBehavior.setAttribute('disabled', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var gBookmarkDroppedTabsRadioSet;
|
var gBookmarkDroppedTabsRadioSet;
|
||||||
|
|
||||||
|
@ -137,15 +137,22 @@
|
|||||||
preference="extensions.treestyletab.maxTreeLevel.horizontal"
|
preference="extensions.treestyletab.maxTreeLevel.horizontal"
|
||||||
label="&config.enableSubtreeIndent;"
|
label="&config.enableSubtreeIndent;"
|
||||||
onsynctopreference="return onSyncMaxTreeLevelUIToPref('maxTreeLevel-checkbox-horizontal');"
|
onsynctopreference="return onSyncMaxTreeLevelUIToPref('maxTreeLevel-checkbox-horizontal');"
|
||||||
onsyncfrompreference="return onSyncMaxTreeLevelPrefToUI('maxTreeLevel-checkbox-horizontal');"/>
|
onsyncfrompreference="return onSyncMaxTreeLevelPrefToUI('maxTreeLevel-checkbox-horizontal');"
|
||||||
<label control="maxTreeLevel-textbox-horizontal"
|
sync-enabled-state-targets="
|
||||||
|
maxTreeLevel-textbox-horizontal-before
|
||||||
|
maxTreeLevel-textbox-horizontal
|
||||||
|
maxTreeLevel-textbox-horizontal-after
|
||||||
|
"/>
|
||||||
|
<label id="maxTreeLevel-textbox-horizontal-before"
|
||||||
|
control="maxTreeLevel-textbox-horizontal"
|
||||||
value="&config.maxTreeLevel.before;"/>
|
value="&config.maxTreeLevel.before;"/>
|
||||||
<textbox id="maxTreeLevel-textbox-horizontal"
|
<textbox id="maxTreeLevel-textbox-horizontal"
|
||||||
type="number"
|
type="number"
|
||||||
min="1" increment="1" style="width:4em;"
|
min="1" increment="1" style="width:4em;"
|
||||||
oninput="onSyncMaxTreeLevelUIToPref('maxTreeLevel-checkbox-horizontal', true);"
|
oninput="onSyncMaxTreeLevelUIToPref('maxTreeLevel-checkbox-horizontal', true);"
|
||||||
onchange="onSyncMaxTreeLevelUIToPref('maxTreeLevel-checkbox-horizontal', true);"/>
|
onchange="onSyncMaxTreeLevelUIToPref('maxTreeLevel-checkbox-horizontal', true);"/>
|
||||||
<label control="maxTreeLevel-textbox-horizontal"
|
<label id="maxTreeLevel-textbox-horizontal-after"
|
||||||
|
control="maxTreeLevel-textbox-horizontal"
|
||||||
value="&config.maxTreeLevel.after;"/>
|
value="&config.maxTreeLevel.after;"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
<hbox id="maxTreeLevel-vertical"
|
<hbox id="maxTreeLevel-vertical"
|
||||||
@ -154,15 +161,22 @@
|
|||||||
preference="extensions.treestyletab.maxTreeLevel.vertical"
|
preference="extensions.treestyletab.maxTreeLevel.vertical"
|
||||||
label="&config.enableSubtreeIndent;"
|
label="&config.enableSubtreeIndent;"
|
||||||
onsynctopreference="return onSyncMaxTreeLevelUIToPref('maxTreeLevel-checkbox-vertical');"
|
onsynctopreference="return onSyncMaxTreeLevelUIToPref('maxTreeLevel-checkbox-vertical');"
|
||||||
onsyncfrompreference="return onSyncMaxTreeLevelPrefToUI('maxTreeLevel-checkbox-vertical');"/>
|
onsyncfrompreference="return onSyncMaxTreeLevelPrefToUI('maxTreeLevel-checkbox-vertical');"
|
||||||
<label control="maxTreeLevel-textbox-vertical"
|
sync-enabled-state-targets="
|
||||||
|
maxTreeLevel-textbox-vertical-before
|
||||||
|
maxTreeLevel-textbox-vertical
|
||||||
|
maxTreeLevel-textbox-vertical-after
|
||||||
|
"/>
|
||||||
|
<label id="maxTreeLevel-textbox-vertical-before"
|
||||||
|
control="maxTreeLevel-textbox-vertical"
|
||||||
value="&config.maxTreeLevel.before;"/>
|
value="&config.maxTreeLevel.before;"/>
|
||||||
<textbox id="maxTreeLevel-textbox-vertical"
|
<textbox id="maxTreeLevel-textbox-vertical"
|
||||||
type="number"
|
type="number"
|
||||||
min="1" increment="1" style="width:4em;"
|
min="1" increment="1" style="width:4em;"
|
||||||
oninput="onSyncMaxTreeLevelUIToPref('maxTreeLevel-checkbox-vertical', true);"
|
oninput="onSyncMaxTreeLevelUIToPref('maxTreeLevel-checkbox-vertical', true);"
|
||||||
onchange="onSyncMaxTreeLevelUIToPref('maxTreeLevel-checkbox-vertical', true);"/>
|
onchange="onSyncMaxTreeLevelUIToPref('maxTreeLevel-checkbox-vertical', true);"/>
|
||||||
<label control="maxTreeLevel-textbox-vertical"
|
<label id="maxTreeLevel-textbox-vertical-after"
|
||||||
|
control="maxTreeLevel-textbox-vertical"
|
||||||
value="&config.maxTreeLevel.after;"/>
|
value="&config.maxTreeLevel.after;"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</vbox>
|
</vbox>
|
||||||
@ -481,10 +495,19 @@
|
|||||||
<caption label="&config.autoShow.caption;"/>
|
<caption label="&config.autoShow.caption;"/>
|
||||||
<checkbox id="extensions.treestyletab.tabbar.autoShow.mousemove-check"
|
<checkbox id="extensions.treestyletab.tabbar.autoShow.mousemove-check"
|
||||||
preference="extensions.treestyletab.tabbar.autoShow.mousemove"
|
preference="extensions.treestyletab.tabbar.autoShow.mousemove"
|
||||||
label="&config.autoShow.mousemove.mode2;"/>
|
label="&config.autoShow.mousemove.mode2;"
|
||||||
|
oncommand="syncEnabledState(this, this.checked);"
|
||||||
|
sync-enabled-state-targets="
|
||||||
|
extensions.treestyletab.tabbar.autoHide.area-before
|
||||||
|
extensions.treestyletab.tabbar.autoHide.area-textbox
|
||||||
|
extensions.treestyletab.tabbar.autoHide.area-after
|
||||||
|
extensions.treestyletab.tabbar.autoHide.delay-before
|
||||||
|
extensions.treestyletab.tabbar.autoHide.delay-textbox
|
||||||
|
extensions.treestyletab.tabbar.autoHide.delay-after
|
||||||
|
"/>
|
||||||
<hbox align="center">
|
<hbox align="center">
|
||||||
<spacer style="width:1em;"/>
|
<spacer style="width:1em;"/>
|
||||||
<label id="extensions.treestyletab.tabbar.autoHide.area-befre"
|
<label id="extensions.treestyletab.tabbar.autoHide.area-before"
|
||||||
value="&config.autoHide.area.before.mode2;"
|
value="&config.autoHide.area.before.mode2;"
|
||||||
control="extensions.treestyletab.tabbar.autoHide.area-textbox"/>
|
control="extensions.treestyletab.tabbar.autoHide.area-textbox"/>
|
||||||
<textbox id="extensions.treestyletab.tabbar.autoHide.area-textbox"
|
<textbox id="extensions.treestyletab.tabbar.autoHide.area-textbox"
|
||||||
@ -498,7 +521,7 @@
|
|||||||
<data target="extensions.treestyletab.tabbar.autoShow.mousemove-check"
|
<data target="extensions.treestyletab.tabbar.autoShow.mousemove-check"
|
||||||
label-mode1="&config.autoShow.mousemove;"
|
label-mode1="&config.autoShow.mousemove;"
|
||||||
label-mode2="&config.autoShow.mousemove.mode2;"/>
|
label-mode2="&config.autoShow.mousemove.mode2;"/>
|
||||||
<data target="extensions.treestyletab.tabbar.autoHide.area-befre"
|
<data target="extensions.treestyletab.tabbar.autoHide.area-before"
|
||||||
label-mode1="&config.autoHide.area.before;"
|
label-mode1="&config.autoHide.area.before;"
|
||||||
label-mode2="&config.autoHide.area.before.mode2;"/>
|
label-mode2="&config.autoHide.area.before.mode2;"/>
|
||||||
<data target="extensions.treestyletab.tabbar.autoHide.area-after"
|
<data target="extensions.treestyletab.tabbar.autoHide.area-after"
|
||||||
@ -506,27 +529,37 @@
|
|||||||
label-mode2="&config.autoHide.area.after.mode2;"/>
|
label-mode2="&config.autoHide.area.after.mode2;"/>
|
||||||
<hbox align="center">
|
<hbox align="center">
|
||||||
<spacer style="width:1em;"/>
|
<spacer style="width:1em;"/>
|
||||||
<label value="&config.autoHide.delay.before;"
|
<label id="extensions.treestyletab.tabbar.autoHide.delay-before"
|
||||||
|
value="&config.autoHide.delay.before;"
|
||||||
control="extensions.treestyletab.tabbar.autoHide.delay-textbox"/>
|
control="extensions.treestyletab.tabbar.autoHide.delay-textbox"/>
|
||||||
<textbox id="extensions.treestyletab.tabbar.autoHide.delay-textbox"
|
<textbox id="extensions.treestyletab.tabbar.autoHide.delay-textbox"
|
||||||
preference="extensions.treestyletab.tabbar.autoHide.delay"
|
preference="extensions.treestyletab.tabbar.autoHide.delay"
|
||||||
type="number"
|
type="number"
|
||||||
min="0" increment="1" style="width:4em;"/>
|
min="0" increment="1" style="width:4em;"/>
|
||||||
<label value="&config.autoHide.delay.after;"
|
<label id="extensions.treestyletab.tabbar.autoHide.delay-after"
|
||||||
|
value="&config.autoHide.delay.after;"
|
||||||
control="extensions.treestyletab.tabbar.autoHide.delay-textbox"/>
|
control="extensions.treestyletab.tabbar.autoHide.delay-textbox"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
<checkbox id="extensions.treestyletab.tabbar.autoShow.accelKeyDown-check"
|
<checkbox id="extensions.treestyletab.tabbar.autoShow.accelKeyDown-check"
|
||||||
preference="extensions.treestyletab.tabbar.autoShow.accelKeyDown"
|
preference="extensions.treestyletab.tabbar.autoShow.accelKeyDown"
|
||||||
label="&config.autoShow.accelKeyDown;"/>
|
label="&config.autoShow.accelKeyDown;"
|
||||||
|
oncommand="syncEnabledState(this, this.checked);"
|
||||||
|
sync-enabled-state-targets="
|
||||||
|
extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay-before
|
||||||
|
extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay-textbox
|
||||||
|
extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay-after
|
||||||
|
"/>
|
||||||
<hbox align="center">
|
<hbox align="center">
|
||||||
<spacer style="width:1em;"/>
|
<spacer style="width:1em;"/>
|
||||||
<label value="&config.autoShow.accelKeyDown.delay.before;"
|
<label id="extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay-before"
|
||||||
|
value="&config.autoShow.accelKeyDown.delay.before;"
|
||||||
control="extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay-textbox"/>
|
control="extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay-textbox"/>
|
||||||
<textbox id="extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay-textbox"
|
<textbox id="extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay-textbox"
|
||||||
preference="extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay"
|
preference="extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay"
|
||||||
type="number"
|
type="number"
|
||||||
min="0" increment="1" style="width:4em;"/>
|
min="0" increment="1" style="width:4em;"/>
|
||||||
<label value="&config.autoShow.accelKeyDown.delay.after;"
|
<label id="extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay-after"
|
||||||
|
value="&config.autoShow.accelKeyDown.delay.after;"
|
||||||
control="extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay-textbox"/>
|
control="extensions.treestyletab.tabbar.autoShow.accelKeyDown.delay-textbox"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
<checkbox id="extensions.treestyletab.tabbar.autoShow.tabSwitch-check"
|
<checkbox id="extensions.treestyletab.tabbar.autoShow.tabSwitch-check"
|
||||||
@ -534,16 +567,24 @@
|
|||||||
label="&config.autoShow.tabSwitch;"/>
|
label="&config.autoShow.tabSwitch;"/>
|
||||||
<checkbox id="extensions.treestyletab.tabbar.autoShow.feedback-check"
|
<checkbox id="extensions.treestyletab.tabbar.autoShow.feedback-check"
|
||||||
preference="extensions.treestyletab.tabbar.autoShow.feedback"
|
preference="extensions.treestyletab.tabbar.autoShow.feedback"
|
||||||
label="&config.autoShow.feedback;"/>
|
label="&config.autoShow.feedback;"
|
||||||
|
oncommand="syncEnabledState(this, this.checked);"
|
||||||
|
sync-enabled-state-targets="
|
||||||
|
extensions.treestyletab.tabbar.autoShow.feedback.delay-before
|
||||||
|
extensions.treestyletab.tabbar.autoShow.feedback.delay-textbox
|
||||||
|
extensions.treestyletab.tabbar.autoShow.feedback.delay-after
|
||||||
|
"/>
|
||||||
<hbox align="center">
|
<hbox align="center">
|
||||||
<spacer style="width:1em;"/>
|
<spacer style="width:1em;"/>
|
||||||
<label value="&config.autoShow.feedback.delay.before;"
|
<label id="extensions.treestyletab.tabbar.autoShow.feedback.delay-before"
|
||||||
|
value="&config.autoShow.feedback.delay.before;"
|
||||||
control="extensions.treestyletab.tabbar.autoShow.feedback.delay-textbox"/>
|
control="extensions.treestyletab.tabbar.autoShow.feedback.delay-textbox"/>
|
||||||
<textbox id="extensions.treestyletab.tabbar.autoShow.feedback.delay-textbox"
|
<textbox id="extensions.treestyletab.tabbar.autoShow.feedback.delay-textbox"
|
||||||
preference="extensions.treestyletab.tabbar.autoShow.feedback.delay"
|
preference="extensions.treestyletab.tabbar.autoShow.feedback.delay"
|
||||||
type="number"
|
type="number"
|
||||||
min="0" increment="1" style="width:4em;"/>
|
min="0" increment="1" style="width:4em;"/>
|
||||||
<label value="&config.autoShow.feedback.delay.after;"
|
<label id="extensions.treestyletab.tabbar.autoShow.feedback.delay-after"
|
||||||
|
value="&config.autoShow.feedback.delay.after;"
|
||||||
control="extensions.treestyletab.tabbar.autoShow.feedback.delay-textbox"/>
|
control="extensions.treestyletab.tabbar.autoShow.feedback.delay-textbox"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</groupbox>
|
</groupbox>
|
||||||
@ -628,7 +669,8 @@
|
|||||||
<radiogroup id="extensions.treestyletab.closeParentBehavior-radiogroup"
|
<radiogroup id="extensions.treestyletab.closeParentBehavior-radiogroup"
|
||||||
preference="extensions.treestyletab.closeParentBehavior"
|
preference="extensions.treestyletab.closeParentBehavior"
|
||||||
orient="vertical"
|
orient="vertical"
|
||||||
oncommand="updateCloseRootBehaviorCheck();">
|
oncommand="syncEnabledState(this, this.value == 0);"
|
||||||
|
sync-enabled-state-targets="extensions.treestyletab.closeRootBehavior-check">
|
||||||
<radio value="2" label="&config.closeParentBehavior.close;"/>
|
<radio value="2" label="&config.closeParentBehavior.close;"/>
|
||||||
<radio value="3" label="&config.closeParentBehavior.promoteFirst;"/>
|
<radio value="3" label="&config.closeParentBehavior.promoteFirst;"/>
|
||||||
<radio value="0" label="&config.closeParentBehavior.promoteAll;"/>
|
<radio value="0" label="&config.closeParentBehavior.promoteAll;"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user