ロケーションバーからタブを開く設定をscaleに

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4807 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-07-24 11:00:53 +00:00
parent 582bdcf2ad
commit f4e2b0b2ed
13 changed files with 197 additions and 75 deletions

View File

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

View File

@ -317,8 +317,11 @@
<preference id="extensions.treestyletab.urlbar.loadDifferentDomainToNewTab.asChild"
name="extensions.treestyletab.urlbar.loadDifferentDomainToNewTab.asChild"
type="bool"/>
<preference id="extensions.treestyletab.urlbar.loadSameDomainToNewChildTab"
name="extensions.treestyletab.urlbar.loadSameDomainToNewChildTab"
<preference id="extensions.treestyletab.urlbar.loadSameDomainToNewTab"
name="extensions.treestyletab.urlbar.loadSameDomainToNewTab"
type="bool"/>
<preference id="extensions.treestyletab.urlbar.loadSameDomainToNewTab.asChild"
name="extensions.treestyletab.urlbar.loadSameDomainToNewTab.asChild"
type="bool"/>
<preference id="extensions.treestyletab.loadDroppedLinkToNewChildTab"
name="extensions.treestyletab.loadDroppedLinkToNewChildTab"
@ -356,7 +359,7 @@
orient="horizontal"
min="0"
max="2"
onchange="onOpenLinkInNewTabScaleChange()"/>
onchange="gOpenLinkInTabScale.onChange();"/>
<deck id="openLinkInNewTab-labels">
<label value="&config.link.none;" control="openLinkInNewTab-scale"/>
<label value="&config.link.outer;" control="openLinkInNewTab-scale"/>
@ -366,19 +369,34 @@
</groupbox>
<groupbox>
<caption label="&config.urlbar.caption;"/>
<vbox>
<hbox align="center">
<checkbox id="extensions.treestyletab.urlbar.loadDifferentDomainToNewTab-check"
preference="extensions.treestyletab.urlbar.loadDifferentDomainToNewTab"
label="&config.urlbar.loadDifferentDomainToNewTab;"/>
<checkbox id="extensions.treestyletab.urlbar.loadDifferentDomainToNewTab.asChild-check"
preference="extensions.treestyletab.urlbar.loadDifferentDomainToNewTab.asChild"
label="&config.urlbar.loadDifferentDomainToNewTab.asChild;"/>
</hbox>
<checkbox id="extensions.treestyletab.urlbar.loadSameDomainToNewChildTab-check"
preference="extensions.treestyletab.urlbar.loadSameDomainToNewChildTab"
label="&config.urlbar.loadSameDomainToNewChildTab;"/>
</vbox>
<hbox align="center">
<scale id="loadLocationBarToNewTab-scale"
orient="horizontal"
min="0"
max="2"
onchange="
gLoadLocationBarToNewTabScale.onChange();
gLoadLocationBarToChildTabScale.disabled = gLoadLocationBarToNewTabScale.value == 0;
"/>
<deck id="loadLocationBarToNewTab-labels">
<label value="&config.urlbar.none;" control="loadLocationBarToNewTab-scale"/>
<label value="&config.urlbar.outer;" control="loadLocationBarToNewTab-scale"/>
<label value="&config.urlbar.any;" control="loadLocationBarToNewTab-scale"/>
</deck>
</hbox>
<hbox align="center">
<spacer style="width:1em;"/>
<scale id="loadLocationBarToChildTab-scale"
orient="horizontal"
min="0"
max="2"
onchange="gLoadLocationBarToChildTabScale.onChange();"/>
<deck id="loadLocationBarToChildTab-labels">
<label value="&config.urlbar.asChild.none;" control="loadLocationBarToChildTab-scale"/>
<label value="&config.urlbar.asChild.inner;" control="loadLocationBarToChildTab-scale"/>
<label value="&config.urlbar.asChild.any;" control="loadLocationBarToChildTab-scale"/>
</deck>
</hbox>
</groupbox>
<groupbox>
<caption label="&config.loadDroppedLinkToNewChildTab.caption;"/>

View File

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

View File

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

View File

@ -50,10 +50,13 @@
<!ENTITY config.link.outer "Links auf andere Webseiten in einem neuen Tab öffnen">
<!ENTITY config.link.any "Jeden Link in einem neuen Tab öffnen">
<!ENTITY config.urlbar.caption "Verhalten beim Eingeben einer URL in die Adresszeile">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab "In neuem Tab laden, falls es eine andere Webseite ist">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab.asChild "dem aktuellen Tab untergeordnet">
<!ENTITY config.urlbar.loadSameDomainToNewChildTab "In neues untergeordnetes Tab laden, falls es die gleiche Webseite ist">
<!ENTITY config.urlbar.caption "Automatic New Tab Level for the Location Bar">
<!ENTITY config.urlbar.none "Nothing (Firefox default)">
<!ENTITY config.urlbar.outer "In neuem Tab laden, falls es eine andere Webseite ist">
<!ENTITY config.urlbar.any "Load into new tab anytime">
<!ENTITY config.urlbar.asChild.none "Open as separate tab">
<!ENTITY config.urlbar.asChild.inner "Open as child tab if it is the same website">
<!ENTITY config.urlbar.asChild.any "Open as child tab anytime">
<!ENTITY config.loadDroppedLinkToNewChildTab.caption "Verhalten für das Drag &amp; Drop von URLs auf Tabs">
<!ENTITY config.loadDroppedLinkToNewChildTab.load "Seite im Tab laden (Firefox Standard)">

View File

@ -49,10 +49,13 @@
<!ENTITY config.link.outer "Open links to different website in new tab">
<!ENTITY config.link.any "Open any link in new tab">
<!ENTITY config.urlbar.caption "Action for entering URI to the location bar">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab "Load into new tab if it is a different website">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab.asChild "as a child of the current tab">
<!ENTITY config.urlbar.loadSameDomainToNewChildTab "Load into new child tab if it is the same website">
<!ENTITY config.urlbar.caption "Automatic New Tab Level for the Location Bar">
<!ENTITY config.urlbar.none "Nothing (Firefox default)">
<!ENTITY config.urlbar.outer "Load into new tab if it is a different website">
<!ENTITY config.urlbar.any "Load into new tab anytime">
<!ENTITY config.urlbar.asChild.none "Open as separate tab">
<!ENTITY config.urlbar.asChild.inner "Open as child tab if it is the same website">
<!ENTITY config.urlbar.asChild.any "Open as child tab anytime">
<!ENTITY config.loadDroppedLinkToNewChildTab.caption "Action for drag drop of links or URLs to existing tab">
<!ENTITY config.loadDroppedLinkToNewChildTab.load "Load link into the tab (Firefox default)">

View File

@ -49,10 +49,13 @@
<!ENTITY config.link.outer "Abrir enlaces a un diferente sitio en una nueva pestaña">
<!ENTITY config.link.any "Abrir cualquier enlace en una nueva pestaña">
<!ENTITY config.urlbar.caption "Acción al ingresar una URI a la barra de ubicación">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab "Cargar en una nueva pestaña si es un sitio diferente al actual">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab.asChild "como hija de la pestaña actual">
<!ENTITY config.urlbar.loadSameDomainToNewChildTab "Cargar en una nueva hija si pertenece al mismo sitio">
<!ENTITY config.urlbar.caption "Automatic New Tab Level for the Location Bar">
<!ENTITY config.urlbar.none "Nothing (Firefox default)">
<!ENTITY config.urlbar.outer "Cargar en una nueva pestaña si es un sitio diferente al actual">
<!ENTITY config.urlbar.any "Load into new tab anytime">
<!ENTITY config.urlbar.asChild.none "Open as separate tab">
<!ENTITY config.urlbar.asChild.inner "Open as child tab if it is the same website">
<!ENTITY config.urlbar.asChild.any "Open as child tab anytime">
<!ENTITY config.loadDroppedLinkToNewChildTab.caption "Acción para arrastrar y soltar enlaces o URIs en pestañas existentes">
<!ENTITY config.loadDroppedLinkToNewChildTab.load "Cargar enlace dentro de una nueva pestaña (Predeterminado en Firefox)">

View File

