タブバーのコンテキストメニューから、タブバーの表示位置をダイナミックに変更できるようにした
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1923 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
cdf6c764a1
commit
225640187d
@ -62,6 +62,9 @@
|
||||
<preference id="extensions.treestyletab.show.context-item-toggleFixed"
|
||||
name="extensions.treestyletab.show.context-item-toggleFixed"
|
||||
type="bool"/>
|
||||
<preference id="extensions.treestyletab.show.context-menu-tabbarPosition"
|
||||
name="extensions.treestyletab.show.context-menu-tabbarPosition"
|
||||
type="bool"/>
|
||||
</preferences>
|
||||
|
||||
<checkbox id="extensions.treestyletab.tabbar.scroll.smooth-check"
|
||||
@ -157,17 +160,20 @@
|
||||
<checkbox id="extensions.treestyletab.show.context-item-collapseAllSubtree-check"
|
||||
preference="extensions.treestyletab.show.context-item-collapseAllSubtree"
|
||||
label="&context.collapseAllSubtree.label;"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<checkbox id="extensions.treestyletab.show.context-item-expandAllSubtree-check"
|
||||
preference="extensions.treestyletab.show.context-item-expandAllSubtree"
|
||||
label="&context.expandAllSubtree.label;"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<checkbox id="extensions.treestyletab.show.context-item-toggleAutoHide-check"
|
||||
preference="extensions.treestyletab.show.context-item-toggleAutoHide"
|
||||
label="&context.toggleAutoHide.label;"/>
|
||||
<checkbox id="extensions.treestyletab.show.context-item-toggleFixed-check"
|
||||
preference="extensions.treestyletab.show.context-item-toggleFixed"
|
||||
label="&context.toggleFixed.label;"/>
|
||||
<checkbox id="extensions.treestyletab.show.context-menu-tabbarPosition-check"
|
||||
preference="extensions.treestyletab.show.context-menu-tabbarPosition"
|
||||
label="&context.tabbarPosition.label;"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
<checkbox id="extensions.treestyletab.show.openSelectionLinks-check"
|
||||
|
@ -459,6 +459,21 @@ var TreeStyleTabService = {
|
||||
!this.getTreePref('tabbar.fixed'));
|
||||
},
|
||||
|
||||
changeTabbarPosition : function(aNewPosition)
|
||||
{
|
||||
if (!aNewPosition || !/^(top|bottom|left|right)$/i.test(aNewPosition))
|
||||
aNewPosition = 'top';
|
||||
|
||||
aNewPosition = aNewPosition.toLowerCase();
|
||||
this.setTreePref('tabbar.position', aNewPosition);
|
||||
|
||||
if (!this.getTreePref('tabbar.syncRelatedPrefsForDynamicPosition')) return;
|
||||
|
||||
var vertical = (aNewPosition == 'left' || aNewPosition == 'right');
|
||||
this.setTreePref('enableSubtreeIndent', vertical);
|
||||
this.setTreePref('allowSubtreeCollapseExpand', vertical);
|
||||
},
|
||||
|
||||
/* get tab(s) */
|
||||
|
||||
getTabById : function(aId, aTabBrowserChildren)
|
||||
|
@ -72,6 +72,21 @@
|
||||
type="checkbox"
|
||||
autocheck="false"
|
||||
oncommand="TreeStyleTabService.toggleFixed();"/>
|
||||
<menu id="context-menu-tabbarPosition"
|
||||
label="&context.tabbarPosition.label;"
|
||||
accesskey="&context.tabbarPosition.accesskey;">
|
||||
<menupopup oncommand="TreeStyleTabService.changeTabbarPosition(event.target.getAttribute('value'));">
|
||||
<menuitem label="&config.tabbar.position.left;"
|
||||
type="radio" value="left"/>
|
||||
<menuitem label="&config.tabbar.position.right;"
|
||||
type="radio" value="right"/>
|
||||
<menuseparator/>
|
||||
<menuitem label="&config.tabbar.position.top;"
|
||||
type="radio" value="top"/>
|
||||
<menuitem label="&config.tabbar.position.bottom;"
|
||||
type="radio" value="bottom"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</data>
|
||||
</window>
|
||||
|
||||
|
@ -13,6 +13,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
kMENUITEM_AUTOHIDE_SEPARATOR : 'context-separator-toggleAutoHide',
|
||||
kMENUITEM_AUTOHIDE : 'context-item-toggleAutoHide',
|
||||
kMENUITEM_FIXED : 'context-item-toggleFixed',
|
||||
kMENUITEM_POSITION : 'context-menu-tabbarPosition',
|
||||
|
||||
mTabBrowser : null,
|
||||
|
||||
@ -365,7 +366,8 @@ TreeStyleTabBrowser.prototype = {
|
||||
aSelf.kMENUITEM_EXPAND,
|
||||
aSelf.kMENUITEM_AUTOHIDE_SEPARATOR,
|
||||
aSelf.kMENUITEM_AUTOHIDE,
|
||||
aSelf.kMENUITEM_FIXED
|
||||
aSelf.kMENUITEM_FIXED,
|
||||
aSelf.kMENUITEM_POSITION
|
||||
].forEach(function(aID) {
|
||||
var item = document.getElementById(aID).cloneNode(true);
|
||||
item.setAttribute('id', item.getAttribute('id')+suffix);
|
||||
@ -1524,13 +1526,28 @@ TreeStyleTabBrowser.prototype = {
|
||||
fixed.setAttribute('hidden', true);
|
||||
}
|
||||
|
||||
// position
|
||||
var position = this.evaluateXPath(
|
||||
'descendant::xul:menu[starts-with(@id, "'+this.kMENUITEM_POSITION+'")]',
|
||||
aEvent.currentTarget,
|
||||
XPathResult.FIRST_ORDERED_NODE_TYPE
|
||||
).singleNodeValue;
|
||||
if (this.getTreePref('show.'+this.kMENUITEM_POSITION)) {
|
||||
position.removeAttribute('hidden');
|
||||
position.getElementsByAttribute('value', pos)[0].setAttribute('checked', true);
|
||||
}
|
||||
else {
|
||||
position.setAttribute('hidden', true);
|
||||
}
|
||||
|
||||
sep = this.evaluateXPath(
|
||||
'descendant::xul:menuseparator[starts-with(@id, "'+this.kMENUITEM_AUTOHIDE_SEPARATOR+'")]',
|
||||
aEvent.currentTarget,
|
||||
XPathResult.FIRST_ORDERED_NODE_TYPE
|
||||
).singleNodeValue;
|
||||
if (autohide.getAttribute('hidden') != 'true' ||
|
||||
fixed.getAttribute('hidden') != 'true') {
|
||||
fixed.getAttribute('hidden') != 'true' ||
|
||||
position.getAttribute('hidden') != 'true') {
|
||||
sep.removeAttribute('hidden');
|
||||
}
|
||||
else {
|
||||
|
@ -12,6 +12,7 @@ pref("extensions.treestyletab.tabbar.autoHide.delay", 50);
|
||||
pref("extensions.treestyletab.tabbar.autoHide.area", 25);
|
||||
pref("extensions.treestyletab.tabbar.autoHide.expandArea", false);
|
||||
pref("extensions.treestyletab.tabbar.fixed", false);
|
||||
pref("extensions.treestyletab.tabbar.syncRelatedPrefsForDynamicPosition", true);
|
||||
pref("extensions.treestyletab.enableSubtreeIndent", true);
|
||||
pref("extensions.treestyletab.enableSubtreeIndent.allTabsPopup", true);
|
||||
pref("extensions.treestyletab.allowSubtreeCollapseExpand", true);
|
||||
@ -31,6 +32,7 @@ pref("extensions.treestyletab.show.context-item-collapseAllSubtree", true);
|
||||
pref("extensions.treestyletab.show.context-item-expandAllSubtree", true);
|
||||
pref("extensions.treestyletab.show.context-item-toggleAutoHide", true);
|
||||
pref("extensions.treestyletab.show.context-item-toggleFixed", true);
|
||||
pref("extensions.treestyletab.show.context-menu-tabbarPosition", false);
|
||||
|
||||
pref("extensions.treestyletab.openOuterLinkInNewTab", false);
|
||||
pref("extensions.treestyletab.openAnyLinkInNewTab", false);
|
||||
|
@ -101,3 +101,5 @@
|
||||
<!ENTITY context.toggleAutoHide.accesskey "h">
|
||||
<!ENTITY context.toggleFixed.label "Fix width of tab bar">
|
||||
<!ENTITY context.toggleFixed.accesskey "f">
|
||||
<!ENTITY context.tabbarPosition.label "Position">
|
||||
<!ENTITY context.tabbarPosition.accesskey "p">
|
||||
|
@ -101,3 +101,5 @@
|
||||
<!ENTITY context.toggleAutoHide.accesskey "b">
|
||||
<!ENTITY context.toggleFixed.label "Blocca larghezza della barra delle schede">
|
||||
<!ENTITY context.toggleFixed.accesskey "h">
|
||||
<!ENTITY context.tabbarPosition.label "Posizione">
|
||||
<!ENTITY context.tabbarPosition.accesskey "p">
|
||||
|
@ -99,3 +99,5 @@
|
||||
<!ENTITY context.toggleAutoHide.accesskey "h">
|
||||
<!ENTITY context.toggleFixed.label "タブバーの幅を固定">
|
||||
<!ENTITY context.toggleFixed.accesskey "f">
|
||||
<!ENTITY context.tabbarPosition.label "タブバーの位置">
|
||||
<!ENTITY context.tabbarPosition.accesskey "p">
|
||||
|
Loading…
Reference in New Issue
Block a user