Created
August 31, 2012 09:31
-
-
Save Infocatcher/3550790 to your computer and use it in GitHub Desktop.
Advance select tab for Tree Style Tab and mouse gestures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gBrowser.tabContainer.advanceSelectedTab(1 /* 1 or -1 */, true); | |
if("TreeStyleTabService" in window) { | |
const ns = "__mouseGesturesTabsSwitcher__"; | |
var autoExpandDelay = ( | |
"TreeStyleTabUtils" in window | |
? TreeStyleTabUtils | |
: TreeStyleTabService | |
).getTreePref("autoExpandSubtreeOnSelect.whileFocusMovingByShortcut.delay") || 800; | |
var ts = ns in window && window[ns]; | |
if(!ts) { | |
ts = window[ns] = { | |
timer: 0, | |
handleEvent: function(e) { | |
window.removeEventListener("mouseup", this, true); | |
this.clearDelayed(); | |
delete window[ns]; | |
}, | |
clear: function() { | |
clearTimeout(this.timer); | |
if("treeStyleTab" in gBrowser && "cancelDelayedExpandOnTabSelect" in gBrowser.treeStyleTab) | |
gBrowser.treeStyleTab.cancelDelayedExpandOnTabSelect(); | |
}, | |
clearDelayed: function() { | |
setTimeout(function(_this) { | |
_this.clear(); | |
}, 10, this); | |
} | |
}; | |
window.addEventListener("mouseup", ts, true); | |
} | |
ts.clear(); | |
ts.tab = gBrowser.selectedTab; | |
ts.timer = setTimeout(function() { | |
var tab = gBrowser.selectedTab; | |
if(tab == ts.tab) | |
gBrowser.treeStyleTab.collapseExpandSubtree(tab, false); | |
}, autoExpandDelay); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
History of this script: piroor/treestyletab#232