@ -49,10 +49,13 @@
<!ENTITY config.link.outer "Apri i collegamenti a siti esterni in una nuova scheda">
<!ENTITY config.link.any "Apri tutti i collegamenti in una nuova scheda">
<!ENTITY config.urlbar.caption "L&apos;inserimento di un indirizzo nella barra degli indirizzi">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab "apre una nuova scheda se appartiene a un sito web differente">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab.asChild "come sottoscheda della scheda in uso">
<!ENTITY config.urlbar.loadSameDomainToNewChildTab "apre una nuova sottoscheda se appartiene allo stesso sito web">
<!ENTITY config.urlbar.caption "Automatic New Tab Level for the Location Bar">
<!ENTITY config.urlbar.none "Nothing (Firefox default)">
<!ENTITY config.urlbar.outer "apre una nuova scheda se appartiene a un sito web differente">
<!ENTITY config.urlbar.any "Load into new tab anytime">
<!ENTITY config.urlbar.asChild.none "Open as separate tab">
<!ENTITY config.urlbar.asChild.inner "Open as child tab if it is the same website">
<!ENTITY config.urlbar.asChild.any "Open as child tab anytime">
<!ENTITY config.loadDroppedLinkToNewChildTab.caption "Il trascinamento di collegamenti o indirizzi su una scheda esistente">
<!ENTITY config.loadDroppedLinkToNewChildTab.load "carica il collegamento nella scheda (comportamento predefinito di Firefox)">

View File

@ -49,10 +49,13 @@
<!ENTITY config.link.outer "異なるサイトへのリンクをタブで開く">
<!ENTITY config.link.any "すべてのリンクをタブで開く">
<!ENTITY config.urlbar.caption "ロケーションバーへの入力">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab "異なるサイトのURIを新しいタブで開く">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab.asChild "現在のタブの子にする">
<!ENTITY config.urlbar.loadSameDomainToNewChildTab "同じサイトのURIを新しい子タブで開く">
<!ENTITY config.urlbar.caption "ロケーションバーから自動的にタブを開くレベル">
<!ENTITY config.urlbar.none "なしFirefox初期状態">
<!ENTITY config.urlbar.outer "異なるサイトを新しいタブで開く">
<!ENTITY config.urlbar.any "すべて新しいタブで開く">
<!ENTITY config.urlbar.asChild.none "ツリーにしない">
<!ENTITY config.urlbar.asChild.inner "同じサイトのタブは現在のタブの子として開く">
<!ENTITY config.urlbar.asChild.any "常に現在のタブの子として開く">
<!ENTITY config.loadDroppedLinkToNewChildTab.caption "リンクやURLをタブにドラッグドロップした時">
<!ENTITY config.loadDroppedLinkToNewChildTab.load "ドロップ先のタブの中に読み込むFirefox初期状態">

View File

@ -49,10 +49,13 @@
<!ENTITY config.link.outer "Otwieraj odnośniki do innej witryny w nowych kartach">
<!ENTITY config.link.any "Otwieraj wszystkie odnośniki w nowych kartach">
<!ENTITY config.urlbar.caption "Działanie po wprowadzeniu adresu URI do pasku adresu">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab "Jeśli jest to inna witryna, otwórz w nowej karcie">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab.asChild "jako potomną aktywnej karty">
<!ENTITY config.urlbar.loadSameDomainToNewChildTab "Jeśli jest to ta sama witryna, otwórz w nowej potomnej karcie">
<!ENTITY config.urlbar.caption "Automatic New Tab Level for the Location Bar">
<!ENTITY config.urlbar.none "Nothing (Firefox default)">
<!ENTITY config.urlbar.outer "Jeśli jest to inna witryna, otwórz w nowej karcie">
<!ENTITY config.urlbar.any "Load into new tab anytime">
<!ENTITY config.urlbar.asChild.none "Open as separate tab">
<!ENTITY config.urlbar.asChild.inner "Open as child tab if it is the same website">
<!ENTITY config.urlbar.asChild.any "Open as child tab anytime">
<!ENTITY config.loadDroppedLinkToNewChildTab.caption "Działanie po przeciągnięciu odnośników lub adresów URL do istniejącej karty">
<!ENTITY config.loadDroppedLinkToNewChildTab.load "Otwieraj odnośnik w nowej karcie (domyślne działanie Firefoksa)">

