You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 5, 2019. It is now read-only.
This code from tabutils.js is responsible for tab stacking:
//在当前标签页的右侧打开新标签页
//连续打开后台标签时保持原有顺序
TU_hookCode("gBrowser.addTab",
[/\S*insertRelatedAfterCurrent\S*(?=\))/, "false"],
[/(?=(return t;)(?![\s\S]*\1))/, function() {
if (t.hasAttribute("opener")) {
function shouldStack(tab) { let args = tab.arguments; return args.aReferrerURI || args.aRelatedToCurrent && args.aURI != "about:blank"; }
let lastRelatedTab = this.mCurrentTab;
let isStack = this.isStackedTab(lastRelatedTab);
let willStack = (isStack || TU_getPref("extensions.tabutils.autoStack", false)) && shouldStack(t);
if (isStack && !willStack)
lastRelatedTab = this.lastSiblingTabOf(lastRelatedTab);
if (TU_getPref("extensions.tabutils.openTabNext.keepOrder", true)) {
let tab = lastRelatedTab.nextSibling;
let panelId = this.mCurrentTab.linkedPanel + "#";
for (; tab && tab.pinned; tab = tab.nextSibling);
for (; tab && tab.getAttribute("opener") == panelId && tab != t && (!willStack || shouldStack(tab)); tab = tab.nextSibling)
lastRelatedTab = tab;
}
if (willStack)
this.attachTabTo(t, lastRelatedTab, {move: true, expand: true});
this.moveTabTo(t, t._tPos > lastRelatedTab._tPos ? lastRelatedTab._tPos + 1 : lastRelatedTab._tPos);
}
}]
);
TU_hookCode("gBrowser.onTabOpen", "}", function() {
if ((function() {
switch (TU_getPref("extensions.tabutils.openTabNext", 1)) {
case 1: //All
case 2: return aRelatedToCurrent || aReferrerURI || aURI != "about:blank"; //All but New Tab
case 3: return aRelatedToCurrent == null ? aReferrerURI : aRelatedToCurrent; //None but Links
default: return false; //None
}
})()) {
aTab.setAttribute("opener", this.mCurrentTab.linkedPanel + "#");
}
});
TU_hookCode("gBrowser.onTabPinned", "}", function() {
aTab.removeAttribute("opener");
});
TU_hookCode("gBrowser.onTabUnstacked", "}", function() {
aTab.removeAttribute("opener");
if (aTab.selected)
this.updateCurrentBrowser(true);
});
Logic of code is simple, according to pref extensions.tabutils.openTabNext newly opened tab get attribute "opener" and according to pref tabutils.autoStack tab stacks, it works great links and new tab action, but by some reasons it won't work for "options" and "addons" tabs opened from main menu or hotkey, although attribute "opener" added to this tabs successfully.
Any ideas about this?
The text was updated successfully, but these errors were encountered:
Maybe, but tabs opened from bookmarks also don't stacks.
I think "addons" and "options" are included in category "none but links", and category "all" must include all type of tabs regardless where from it's opened.
This code from tabutils.js is responsible for tab stacking:
Logic of code is simple, according to pref
extensions.tabutils.openTabNext
newly opened tab get attribute "opener" and according to preftabutils.autoStack
tab stacks, it works great links and new tab action, but by some reasons it won't work for "options" and "addons" tabs opened from main menu or hotkey, although attribute "opener" added to this tabs successfully.Any ideas about this?
The text was updated successfully, but these errors were encountered: