Open duplicated tabs from back/forward buttons as children of the current tab

This commit is contained in:
Piro / YUKI Hiroshi 2012-09-23 14:57:29 +09:00
parent 583adb2a8e
commit c9a3d28c72
3 changed files with 17 additions and 3 deletions

View File

@ -267,7 +267,7 @@ var TreeStyleTabWindowHelper = {
eval('window.duplicateTabIn = '+
window.duplicateTabIn.toSource().replace(
'{',
'{ gBrowser.treeStyleTab.onBeforeTabDuplicate(aTab, where); '
'{ gBrowser.treeStyleTab.onBeforeTabDuplicate(aTab, where, delta); '
)
);
}

View File

@ -507,6 +507,16 @@ pref("extensions.treestyletab.autoAttach.newTabButton", 1);
* Options are same to extensions.treestyletab.autoAttach.newTabCommand.
*/
pref("extensions.treestyletab.autoAttach.duplicateTabCommand", 3);
/**
* How to treat duplicated tabs from "back" button.
* Options are same to extensions.treestyletab.autoAttach.newTabCommand.
*/
pref("extensions.treestyletab.autoAttach.duplicateTabCommand.back", 1);
/**
* How to treat duplicated tabs from "forward" button.
* Options are same to extensions.treestyletab.autoAttach.newTabCommand.
*/
pref("extensions.treestyletab.autoAttach.duplicateTabCommand.forward", 1);
/**
* How to treat new tabs from middle click (or Ctrl-click) on the "Go" button.
* Options are same to extensions.treestyletab.autoAttach.newTabCommand.

View File

@ -1167,13 +1167,17 @@ TreeStyleTabWindow.prototype = {
},
_clickEventOnNewTabButtonHandled : false,
onBeforeTabDuplicate : function TSTWindow_onBeforeTabDuplicate(aTab, aWhere)
onBeforeTabDuplicate : function TSTWindow_onBeforeTabDuplicate(aTab, aWhere, aDelta)
{
if (aWhere && aWhere.indexOf('tab') != 0)
return;
var b = this.getTabBrowserFromChild(aTab) || this.browser;
this._handleNewTabCommand(aTab || b.selectedTab, this.getTreePref('autoAttach.duplicateTabCommand'));
var behaviorPref = !aDelta ? 'autoAttach.duplicateTabCommand' :
aDelta < 0 ? 'autoAttach.duplicateTabCommand.back' :
'autoAttach.duplicateTabCommand.forward'
var behavior = this.getTreePref(behaviorPref);
this._handleNewTabCommand(aTab || b.selectedTab, behavior);
},
onBeforeOpenLink : function TSTWindow_onBeforeOpenLink(aWhere, aOwner)