縦型スライダーにしてみた
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4962 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
a6831ad860
commit
3192810aac
@ -37,9 +37,9 @@ function init()
|
||||
|
||||
var gDropLinksOnRadioSet,
|
||||
gGroupBookmarkRadioSet,
|
||||
gOpenLinkInTabRadio,
|
||||
gLoadLocationBarToNewTabRadio,
|
||||
gLoadLocationBarToChildTabRadio,
|
||||
gOpenLinkInTabScale,
|
||||
gLoadLocationBarToNewTabScale,
|
||||
gLoadLocationBarToChildTabScale,
|
||||
gLastStateIsVertical;
|
||||
var gTabbarPlacePositionInitialized = false;
|
||||
|
||||
@ -58,22 +58,22 @@ function initTabPane()
|
||||
'openGroupBookmark-deck'
|
||||
);
|
||||
|
||||
gOpenLinkInTabRadio = new RadioScaleSet(
|
||||
gOpenLinkInTabScale = new ScaleSet(
|
||||
['extensions.treestyletab.openOuterLinkInNewTab',
|
||||
'extensions.treestyletab.openAnyLinkInNewTab'],
|
||||
'openLinkInNewTab-radio',
|
||||
'openLinkInNewTab-scale',
|
||||
'openLinkInNewTab-labels'
|
||||
);
|
||||
gLoadLocationBarToNewTabRadio = new RadioScaleSet(
|
||||
gLoadLocationBarToNewTabScale = new ScaleSet(
|
||||
['extensions.treestyletab.urlbar.loadDifferentDomainToNewTab',
|
||||
'extensions.treestyletab.urlbar.loadSameDomainToNewTab'],
|
||||
'loadLocationBarToNewTab-radio',
|
||||
'loadLocationBarToNewTab-scale',
|
||||
'loadLocationBarToNewTab-labels'
|
||||
);
|
||||
gLoadLocationBarToChildTabRadio = new RadioScaleSet(
|
||||
gLoadLocationBarToChildTabScale = new ScaleSet(
|
||||
['extensions.treestyletab.urlbar.loadSameDomainToNewTab.asChild',
|
||||
'extensions.treestyletab.urlbar.loadDifferentDomainToNewTab.asChild'],
|
||||
'loadLocationBarToChildTab-radio',
|
||||
'loadLocationBarToChildTab-scale',
|
||||
'loadLocationBarToChildTab-labels'
|
||||
);
|
||||
|
||||
@ -246,58 +246,70 @@ function updateCloseRootBehaviorCheck()
|
||||
|
||||
|
||||
|
||||
function RadioScaleSet(aPrefs, aRadio, aLabelsDeck)
|
||||
function ScaleSet(aPrefs, aScale, aLabelsContainer)
|
||||
{
|
||||
this.prefs = aPrefs.map(document.getElementById, document);
|
||||
this.radio = document.getElementById(aRadio);
|
||||
this.scale = document.getElementById(aScale);
|
||||
this.labels = Array.slice(document.getElementById(aLabelsContainer).getElementsByTagName('label'));
|
||||
|
||||
this.radio.value = this.prefs[1].value ? 2 :
|
||||
this.scale.value = this.prefs[1].value ? 2 :
|
||||
this.prefs[0].value ? 1 :
|
||||
0 ;
|
||||
this.updateLabels();
|
||||
}
|
||||
RadioScaleSet.prototype = {
|
||||
ScaleSet.prototype = {
|
||||
onChange : function()
|
||||
{
|
||||
var value = this.value;
|
||||
this.prefs[0].value = value > 0;
|
||||
this.prefs[1].value = value > 1;
|
||||
this.updateLabels();
|
||||
},
|
||||
|
||||
set value(aValue)
|
||||
{
|
||||
this.radio.value = aValue;
|
||||
this.scale.value = aValue;
|
||||
this.onChange();
|
||||
return aValue;
|
||||
},
|
||||
get value()
|
||||
{
|
||||
return parseInt(this.radio.value);
|
||||
return parseInt(this.scale.value);
|
||||
},
|
||||
|
||||
set disabled(aDisabled)
|
||||
{
|
||||
if (aDisabled) {
|
||||
this.radio.setAttribute('disabled', true);
|
||||
Array.slice(this.radio.childNodes).forEach(function(aNode) {
|
||||
this.scale.setAttribute('disabled', true);
|
||||
this.labels.forEach(function(aNode) {
|
||||
aNode.setAttribute('disabled', true);
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.radio.removeAttribute('disabled');
|
||||
Array.slice(this.radio.childNodes).forEach(function(aNode) {
|
||||
aNode.removeAttribute('disabled');
|
||||
});
|
||||
this.scale.removeAttribute('disabled');
|
||||
this.updateLabels();
|
||||
}
|
||||
},
|
||||
get disabled()
|
||||
{
|
||||
return this.radio.getAttribute('disabled') == 'true';
|
||||
return this.scale.getAttribute('disabled') == 'true';
|
||||
},
|
||||
|
||||
updateLabels : function()
|
||||
{
|
||||
this.labels.forEach(function(aLabel, aIndex) {
|
||||
if (aIndex == this.value)
|
||||
aLabel.removeAttribute('disabled');
|
||||
else
|
||||
aLabel.setAttribute('disabled', true);
|
||||
}, this);
|
||||
},
|
||||
|
||||
destroy : function()
|
||||
{
|
||||
this.prefs = null;
|
||||
this.radio = null;
|
||||
this.scale = null;
|
||||
this.labels = null;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -352,35 +352,57 @@
|
||||
<tabpanel orient="vertical">
|
||||
<groupbox>
|
||||
<caption label="&config.link.caption;"/>
|
||||
<radiogroup id="openLinkInNewTab-radio"
|
||||
orient="vertical"
|
||||
oncommand="gOpenLinkInTabRadio.onChange();">
|
||||
<radio value="0" label="&config.link.none;"/>
|
||||
<radio value="1" label="&config.link.outer;"/>
|
||||
<radio value="2" label="&config.link.any;"/>
|
||||
</radiogroup>
|
||||
<hbox align="stretch">
|
||||
<scale id="openLinkInNewTab-scale"
|
||||
orient="vertical"
|
||||
min="0"
|
||||
max="2"
|
||||
style="height:4em;"
|
||||
onchange="gOpenLinkInTabScale.onChange();"/>
|
||||
<vbox id="openLinkInNewTab-labels">
|
||||
<label value="&config.link.none;" control="openLinkInNewTab-scale"/>
|
||||
<spacer flex="1"/>
|
||||
<label value="&config.link.outer;" control="openLinkInNewTab-scale"/>
|
||||
<spacer flex="1"/>
|
||||
<label value="&config.link.any;" control="openLinkInNewTab-scale"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
<groupbox>
|
||||
<caption label="&config.urlbar.caption;"/>
|
||||
<radiogroup id="loadLocationBarToNewTab-radio"
|
||||
orient="vertical"
|
||||
oncommand="
|
||||
gLoadLocationBarToNewTabRadio.onChange();
|
||||
gLoadLocationBarToChildTabRadio.disabled = gLoadLocationBarToNewTabRadio.value == 0;
|
||||
">
|
||||
<radio value="0" label="&config.urlbar.none;"/>
|
||||
<radio value="1" label="&config.urlbar.outer;"/>
|
||||
<radio value="2" label="&config.urlbar.any;"/>
|
||||
</radiogroup>
|
||||
<hbox align="center">
|
||||
<spacer style="width:1em;"/>
|
||||
<radiogroup id="loadLocationBarToChildTab-radio"
|
||||
<hbox align="stretch">
|
||||
<scale id="loadLocationBarToNewTab-scale"
|
||||
orient="vertical"
|
||||
oncommand="gLoadLocationBarToChildTabRadio.onChange();">
|
||||
<radio value="0" label="&config.urlbar.asChild.none;"/>
|
||||
<radio value="1" label="&config.urlbar.asChild.inner;"/>
|
||||
<radio value="2" label="&config.urlbar.asChild.any;"/>
|
||||
</radiogroup>
|
||||
min="0"
|
||||
max="2"
|
||||
style="height:4em;"
|
||||
onchange="
|
||||
gLoadLocationBarToNewTabScale.onChange();
|
||||
gLoadLocationBarToChildTabScale.disabled = gLoadLocationBarToNewTabScale.value == 0;
|
||||
"/>
|
||||
<vbox id="loadLocationBarToNewTab-labels">
|
||||
<label value="&config.urlbar.none;" control="loadLocationBarToNewTab-scale"/>
|
||||
<spacer flex="1"/>
|
||||
<label value="&config.urlbar.outer;" control="loadLocationBarToNewTab-scale"/>
|
||||
<spacer flex="1"/>
|
||||
<label value="&config.urlbar.any;" control="loadLocationBarToNewTab-scale"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<hbox align="stretch">
|
||||
<spacer style="width:1em;"/>
|
||||
<scale id="loadLocationBarToChildTab-scale"
|
||||
orient="vertical"
|
||||
min="0"
|
||||
max="2"
|
||||
style="height:4em;"
|
||||
onchange="gLoadLocationBarToChildTabScale.onChange();"/>
|
||||
<vbox id="loadLocationBarToChildTab-labels">
|
||||
<label value="&config.urlbar.asChild.none;" control="loadLocationBarToChildTab-scale"/>
|
||||
<spacer flex="1"/>
|
||||
<label value="&config.urlbar.asChild.inner;" control="loadLocationBarToChildTab-scale"/>
|
||||
<spacer flex="1"/>
|
||||
<label value="&config.urlbar.asChild.any;" control="loadLocationBarToChildTab-scale"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</tabpanel>
|
||||
|
Loading…
x
Reference in New Issue
Block a user