diff --git a/content/treestyletab/config.js b/content/treestyletab/config.js
index ec0da058..2b2ea57b 100644
--- a/content/treestyletab/config.js
+++ b/content/treestyletab/config.js
@@ -9,10 +9,9 @@ function init()
}
-var gOpenLinkInNewTabScale,
- gOpenLinkInNewTabLabels,
- gOuterLinkPref,
- gAnyLinkPref,
+var gOpenLinkInTabScale,
+ gLoadLocationBarToNewTabScale,
+ gLoadLocationBarToChildTabScale,
gGroupBookmarkRadio,
gGroupBookmarkTree,
gGroupBookmarkReplace,
@@ -21,14 +20,24 @@ var gTabbarPlacePositionInitialized = false;
function initTabPane()
{
- gOuterLinkPref = document.getElementById('extensions.treestyletab.openOuterLinkInNewTab');
- gAnyLinkPref = document.getElementById('extensions.treestyletab.openAnyLinkInNewTab');
- gOpenLinkInNewTabScale = document.getElementById('openLinkInNewTab-scale');
- gOpenLinkInNewTabLabels = document.getElementById('openLinkInNewTab-labels');
- gOpenLinkInNewTabScale.value = gAnyLinkPref.value ? 2 :
- gOuterLinkPref.value ? 1 :
- 0 ;
- gOpenLinkInNewTabLabels.selectedIndex = gOpenLinkInNewTabScale.value;
+ gOpenLinkInTabScale = new ScaleSet(
+ ['extensions.treestyletab.openOuterLinkInNewTab',
+ 'extensions.treestyletab.openAnyLinkInNewTab'],
+ 'openLinkInNewTab-scale',
+ 'openLinkInNewTab-labels'
+ );
+ gLoadLocationBarToNewTabScale = new ScaleSet(
+ ['extensions.treestyletab.urlbar.loadDifferentDomainToNewTab',
+ 'extensions.treestyletab.urlbar.loadSameDomainToNewTab'],
+ 'loadLocationBarToNewTab-scale',
+ 'loadLocationBarToNewTab-labels'
+ );
+ gLoadLocationBarToChildTabScale = new ScaleSet(
+ ['extensions.treestyletab.urlbar.loadSameDomainToNewTab.asChild',
+ 'extensions.treestyletab.urlbar.loadDifferentDomainToNewTab.asChild'],
+ 'loadLocationBarToChildTab-scale',
+ 'loadLocationBarToChildTab-labels'
+ );
gGroupBookmarkRadio = document.getElementById('openGroupBookmarkAsTabSubTree-radiogroup');
gGroupBookmarkTree = document.getElementById('extensions.treestyletab.openGroupBookmarkAsTabSubTree');
@@ -64,13 +73,6 @@ function initTabPane()
gLastStateIsVertical = gLastStateIsVertical == 'left' || gLastStateIsVertical == 'right';
}
-function onOpenLinkInNewTabScaleChange()
-{
- gOuterLinkPref.value = gOpenLinkInNewTabScale.value == 1;
- gAnyLinkPref.value = gOpenLinkInNewTabScale.value == 2;
- gOpenLinkInNewTabLabels.selectedIndex = gOpenLinkInNewTabScale.value;
-}
-
function onChangeGroupBookmarkRadio()
{
gGroupBookmarkTree.value = gGroupBookmarkRadio.value == 'subtree';
@@ -203,3 +205,64 @@ function updateCloseRootBehaviorCheck()
else
closeRootBehavior.setAttribute('disabled', true);
}
+
+
+
+function ScaleSet(aPrefs, aScale, aLabelsDeck)
+{
+ this.prefs = aPrefs.map(document.getElementById, document);
+ this.scale = document.getElementById(aScale);
+ this.labels = document.getElementById(aLabelsDeck);
+
+ this.scale.value = this.prefs[1].value ? 2 :
+ this.prefs[0].value ? 1 :
+ 0 ;
+ this.labels.selectedIndex = this.scale.value;
+}
+ScaleSet.prototype = {
+ onChange : function()
+ {
+ var value = this.value;
+ this.prefs[0].value = value > 0;
+ this.prefs[1].value = value > 1;
+ this.labels.selectedIndex = value;
+ },
+
+ set value(aValue)
+ {
+ this.scale.value = aValue;
+ this.onChange();
+ return aValue;
+ },
+ get value()
+ {
+ return parseInt(this.scale.value);
+ },
+
+ set disabled(aDisabled)
+ {
+ if (aDisabled) {
+ this.scale.setAttribute('disabled', true);
+ Array.slice(this.labels.childNodes).forEach(function(aNode) {
+ aNode.setAttribute('disabled', true);
+ });
+ }
+ else {
+ this.scale.removeAttribute('disabled');
+ Array.slice(this.labels.childNodes).forEach(function(aNode) {
+ aNode.removeAttribute('disabled');
+ });
+ }
+ },
+ get disabled()
+ {
+ return this.scale.getAttribute('disabled') == 'true';
+ },
+
+ destroy : function()
+ {
+ this.prefs = null;
+ this.scale = null;
+ this.labels = null;
+ }
+};
diff --git a/content/treestyletab/config.xul b/content/treestyletab/config.xul
index df14db78..0a936302 100644
--- a/content/treestyletab/config.xul
+++ b/content/treestyletab/config.xul
@@ -317,8 +317,11 @@
-
+
+ onchange="gOpenLinkInTabScale.onChange();"/>
@@ -366,19 +369,34 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js
index dfb6da86..688a596c 100644
--- a/content/treestyletab/treestyletab.js
+++ b/content/treestyletab/treestyletab.js
@@ -358,7 +358,9 @@ var TreeStyleTabService = {
currentURI.split('#')[0] != info.uri.split('#')[0]
) {
openTab = info.modifier && info.invert ? !openTab : true ;
- parent = parentHost == targetHost && !internal.forceChild ? parentTab : frame ;
+ parent = ('forceChild' in internal && !internal.forceChild) ? null :
+ (parentHost == targetHost && !internal.forceChild) ? parentTab :
+ frame ;
insertBefore = parentHost == targetHost && !internal.forceChild &&
(this.getTreePref('insertNewChildAt') == this.kINSERT_FIRST ?
nextTab :
@@ -392,7 +394,10 @@ var TreeStyleTabService = {
newTab : this.getTreePref('urlbar.loadDifferentDomainToNewTab'),
forceChild : this.getTreePref('urlbar.loadDifferentDomainToNewTab.asChild')
},
- internal : { newTab : this.getTreePref('urlbar.loadSameDomainToNewChildTab') },
+ internal : {
+ newTab : this.getTreePref('urlbar.loadSameDomainToNewTab'),
+ forceChild : this.getTreePref('urlbar.loadSameDomainToNewTab.asChild')
+ },
modifier : aModifier,
invert : this.getTreePref('urlbar.invertDefaultBehavior')
});
@@ -1256,6 +1261,14 @@ var TreeStyleTabService = {
'extensions.treestyletab.tabbar.hideNewTabButton',
'extensions.treestyletab.tabbar.hideAlltabsButton'
]);
+ case 2:
+ if (this.getTreePref('urlbar.loadSameDomainToNewChildTab') !== null) {
+ let value = this.getTreePref('urlbar.loadSameDomainToNewChildTab');
+ this.setTreePref('urlbar.loadSameDomainToNewTab', value);
+ this.setTreePref('urlbar.loadSameDomainToNewTab.asChild', value);
+ if (value) this.setTreePref('urlbar.loadDifferentDomainToNewTab', value);
+ this.clearPref('extensions.treestyletab.urlbar.loadSameDomainToNewChildTab');
+ }
default:
orientalPrefs.forEach(function(aPref) {
let value = this.getPref(aPref);
@@ -1266,7 +1279,7 @@ var TreeStyleTabService = {
}, this);
break;
}
- this.setTreePref('orientalPrefsMigrated', 2);
+ this.setTreePref('orientalPrefsMigrated', 3);
},
preInitialized : false,
diff --git a/defaults/preferences/treestyletab.js b/defaults/preferences/treestyletab.js
index 93ce50ac..9930dcf0 100644
--- a/defaults/preferences/treestyletab.js
+++ b/defaults/preferences/treestyletab.js
@@ -78,7 +78,8 @@ pref("extensions.treestyletab.openAnyLinkInNewTab", false);
pref("extensions.treestyletab.link.invertDefaultBehavior", true);
pref("extensions.treestyletab.urlbar.loadDifferentDomainToNewTab", true);
pref("extensions.treestyletab.urlbar.loadDifferentDomainToNewTab.asChild", false);
-pref("extensions.treestyletab.urlbar.loadSameDomainToNewChildTab", true);
+pref("extensions.treestyletab.urlbar.loadSameDomainToNewTab", true);
+pref("extensions.treestyletab.urlbar.loadSameDomainToNewTab.asChild", true);
pref("extensions.treestyletab.urlbar.invertDefaultBehavior", true);
pref("extensions.treestyletab.loadDroppedLinkToNewChildTab", false);
pref("extensions.treestyletab.loadDroppedLinkToNewChildTab.confirm", true);
diff --git a/locale/de-DE/treestyletab/treestyletab.dtd b/locale/de-DE/treestyletab/treestyletab.dtd
index 9041073d..c8f41688 100644
--- a/locale/de-DE/treestyletab/treestyletab.dtd
+++ b/locale/de-DE/treestyletab/treestyletab.dtd
@@ -50,10 +50,13 @@
-
-
-
-
+
+
+
+
+
+
+
diff --git a/locale/en-US/treestyletab/treestyletab.dtd b/locale/en-US/treestyletab/treestyletab.dtd
index eafe92c4..dd8fbdc1 100644
--- a/locale/en-US/treestyletab/treestyletab.dtd
+++ b/locale/en-US/treestyletab/treestyletab.dtd
@@ -49,10 +49,13 @@
-
-
-
-
+
+
+
+
+
+
+
diff --git a/locale/es-ES/treestyletab/treestyletab.dtd b/locale/es-ES/treestyletab/treestyletab.dtd
index abb83979..6bd4320c 100644
--- a/locale/es-ES/treestyletab/treestyletab.dtd
+++ b/locale/es-ES/treestyletab/treestyletab.dtd
@@ -49,10 +49,13 @@
-
-
-
-
+
+
+
+
+
+
+
diff --git a/locale/it-IT/treestyletab/treestyletab.dtd b/locale/it-IT/treestyletab/treestyletab.dtd
index 9b68ee01..aeca34c1 100644
--- a/locale/it-IT/treestyletab/treestyletab.dtd
+++ b/locale/it-IT/treestyletab/treestyletab.dtd
@@ -49,10 +49,13 @@
-
-
-
-
+
+
+
+
+
+
+
diff --git a/locale/ja/treestyletab/treestyletab.dtd b/locale/ja/treestyletab/treestyletab.dtd
index 3c0983c8..f81054e1 100644
--- a/locale/ja/treestyletab/treestyletab.dtd
+++ b/locale/ja/treestyletab/treestyletab.dtd
@@ -49,10 +49,13 @@
-
-
-
-
+
+
+
+
+
+
+
diff --git a/locale/pl-PL/treestyletab/treestyletab.dtd b/locale/pl-PL/treestyletab/treestyletab.dtd
index 985e690c..c8650e9d 100644
--- a/locale/pl-PL/treestyletab/treestyletab.dtd
+++ b/locale/pl-PL/treestyletab/treestyletab.dtd
@@ -49,10 +49,13 @@
-
-
-
-
+
+
+
+
+
+
+
diff --git a/locale/ru-RU/treestyletab/treestyletab.dtd b/locale/ru-RU/treestyletab/treestyletab.dtd
index 4457c050..2feaf80d 100755
--- a/locale/ru-RU/treestyletab/treestyletab.dtd
+++ b/locale/ru-RU/treestyletab/treestyletab.dtd
@@ -49,10 +49,13 @@
-
-
-
-
+
+
+
+
+
+
+
diff --git a/locale/zh-CN/treestyletab/treestyletab.dtd b/locale/zh-CN/treestyletab/treestyletab.dtd
index b052e1d4..afdacf93 100644
--- a/locale/zh-CN/treestyletab/treestyletab.dtd
+++ b/locale/zh-CN/treestyletab/treestyletab.dtd
@@ -49,10 +49,13 @@
-
-
-
-
+
+
+
+
+
+
+
diff --git a/locale/zh-TW/treestyletab/treestyletab.dtd b/locale/zh-TW/treestyletab/treestyletab.dtd
index 9e85bf5d..ee99f662 100644
--- a/locale/zh-TW/treestyletab/treestyletab.dtd
+++ b/locale/zh-TW/treestyletab/treestyletab.dtd
@@ -48,10 +48,13 @@
-
-
-
-
+
+
+
+
+
+
+