View File

@ -49,10 +49,13 @@
<!ENTITY config.link.outer "Открывать ссылки на другой сайт в новой вкладке">
<!ENTITY config.link.any "Открывать все ссылки в новой вкладке">
<!ENTITY config.urlbar.caption "Действие для введенного URI в строке адреса">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab "Загружать в новой вкладке если ведут на другой сайт">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab.asChild "Как дочернюю от текущей вкладки">
<!ENTITY config.urlbar.loadSameDomainToNewChildTab "Загружать в новой дочерней вкладке ведет на тот же сайт">
<!ENTITY config.urlbar.caption "Automatic New Tab Level for the Location Bar">
<!ENTITY config.urlbar.none "Nothing (Firefox default)">
<!ENTITY config.urlbar.outer "Загружать в новой вкладке если ведут на другой сайт">
<!ENTITY config.urlbar.any "Load into new tab anytime">
<!ENTITY config.urlbar.asChild.none "Open as separate tab">
<!ENTITY config.urlbar.asChild.inner "Open as child tab if it is the same website">
<!ENTITY config.urlbar.asChild.any "Open as child tab anytime">
<!ENTITY config.loadDroppedLinkToNewChildTab.caption "Действие при перетаскивании ссылок или URL-ов в имеющуюся вкладку">
<!ENTITY config.loadDroppedLinkToNewChildTab.load "Загрузить ссылку во вкладке (в Firefox по умолчанию)">

View File

@ -49,10 +49,13 @@
<!ENTITY config.link.outer "在新标签中打开外部网站的链接">
<!ENTITY config.link.any "在新标签中打开所有链接">
<!ENTITY config.urlbar.caption "在地址栏中输入URI后">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab "如果是不同网站,在新标签中加载">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab.asChild "作为当前标签的子标签">
<!ENTITY config.urlbar.loadSameDomainToNewChildTab "如果是相同网站,加载到新的子标签">
<!ENTITY config.urlbar.caption "Automatic New Tab Level for the Location Bar">
<!ENTITY config.urlbar.none "Nothing (Firefox default)">
<!ENTITY config.urlbar.outer "如果是不同网站,在新标签中加载">
<!ENTITY config.urlbar.any "Load into new tab anytime">
<!ENTITY config.urlbar.asChild.none "Open as separate tab">
<!ENTITY config.urlbar.asChild.inner "Open as child tab if it is the same website">
<!ENTITY config.urlbar.asChild.any "Open as child tab anytime">
<!ENTITY config.loadDroppedLinkToNewChildTab.caption "将链接或URL拖拽到现有标签后">
<!ENTITY config.loadDroppedLinkToNewChildTab.load "在标签中加载链接 Firefox 默认)">

View File

@ -48,10 +48,13 @@
<!ENTITY config.link.outer "用新分頁開啟通往不同網站的鏈結">
<!ENTITY config.link.any "用新分頁開啟所有鏈結">
<!ENTITY config.urlbar.caption "在網址列輸入時">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab "用新分頁開啟通往不同網站的 URL">
<!ENTITY config.urlbar.loadDifferentDomainToNewTab.asChild "作為目前分頁的子分頁">
<!ENTITY config.urlbar.loadSameDomainToNewChildTab "用新子分頁開啟往相同網站的鏈結">
<!ENTITY config.urlbar.caption "Automatic New Tab Level for the Location Bar">
<!ENTITY config.urlbar.none "Nothing (Firefox default)">
<!ENTITY config.urlbar.outer "用新分頁開啟通往不同網站的 URL">
<!ENTITY config.urlbar.any "Load into new tab anytime">
<!ENTITY config.urlbar.asChild.none "Open as separate tab">
<!ENTITY config.urlbar.asChild.inner "Open as child tab if it is the same website">
<!ENTITY config.urlbar.asChild.any "Open as child tab anytime">
<!ENTITY config.loadDroppedLinkToNewChildTab.caption "拖曳鏈結或 URL 到現有的分頁時">
<!ENTITY config.loadDroppedLinkToNewChildTab.load "在拖曳目的地分頁載入鏈結Firefox 預設)">