From 69136626d66da4b4d74999c00acd5211db856885 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 4 Sep 2014 01:34:19 +0800 Subject: [PATCH 001/116] add String() for all setTabValue param 3, workaround for Firefox 33+. ref: https://bugzilla.mozilla.org/show_bug.cgi?id=908440 https://github.com/luckyrat/KeeFox/commit/4bf7c14be9f628b6935b5ef943f6acbe79384966 https://github.com/ithinc/tabutils/blob/423eed5542ef7d3725f08185d3071e60fe6055b2/chrome/content/tabutils-pt.js#L61 --- chrome/content/tabutils.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 679af62..9daf3ab 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -91,7 +91,7 @@ var tabutils = { return this.removeAttribute(aTab, aAttr); aTab.setAttribute(aAttr, aVal); - this._ss.setTabValue(aTab, aAttr, aVal); + this._ss.setTabValue(aTab, aAttr, String(aVal)); }, removeAttribute: function(aTab, aAttr) { @@ -840,21 +840,21 @@ tabutils._tabClosingOptions = function() { var tabHistory = this.mTabContainer._tabHistory; tabHistory.splice(1, 0, aTab); aTab._lastAccessed = Date.now(); - tabutils._ss.setTabValue(aTab, "lastAccessed", aTab._lastAccessed); + tabutils._ss.setTabValue(aTab, "lastAccessed", String(aTab._lastAccessed)); }); TU_hookCode("gBrowser.onTabSelect", "}", function() { var tabHistory = this.mTabContainer._tabHistory; var lastTab = tabHistory[0]; lastTab._lastAccessed = Date.now(); - tabutils._ss.setTabValue(lastTab, "lastAccessed", lastTab._lastAccessed); + tabutils._ss.setTabValue(lastTab, "lastAccessed", String(lastTab._lastAccessed)); var index = tabHistory.indexOf(aTab); if (index > -1) tabHistory.splice(index, 1); tabHistory.unshift(aTab); aTab._lastAccessed = Infinity; - tabutils._ss.setTabValue(aTab, "lastAccessed", aTab._lastAccessed); + tabutils._ss.setTabValue(aTab, "lastAccessed", String(aTab._lastAccessed)); }); TU_hookCode("gBrowser.onTabClose", "}", function() { @@ -871,7 +871,7 @@ tabutils._tabClosingOptions = function() { tabHistory.splice(index, 1); if (aTab._lastAccessed == Infinity) - tabutils._ss.setTabValue(aTab, "lastAccessed", aTab._lastAccessed); + tabutils._ss.setTabValue(aTab, "lastAccessed", String(aTab._lastAccessed)); else aTab._lastAccessed = tabutils._ss.getTabValue(aTab, "lastAccessed"); @@ -1168,7 +1168,7 @@ tabutils._protectAndLockTab = function() { else { aTab.setAttribute("protected", true); if (!aRestoring) - tabutils._ss.setTabValue(aTab, "protected", true); + tabutils._ss.setTabValue(aTab, "protected", String(true)); if (aRestoring == null && !gPrivateBrowsingUI.privateBrowsingEnabled && TU_getPref("extensions.tabutils.autoProtect", true)) { PlacesUtils.tagging.tagURI(aTab.linkedBrowser.currentURI, ["protected"]); } @@ -1194,7 +1194,7 @@ tabutils._protectAndLockTab = function() { else { aTab.setAttribute("locked", true); if (!aRestoring) - tabutils._ss.setTabValue(aTab, "locked", true); + tabutils._ss.setTabValue(aTab, "locked", String(true)); if (aRestoring == null && !gPrivateBrowsingUI.privateBrowsingEnabled && TU_getPref("extensions.tabutils.autoLock", true)) { PlacesUtils.tagging.tagURI(aTab.linkedBrowser.currentURI, ["locked"]); } @@ -1293,7 +1293,7 @@ tabutils._faviconizeTab = function() { else { aTab.setAttribute("faviconized", true); if (!aRestoring) - tabutils._ss.setTabValue(aTab, "faviconized", true); + tabutils._ss.setTabValue(aTab, "faviconized", String(true)); if (aRestoring == null && !gPrivateBrowsingUI.privateBrowsingEnabled && TU_getPref("extensions.tabutils.autoFaviconize", true)) { PlacesUtils.tagging.tagURI(aTab.linkedBrowser.currentURI, ["faviconized"]); } @@ -1463,8 +1463,8 @@ tabutils._reloadEvery = function() { aTab._reloadInterval = aInterval || aTab._reloadInterval || TU_getPref("extensions.tabutils.reloadInterval", 10); TU_setPref("extensions.tabutils.reloadInterval", aTab._reloadInterval); if (!aRestoring) { - tabutils._ss.setTabValue(aTab, "autoReload", true); - tabutils._ss.setTabValue(aTab, "reloadInterval", aTab._reloadInterval); + tabutils._ss.setTabValue(aTab, "autoReload", String(true)); + tabutils._ss.setTabValue(aTab, "reloadInterval", String(aTab._reloadInterval)); } if (aRestoring == null && !gPrivateBrowsingUI.privateBrowsingEnabled && TU_getPref("extensions.tabutils.autoEnableAutoReload", true)) { From d9f8e29c14173f11bf17c13bc127ce465a7644f9 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 4 Sep 2014 01:37:13 +0800 Subject: [PATCH 002/116] Fix urlbar enter hook for Fx33+. Since the http://hg.mozilla.org/mozilla-central/diff/4ce737d7339d/browser/base/content/urlbarBindings.xml. Untested for other versions. --- chrome/content/tabutils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 9daf3ab..ea93fb6 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -310,7 +310,7 @@ tabutils._openUILinkInTab = function() { //地址栏回车键 TU_hookCode("gURLBar.handleCommand", [/((aTriggeringEvent)\s*&&\s*(aTriggeringEvent.altKey))(?![\s\S]*\1)/, "let (newTabPref = TU_getPref('extensions.tabutils.openUrlInTab', true)) ($1 || newTabPref) && !(($2 ? $3 : false) && newTabPref && TU_getPref('extensions.tabutils.invertAlt', true))"], - [/(?=.*openUILinkIn.*)/, function() { + [/(?=.*openUILinkIn\(url\, where\, params.*)/, function() { params.inBackground = TU_getPref('extensions.tabutils.loadUrlInBackground', false); params.disallowInheritPrincipal = !mayInheritPrincipal; params.event = aTriggeringEvent || {}; From cb70a86200bf98f77e80a3c8b856e92739f2e9f3 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 7 Sep 2014 20:04:53 +0800 Subject: [PATCH 003/116] Fix the 'scrollbutton' in Tabbar is always not visible in Firefox 32+. I has tested the in Fx31 and Fx32, that is ok. This bug is due to: https://bugzilla.mozilla.org/show_bug.cgi?id=878020 References: https://hg.mozilla.org/releases/mozilla-release/diff/bbfe5c6ea7c9/toolkit/content/widgets/scrollbox.xml http://hg.mozilla.org/mozilla-central/raw-file/2255d7d187b2/toolkit/content/widgets/scrollbox.xml --- chrome/content/tabutils.xml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/chrome/content/tabutils.xml b/chrome/content/tabutils.xml index 09b61a4..61b653e 100644 --- a/chrome/content/tabutils.xml +++ b/chrome/content/tabutils.xml @@ -44,8 +44,8 @@ - + - + Date: Sat, 6 Dec 2014 00:47:21 +0800 Subject: [PATCH 004/116] Fix 'let' changes in Fx35 The caused by https://bugzilla.mozilla.org/show_bug.cgi?id=1001090. Failed to hook gBrowser.onTabSelect: redeclaration of variable lastTab tulib.js:22 Failed to hook gBrowser.moveTabTo: redeclaration of variable wasFocused tulib.js:22 Failed to hook gBrowser.onTabSelect: redeclaration of variable lastTab tulib.js:22 --- chrome/content/tabutils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 679af62..b341170 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -845,7 +845,7 @@ tabutils._tabClosingOptions = function() { TU_hookCode("gBrowser.onTabSelect", "}", function() { var tabHistory = this.mTabContainer._tabHistory; - var lastTab = tabHistory[0]; + lastTab = tabHistory[0]; lastTab._lastAccessed = Date.now(); tabutils._ss.setTabValue(lastTab, "lastAccessed", lastTab._lastAccessed); @@ -1422,7 +1422,7 @@ tabutils._restartTab = function() { aTab._restartTimer = null; } - let lastTab = this.getLastSelectedTab(); + lastTab = this.getLastSelectedTab(); if (lastTab) this.autoRestartTab(lastTab); }); @@ -1901,7 +1901,7 @@ tabutils._multiTabHandler = function() { }); TU_hookCode("gBrowser.moveTabTo", // Bug 822068 [Fx20] - ["this.mCurrentTab._selected = false;", "let wasFocused = (document.activeElement == this.mCurrentTab);$&"], + ["this.mCurrentTab._selected = false;", "wasFocused = (document.activeElement == this.mCurrentTab);$&"], ["this.mCurrentTab._selected = true;", "$&;if (wasFocused) this.mCurrentTab.focus();"] ); From 0112dee0b1ce56161d21e574ff6c4bcb1d6769a1 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Tue, 20 Jan 2015 05:55:37 +0800 Subject: [PATCH 005/116] Fix undoSubmenu be null on Fx35+ --- chrome/content/tabutils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 679af62..7a34ed8 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -2812,6 +2812,7 @@ tabutils._undoCloseTabButton = function() { tabutils._undoCloseMiddleClick = HistoryMenu.prototype._undoCloseMiddleClick; tabutils.populateUndoSubmenu = HistoryMenu.prototype.populateUndoSubmenu; + tabutils._getClosedTabCount = HistoryMenu.prototype._getClosedTabCount; // Bug 1064217 [Fx35] TU_hookCode("tabutils.populateUndoSubmenu", [/var undoPopup.*/, "var undoPopup = arguments[0];"], [/.*undoMenu.*/g, ""], From 0c76404601dc82a9170312ce7bee175979f144d7 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 25 Jan 2015 03:35:20 +0800 Subject: [PATCH 006/116] Fix lastTab error in gBrowser.onTabSelect ReferenceError: can't access lexical declaration `lastTab' before initialization --- chrome/content/tabutils-st.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils-st.js b/chrome/content/tabutils-st.js index 8c66600..1817f64 100644 --- a/chrome/content/tabutils-st.js +++ b/chrome/content/tabutils-st.js @@ -471,7 +471,7 @@ tabutils._stackTabs = function() { } } - let lastTab = this.getLastSelectedTab(); + lastTab = this.getLastSelectedTab(); if (lastTab && lastTab.hasAttribute("group") && lastTab.getAttribute("group") != aTab.getAttribute("group") && TU_getPref("extensions.tabutils.autoCollapseStackOnBlur", false)) From 355bb1ec2c170f7b473281ca4987301db6e481c9 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 25 Jan 2015 08:01:46 +0800 Subject: [PATCH 007/116] Try replace arguments.callee.name using tabmixplus/modules Note: some arguments.callee is not replaced yet. Not fully tested, not guarantee compatibility with older Firefox versions. License: Tab Utilities 1.5.28.1 (MPL 1.1), Tab Mix Plus (MPL 2.0). --- chrome.manifest | 1 + chrome/content/tabutils-mt.js | 2 +- chrome/content/tabutils.js | 14 +- chrome/content/tulib.js | 6 + chrome/content/utilityOverlay.js | 2 +- modules/Services.jsm | 335 +++++++++++++++++++++++++++++++ modules/log.jsm | 284 ++++++++++++++++++++++++++ 7 files changed, 635 insertions(+), 9 deletions(-) create mode 100644 modules/Services.jsm create mode 100644 modules/log.jsm diff --git a/chrome.manifest b/chrome.manifest index a5afe7d..c42efd4 100644 --- a/chrome.manifest +++ b/chrome.manifest @@ -1,5 +1,6 @@ content tabutils chrome/content/ skin tabutils classic/1.0 chrome/skin/ +resource tabmixplus modules/ overlay chrome://browser/content/browser.xul chrome://tabutils/content/tabutils.xul overlay chrome://browser/content/places/placesOverlay.xul chrome://tabutils/content/placesOverlay.xul diff --git a/chrome/content/tabutils-mt.js b/chrome/content/tabutils-mt.js index a13988d..3906266 100644 --- a/chrome/content/tabutils-mt.js +++ b/chrome/content/tabutils-mt.js @@ -95,7 +95,7 @@ tabutils._multirowTabs = function() { }, true); TU_hookCode("gBrowser.moveTabTo", "{", function() { - if (["onxbldrop", "ondrop"].indexOf(arguments.callee.caller.name) > -1) { + if (TMP_console.isCallerInList(["onxbldrop", "ondrop"])) { if (aTab.pinned) { if (aIndex >= this._numPinnedTabs) this.pinTab(aTab, false); diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 0ee790a..233bb21 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -514,7 +514,7 @@ tabutils._singleWindowMode = function() { }); TU_hookCode("gBrowser.replaceTabWithWindow", "{", function() { - if (["_onDragEnd", "onxbldragend"].indexOf(arguments.callee.caller.name) > -1 && TU_getPref("extensions.tabutils.singleWindowMode", false)) + if (TMP_console.isCallerInList(["_onDragEnd", "onxbldragend"]) && TU_getPref("extensions.tabutils.singleWindowMode", false)) return null; }); @@ -699,7 +699,7 @@ tabutils._tabOpeningOptions = function() { [/return/g, "var tab ="], ["}", function() { this.detachTab(tab, true); - if (["_onDrop", "onxbldrop", "duplicateTabIn"].indexOf(arguments.callee.caller.name) == -1) { + if (TMP_console.isCallerInList(["_onDrop", "onxbldrop", "duplicateTabIn"])) { if (TU_getPref("extensions.tabutils.openDuplicateNext", true)) { if (this.isStackedTab(aTab)) aTab = this.lastSiblingTabOf(aTab); @@ -713,8 +713,8 @@ tabutils._tabOpeningOptions = function() { ); //撤销关闭标签页 - TU_hookCode("gBrowser.moveTabTo", "{", function() { - if (arguments.callee.caller.name == "ssi_undoCloseTab" + TU_hookCode("gBrowser.moveTabTo", "}", function() { + if (TMP_console.callerName() == "ssi_undoCloseTab" && !TU_getPref("extensions.tabutils.restoreOriginalPosition", true)) return; }); @@ -1980,7 +1980,7 @@ tabutils._multiTabHandler = function() { TU_hookCode("gBrowser.swapBrowsersAndCloseOther", /(?=.*_beginRemoveTab.*)/, function() { if ([gBrowserInit.onLoad, gBrowserInit._delayedStartup].indexOf(arguments.callee.caller) > -1 || // Bug 756313 [Fx19] - ["onxbldrop", "_handleTabDrop"].indexOf(arguments.callee.caller.name) > -1) { + TMP_console.isCallerInList(["onxbldrop", "_handleTabDrop"])) { let selectedTabs = aOtherTab._selectedTabs || remoteBrowser.contextTabsOf(aOtherTab); if (selectedTabs.length > 1) { this.swapBrowsersAndCloseOther(aOurTab, selectedTabs.shift()); @@ -2057,7 +2057,7 @@ tabutils._tabClickingOptions = function() { TU_hookCode("TabContextMenu.updateContextMenu", "aPopupMenu.triggerNode", "document.popupNode", "g"); TU_hookCode("gBrowser.mTabContainer._selectNewTab", "{", function() { - if (["onxblmousedown"].indexOf(arguments.callee.caller.name) > -1 && + if (TMP_console.isCallerInList(["onxblmousedown"]) && !aNewTab.selected) aNewTab.setAttribute("firstclick", true); }); @@ -2285,7 +2285,7 @@ tabutils._tabClickingOptions = function() { //Mouse release to select TU_hookCode("gBrowser.mTabContainer._selectNewTab", "{", function() { - if (["onxblmousedown"].indexOf(arguments.callee.caller.name) > -1 && + if (TMP_console.isCallerInList(["onxblmousedown"]) && TU_getPref("extensions.tabutils.mouseReleaseSelect", true)) return; }); diff --git a/chrome/content/tulib.js b/chrome/content/tulib.js index bf5d3ee..7f2700e 100644 --- a/chrome/content/tulib.js +++ b/chrome/content/tulib.js @@ -1,3 +1,9 @@ +let {classes: Cc, interfaces: Ci, utils: Cu} = Components; + +XPCOMUtils.defineLazyModuleGetter(this, "TabmixSvc", + "resource://tabmixplus/Services.jsm"); +let TMP_console = TabmixSvc.console; + function TU_hookCode(aStr) { try { var namespaces = aStr.split("."); diff --git a/chrome/content/utilityOverlay.js b/chrome/content/utilityOverlay.js index 1835e90..46a4c6d 100644 --- a/chrome/content/utilityOverlay.js +++ b/chrome/content/utilityOverlay.js @@ -4,7 +4,7 @@ TU_hookCode("whereToOpenLink", "{", function() { var target; - switch (arguments.callee.caller.name) { + switch (TMP_console.callerName()) { case "PUIU_openNodeWithEvent": //Fx 4.0 case "PUIU__openTabset": target = "bookmarks";break; diff --git a/modules/Services.jsm b/modules/Services.jsm new file mode 100644 index 0000000..e2dfafa --- /dev/null +++ b/modules/Services.jsm @@ -0,0 +1,335 @@ +"use strict"; +// License: The file copied from Tab Mix Plus 0.4.1.6pre.141229a1 (MPL 2.0) + +var EXPORTED_SYMBOLS = ["TabmixSvc"]; + +const {classes: Cc, interfaces: Ci, utils: Cu} = Components; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); + +let _versions = {}; +function isVersion(aVersionNo) { + if (TabmixSvc.isPaleMoonID) { + let paleMoonVer = arguments.length > 1 ? arguments[1] : -1; + if (aVersionNo > 240 && paleMoonVer == -1) + return false; + aVersionNo = paleMoonVer; + } + + if (typeof _versions[aVersionNo] == "boolean") + return _versions[aVersionNo]; + + let v = Services.appinfo.version; + return _versions[aVersionNo] = Services.vc.compare(v, aVersionNo/10 + ".0a1") >= 0; +} + +let TabmixSvc = { + debugMode: function() { + return this.prefBranch.prefHasUserValue("enableDebug") && + this.prefBranch.getBoolPref("enableDebug"); + }, + + version: function() { + return isVersion.apply(null, arguments); + }, + + getString: function(aStringKey) { + try { + return this._strings.GetStringFromName(aStringKey); + } catch (e) { + dump("*** Failed to get string " + aStringKey + " in bundle: tabmix.properties\n"); + throw e; + } + }, + + getFormattedString: function(aStringKey, aStringsArray) { + try { + return this._strings.formatStringFromName(aStringKey, aStringsArray, aStringsArray.length); + } catch (e) { + dump("*** Failed to format string " + aStringKey + " in bundle: tabmix.properties\n"); + throw e; + } + }, + + getSMString: function(aStringKey) { + try { + return this.SMstrings.GetStringFromName(aStringKey); + } catch (e) { + dump("*** Failed to get string " + aStringKey + " in bundle: session-manager.properties\n"); + throw e; + } + }, + + setLabel: function(property) { + var label, key; + if (property.indexOf("sm.") == 0) { + label = this.getSMString(property + ".label"); + key = this.getSMString(property + ".accesskey"); + } + else { + label = this.getString(property + ".label"); + key = this.getString(property + ".accesskey"); + } + var accessKeyIndex = label.toLowerCase().indexOf(key.toLowerCase()); + if (accessKeyIndex > -1) + label = label.substr(0, accessKeyIndex) + "&" + label.substr(accessKeyIndex); + return label; + }, + + topWin: function() { + return Services.wm.getMostRecentWindow("navigator:browser"); + }, + + get direct2dDisabled() { + delete this.direct2dDisabled; + try { + // this pref exist only in windows + return this.direct2dDisabled = Services.prefs.getBoolPref("gfx.direct2d.disabled"); + } catch(ex) {} + return this.direct2dDisabled = false; + }, + + /** + * call a callback for all currently opened browser windows + * (might miss the most recent one) + * @param aFunc + * Callback each window is passed to + */ + forEachBrowserWindow: function(aFunc) { + let windowsEnum = Services.wm.getEnumerator("navigator:browser"); + while (windowsEnum.hasMoreElements()) { + let window = windowsEnum.getNext(); + if (!window.closed) { + aFunc.call(null, window); + } + } + }, + + // some extensions override native JSON so we use nsIJSON + JSON: { + nsIJSON: null, + parse: function TMP_parse(str) { + try { + return JSON.parse(str); + } catch(ex) { + try { + return "decode" in this.nsIJSON ? this.nsIJSON.decode(str) : null; + } catch(ex) {return null} + } + }, + stringify: function TMP_stringify(obj) { + try { + return JSON.stringify(obj); + } catch(ex) { + try { + return "encode" in this.nsIJSON ? this.nsIJSON.encode(obj) : null; + } catch(ex) {return null} + } + } + }, + + syncHandlers: new WeakMap(), + + windowStartup: { + QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, + Ci.nsISupportsWeakReference]), + _initialized: false, + init: function(aWindow) { + // windowStartup must only be called once for each window + if ("firstWindowInSession" in aWindow.Tabmix) + return; + aWindow.Tabmix.firstWindowInSession = !this._initialized; + if (this._initialized) + return; + this._initialized = true; + + try { + // replace old Settings. + // we must call this before any other tabmix function + aWindow.gTMPprefObserver.updateSettings(); + } catch (ex) {TabmixSvc.console.assert(ex);} + + Services.obs.addObserver(this, "browser-delayed-startup-finished", true); + Services.obs.addObserver(this, "quit-application", true); + + if (isVersion(190)) + Cu.import("resource://tabmixplus/DownloadLastDir.jsm"); + + Cu.import("resource://tabmixplus/Places.jsm"); + TabmixPlacesUtils.init(aWindow); + + TabmixSvc.tabStylePrefs = {}; + let tmp = {}; + Cu.import("resource://tabmixplus/DynamicRules.jsm", tmp); + tmp.DynamicRules.init(aWindow); + }, + + observe: function(aSubject, aTopic, aData) { + switch (aTopic) { + case "quit-application": + TabmixPlacesUtils.onQuitApplication(); + for (let id of Object.keys(TabmixSvc.console._timers)) { + let timer = TabmixSvc.console._timers[id]; + timer.cancel(); + } + break; + case "browser-delayed-startup-finished": + try { + aSubject.Tabmix.initialization.run("delayedStartup"); + } catch (ex) {TabmixSvc.console.assert(ex);} + break; + } + } + }, + + saveTabAttributes: function(tab, attrib) { + TabStateCache.saveTabAttributes(tab, attrib); + }, + + get ss() { + delete this.ss; + if (isVersion(250, 250)) { + let tmp = {} + Cu.import("resource:///modules/sessionstore/SessionStore.jsm", tmp); + return this.ss = tmp.SessionStore; + } + return this.ss = Cc["@mozilla.org/browser/sessionstore;1"]. + getService(Ci.nsISessionStore); + }, + + sm: { + lastSessionPath: null, + persistTabAttributeSet: false, + status: "", + crashed: false, + get sanitized() { + delete this.sanitized; + return this.sanitized = TabmixSvc.prefBranch.prefHasUserValue("sessions.sanitized"); + }, + set sanitized(val) { + delete this.sanitized; + return this.sanitized = val; + }, + private: true, + settingPreference: false, + }, + + blockedClickingOptions: [] +} + +XPCOMUtils.defineLazyGetter(TabmixSvc.JSON, "nsIJSON", function() { + return Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON); +}); + +// check if australis tab shape is implemented +XPCOMUtils.defineLazyGetter(TabmixSvc, "australis", function() { + return this.topWin().document.getElementById("tab-curve-clip-path-start") ? + true : false; +}); + +XPCOMUtils.defineLazyGetter(TabmixSvc, "prefs", function() { + let svc = isVersion(230) ? "resource://gre/modules/Preferences.jsm" : + "resource://services-common/preferences.js"; + let tmp = {} + Cu.import(svc, tmp); + return new tmp.Preferences(""); +}); + +// Tabmix preference branch +XPCOMUtils.defineLazyGetter(TabmixSvc, "prefBranch", function () {return Services.prefs.getBranch("extensions.tabmix.")}); +// string bundle +XPCOMUtils.defineLazyGetter(TabmixSvc, "_strings", function () { + let properties = "chrome://tabmixplus/locale/tabmix.properties"; + return Services.strings.createBundle(properties); +}); +XPCOMUtils.defineLazyGetter(TabmixSvc, "SMstrings", function () { + let properties = "chrome://tabmixplus/locale/session-manager.properties"; + return Services.strings.createBundle(properties); +}); + +XPCOMUtils.defineLazyGetter(TabmixSvc, "isMac", function () { + return Services.appinfo.OS == "Darwin"; +}); + +XPCOMUtils.defineLazyGetter(TabmixSvc, "isLinux", function () { + return Services.appinfo.OS == "Linux"; +}); + +XPCOMUtils.defineLazyGetter(TabmixSvc, "isPaleMoon", function () { + return Services.appinfo.name == "Pale Moon"; +}); + +XPCOMUtils.defineLazyGetter(TabmixSvc, "isPaleMoonID", function () { + return Services.appinfo.ID == "{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}"; +}); + +/** + * bug 1051017 - Firefox 34 - change + * browser.contentWindow -> browser.contentWindowAsCPOW + * browser.contentDocument -> browser.contentDocumentAsCPOW + * window.content -> window.gBrowser.selectedBrowser.contentWindowAsCPOW + **/ +XPCOMUtils.defineLazyGetter(TabmixSvc, "contentWindowAsCPOW", function () { + return isVersion(340) ? "contentWindowAsCPOW" : "contentWindow"; +}); + +XPCOMUtils.defineLazyGetter(TabmixSvc, "contentDocumentAsCPOW", function () { + return isVersion(340) ? "contentDocumentAsCPOW" : "contentDocument"; +}); + +XPCOMUtils.defineLazyModuleGetter(TabmixSvc, "FileUtils", + "resource://gre/modules/FileUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(TabmixSvc, "console", + "resource://tabmixplus/log.jsm"); + +let TabStateCache = { + get _update() { + delete this._update; + return this._update = isVersion(260) ? "updateField" : "update"; + }, + + get TabStateCache() { + delete this.TabStateCache; + if (isVersion(270)) + Cu.import("resource:///modules/sessionstore/TabStateCache.jsm", this); + else + this.TabStateCache = Cu.getGlobalForObject(TabmixSvc.ss).TabStateCache; + return this.TabStateCache; + }, + + saveTabAttributes: function(tab, attrib) { + if (!isVersion(250)) + return; + + let attribs = attrib.split(","); + function update(attributes) { + attribs.forEach(function(key) { + if (tab.hasAttribute(key)) + attributes[key] = tab.getAttribute(key); + else if (key in attributes) + delete attributes[key]; + }) + } + + let browser = tab.linkedBrowser; + if (browser.__SS_data) { + if (!browser.__SS_data.attributes) + browser.__SS_data.attributes = {}; + update(browser.__SS_data.attributes); + } + + // Bug 905049 fixed by Bug 960903 - Broadcast session history + if (isVersion(290)) + return; + + let tabHasCache = isVersion(270) ? this.TabStateCache.has(browser) : + this.TabStateCache._data.has(browser); + if (tabHasCache) { + let attributes = this.TabStateCache.get(browser).attributes || {}; + update(attributes); + this.TabStateCache[this._update](browser, "attributes", attributes); + } + } +} diff --git a/modules/log.jsm b/modules/log.jsm new file mode 100644 index 0000000..08a1520 --- /dev/null +++ b/modules/log.jsm @@ -0,0 +1,284 @@ +"use strict"; +// License: The file copied from Tab Mix Plus 0.4.1.6pre.141229a1 (MPL 2.0) + +var EXPORTED_SYMBOLS = ["console"]; + +const {classes: Cc, interfaces: Ci, utils: Cu} = Components; + +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://tabmixplus/Services.jsm"); + +let gNextID = 1; + +let console = { + getObject: function(aWindow, aMethod) { + let msg = ""; + if (!aWindow) + msg += "aWindow is undefined"; + if (typeof aMethod != "string") + msg += (msg ? "\n" : "") + "aMethod need to be a string"; + if (msg) { + this.assert(msg); + return {toString: function() msg}; + } + var rootID, methodsList = aMethod.split("."); + if (methodsList[0] == "window") + methodsList.shift(); + else if (methodsList[0] == "document") { + methodsList.shift(); + rootID = methodsList.shift().replace(/getElementById\(|\)|'|"/g , ""); + } + try { + var obj = aWindow; + if (rootID) + obj = obj.document.getElementById(rootID); + methodsList.forEach(function(aFn) { + obj = obj[aFn]; + }); + } catch (ex) { } + return obj || {toString: function() "undefined"}; + }, + + _timers: {}, + show: function(aMethod, aDelay, aWindow) { + try { + if (typeof(aDelay) == "undefined") + aDelay = 500; + + let logMethod = function _logMethod() { + let result = "", isObj = typeof aMethod == "object"; + if (typeof aMethod != "function") { + result = isObj ? aMethod.obj[aMethod.name] : + this.getObject(aWindow, aMethod); + result = " = " + result.toString() + } + this.clog((isObj ? aMethod.fullName : aMethod) + result); + }.bind(this); + + if (aDelay >= 0) { + let timerID = gNextID++; + let timer = Object.create(Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer)); + timer.clear = function() { + if (timerID in this._timers) + delete this._timers[timerID]; + timer.cancel(); + }.bind(this); + if (aWindow) { + aWindow.addEventListener("unload", function unload() { + timer.clear(); + }, false); + } + timer.initWithCallback({ + notify: function notify() { + timer.clear(); + logMethod(); + } + }, aDelay, Ci.nsITimer.TYPE_ONE_SHOT); + + this._timers[timerID] = timer; + } + else + logMethod(); + + } catch (ex) {this.assert(ex, "Error we can't show " + aMethod + " in Tabmix.show");} + }, + + clog: function(aMessage) { + Services.console.logStringMessage("TabMix :\n" + aMessage); + }, + + log: function TMP_console_log(aMessage, aShowCaller, offset) { + offset = !offset ? 0 : 1; + let names = this._getNames(aShowCaller ? 2 + offset : 1 + offset); + let callerName = names[offset+0]; + let callerCallerName = aShowCaller && names[offset+1] ? " (caller was " + names[offset+1] + ")" : ""; + Services.console.logStringMessage("TabMix " + callerName + callerCallerName + " :\n" + aMessage); + }, + + // get functions names from Error().stack + // excluding any internal caller (name start with TMP_console_) + _getNames: function(aCount, stack) { + stack = this._getStackExcludingInternal(stack); + if (!aCount) + aCount = 1; + else if (aCount < 0) + aCount = stack.length; + let names = []; + for (let i = 0, l = Math.min(aCount, stack.length); i < l; i++) + names.push(this._name(stack[i])); + + return names; + }, + + // get the name of the function that is in the nth place in Error().stack + // excluding any internal caller in the count + getCallerNameByIndex: function(aIndex) { + let fn = this._getStackExcludingInternal()[aIndex]; + if (fn) + return this._name(fn); + return null; + }, + + _getStackExcludingInternal: function(stack) { + if (!stack) + stack = Error().stack.split("\n").slice(2); + else + stack = stack.split("\n"); + // cut internal callers + let re = /TMP_console_.*/; + while (stack.length && stack[0].match(re)) + stack.splice(0, 1); + return stack; + }, + + _char: "@", + _name: function(fn) { + let name = fn.substr(0, fn.indexOf(this._char)) + if (fn && !name) { + // get file name and line number + let lastIndexOf = fn.lastIndexOf("/"); + name = lastIndexOf > -1 ? fn.substr(lastIndexOf+1) : "?"; + } + return name; + }, + +/* + _nameFromComponentsStack: function(Cs) { + return Cs.name || + Cs.filename.substr(Cs.filename.lastIndexOf("/") + 1) + ":" + Cs.lineNumber; + }, + + callerName: function() { + try { + var name = this._nameFromComponentsStack(Components.stack.caller.caller); + } catch (ex) { } + return name || ""; + }, +*/ + + callerName: function TMP_console_callerName() { + return this.getCallerNameByIndex(1); + }, + + // return true if the caller name of the calling function is in the + // arguments list + isCallerInList: function TMP_console_isCallerInList() { + if (!arguments.length) { + this.assert("no arguments in Tabmix.isCallerInList"); + return false; + } + + try { + let callerName = this.getCallerNameByIndex(1); + if (!callerName) + return false; + if (typeof arguments[0] == "object") + return arguments[0].indexOf(callerName) > -1; + + let args = Array.prototype.slice.call(arguments); + return args.indexOf(callerName) > -1; + + } catch (ex) { + this.assert(ex, "Error we can't check for caller name"); + } + return false; + }, + +/* +options = { + msg: msg + log: true / false; default true + function: true / false default false + deep: true / false default false + offset; for internal use only true / false default false +} +*/ + obj: function TMP_console_obj(aObj, aMessage, aDisallowLog, level) { + var offset = typeof level == "string" ? " " : ""; + aMessage = aMessage ? offset + aMessage + "\n" : ""; + var objS = aObj ? offset + aObj.toString() : offset + "aObj is " + typeof(aObj); + objS += ":\n" + + for (let prop in aObj) { + try { + let val = aObj[prop]; + let type = typeof val; + if (type == "string") + val = "\'" + val + "\'"; + if (type == "function" && typeof level == "string") { + val = val.toString(); + let code = val.toString().indexOf("native code") > -1 ? + "[native code]" : "[code]" + val = val.substr(0, val.indexOf("(")) + "() { " + code + " }"; + } + objS += offset + prop + "[" + type + "]" + " = " + val + "\n"; + if (type == "object" && val != null && level && typeof level == "boolean") + objS += this.obj(val, "", true, "deep") + "\n"; + } catch (ex) { + objS += offset + prop + " = " + "[!!error retrieving property]" + "\n"; + } + } + if (aDisallowLog) + objS = aMessage + "======================\n" + objS; + else + this.log(aMessage + "=============== Object Properties ===============\n" + objS, true); + return objS; + }, + + // RegExp to remove path/to/profile/extensions from filename + get _pathRegExp() { + delete this._pathRegExp; + let folder = TabmixSvc.FileUtils.getDir("ProfD", ["extensions"]); + let path = folder.path.replace("\\", "/", "g") + "/"; + return this._pathRegExp = new RegExp("jar:|file:///|" + path, "g"); + }, + + _formatStack: function(stack) { + let lines = [], _char = this._char, re = this._pathRegExp; + stack.forEach(function(line) { + let atIndex = line.indexOf("@"); + let columnIndex = line.lastIndexOf(":"); + let fileName = line.slice(atIndex + 1, columnIndex).split(" -> ").pop(); + if (fileName) { + let lineNumber = parseInt(line.slice(columnIndex + 1)); + let colNumber; + if (fileName.replace("://", "///").indexOf(":") > -1) { + colNumber = lineNumber; + columnIndex = fileName.lastIndexOf(":"); + lineNumber = parseInt(fileName.slice(columnIndex + 1)); + fileName = fileName.slice(0, columnIndex); + } + fileName = decodeURI(fileName).replace(re, ""); + let atIndex = line.indexOf(_char); + let name = line.slice(0, atIndex).split("(").shift(); + let formated = ' File "' + fileName + '", line ' + lineNumber; + if (colNumber) + formated += ', col ' + colNumber; + if (name) + formated += ', in ' + name.replace("/<", ""); + lines.push(formated); + } + }); + + return lines.join("\n"); + }, + + assert: function TMP_console_assert(aError, aMsg) { + if (!aError || typeof aError.stack != "string") { + this.trace((aMsg || "") + "\n" + (aError || ""), 2); + return; + } + + let names = this._getNames(1, aError.stack); + let errAt = " at " + names[0]; + let location = aError.location ? "\n" + aError.location : ""; + let assertionText = "Tabmix Plus ERROR" + errAt + ":\n" + (aMsg ? aMsg + "\n" : "") + aError.message + location; + let stackText = "\nStack Trace: \n" + this._formatStack(aError.stack.split("\n")); + Services.console.logStringMessage(assertionText + stackText); + }, + + trace: function TMP_console_trace(aMsg) { + let stack = this._formatStack(this._getStackExcludingInternal()); + Services.console.logStringMessage("Tabmix Trace: " + (aMsg || "") + '\n' + stack); + } +} From 9bc2434dcbd3a41f795da75e9c465a47abb8981e Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 26 Jan 2015 21:28:14 +0800 Subject: [PATCH 008/116] Fix onTabOpen not works with "Distill Web Monitor (formerly AlertBox)" links This a workaround, only work on 'All' option, not work for 'None but Links' option. --- chrome/content/tabutils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 233bb21..e201d1a 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -654,7 +654,7 @@ tabutils._tabOpeningOptions = function() { TU_hookCode("gBrowser.onTabOpen", "}", function() { if ((function() { switch (TU_getPref("extensions.tabutils.openTabNext", 1)) { - case 1: //All + case 1: return true; //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 From b87272109e21db4742a147ea2905bd68574763c5 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Tue, 27 Jan 2015 16:53:42 +0800 Subject: [PATCH 009/116] Revert "Fix onTabOpen not works with "Distill Web Monitor (formerly AlertBox)" links" This reverts commit 9bc2434dcbd3a41f795da75e9c465a47abb8981e. --- chrome/content/tabutils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index e201d1a..233bb21 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -654,7 +654,7 @@ tabutils._tabOpeningOptions = function() { TU_hookCode("gBrowser.onTabOpen", "}", function() { if ((function() { switch (TU_getPref("extensions.tabutils.openTabNext", 1)) { - case 1: return true; //All + 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 From fe7c9160fcb0092f2d4a9a8229761e640c366da1 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Wed, 28 Jan 2015 00:53:04 +0800 Subject: [PATCH 010/116] refine undoclosetab-button icon Restore to the original effect of once at Fx4. --- chrome/skin/tabutils.css | 4 +--- chrome/skin/toolbar_Fx4.png | Bin 0 -> 524 bytes 2 files changed, 1 insertion(+), 3 deletions(-) create mode 100644 chrome/skin/toolbar_Fx4.png diff --git a/chrome/skin/tabutils.css b/chrome/skin/tabutils.css index cb801f8..1c092da 100644 --- a/chrome/skin/tabutils.css +++ b/chrome/skin/tabutils.css @@ -200,12 +200,10 @@ menuseparator:last-child { } #undoclosetab-button { - list-style-image: url("chrome://tabutils/skin/toolbar.png"); - -moz-image-region: rect(0px, 16px, 16px, 0px); + list-style-image: url("chrome://tabutils/skin/toolbar_Fx4.png"); } #undoclosetab-button[disabled="true"] { - -moz-image-region: rect(16px, 16px, 32px, 0px); } #button_tuOptions .toolbarbutton-icon { diff --git a/chrome/skin/toolbar_Fx4.png b/chrome/skin/toolbar_Fx4.png new file mode 100644 index 0000000000000000000000000000000000000000..c3d109f3ed4bb56f056e4bbd35a6664b975cb81f GIT binary patch literal 524 zcmV+n0`vWeP)Ln17A==)EG4ybz?B78&-aVzgKsSRE)ULo7~;GzkAMeES7)z6iX%kjCSYz($A`{aET)sgZy(+t{PSTldW2{X;K0Qf) zp1*bj@1Q}4 zQ{EahRj7&#KStKqzgj(N2)~{no1bnBEj?Nmnaqli=YJ|%{qzNW#6%Ta{T}$^ zm8XrN`%BA=Po5!>8b=8oXLKw_d1irhZVHcBfEG`oMw6VYT- Date: Thu, 12 Feb 2015 23:35:04 +0800 Subject: [PATCH 011/116] Fix the PhantomTabs break on Fx31+ Due to https://hg.mozilla.org/releases/mozilla-release/rev/f7320bbfb006 --- chrome/content/tabutils.js | 1 + chrome/content/tabutils.xul | 1 + chrome/skin/tabutils_fx31.css | 9 +++++++++ 3 files changed, 11 insertions(+) create mode 100644 chrome/skin/tabutils_fx31.css diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 233bb21..e0aa8c1 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -52,6 +52,7 @@ var tabutils = { document.documentElement.setAttribute("v14", true); document.documentElement.setAttribute("v17", true); document.documentElement.setAttribute("v29", version >= 29.0); + document.documentElement.setAttribute("v31", version >= 31.0); // Function.prototype.__defineGetter__("stack", function() { // var stack = []; diff --git a/chrome/content/tabutils.xul b/chrome/content/tabutils.xul index 929b8d1..fa443af 100644 --- a/chrome/content/tabutils.xul +++ b/chrome/content/tabutils.xul @@ -4,6 +4,7 @@ + diff --git a/chrome/skin/tabutils_fx31.css b/chrome/skin/tabutils_fx31.css new file mode 100644 index 0000000..16f8657 --- /dev/null +++ b/chrome/skin/tabutils_fx31.css @@ -0,0 +1,9 @@ +/* Phantom Tabs */ +window[v31="true"] .tabbrowser-tab[pinned] .tab-background:not([fadein]), +window[v31="true"] .tabbrowser-tab[pinned] .tab-close-button:not([fadein]), +window[v31="true"] .tabbrowser-tab[pinned] .tab-label:not([fadein]) { + visibility: visible; +} +window[v31="true"] .tabbrowser-tab[pinned] .tab-icon-image:not([fadein]) { + display: -moz-box; +} From 889f841e8509aeea3675981e8ca79190481c09b0 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sat, 14 Feb 2015 19:36:17 +0800 Subject: [PATCH 012/116] mark some 'Fail on Fx31+' code Due to https://hg.mozilla.org/mozilla-central/rev/1f5f1fe135b9 --- chrome/content/tabutils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index e0aa8c1..bf580e6 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -2861,10 +2861,10 @@ tabutils._tabPrefObserver = { }); }], ["this.mCloseButtons", "($& & 0x0f)"], - ["this.mCloseButtons != 3", "(this.mCloseButtons & 0x0f) != 3 && !(this.mCloseButtons & 0x20)"], - ["this._closeWindowWithLastTab", "false", "g"], + ["this.mCloseButtons != 3", "(this.mCloseButtons & 0x0f) != 3 && !(this.mCloseButtons & 0x20)"], // Fail on Fx31+ + ["this._closeWindowWithLastTab", "false", "g"], // Fail on Fx31+ ["}", function() { - this.setAttribute("closeButtonOnPointedTab", (this.mCloseButtons & 0x0f) == 1 || !!(this.mCloseButtons & 0x10)); + this.setAttribute("closeButtonOnPointedTab", (this.mCloseButtons & 0x0f) == 1 || !!(this.mCloseButtons & 0x10)); // Fail on Fx31+ }] ); From d3be5df0b4ab40b49798d5a22eff7045958a3f85 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sat, 14 Feb 2015 19:54:08 +0800 Subject: [PATCH 013/116] Fix the Tab Counter may stop on Fx31+ Due to https://hg.mozilla.org/mozilla-central/diff/1f5f1fe135b9/browser/base/content/tabbrowser.xml#l1.100d --- chrome/content/tabutils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index bf580e6..5d58b1b 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -2869,7 +2869,7 @@ tabutils._tabPrefObserver = { ); //Tab counter - TU_hookCode("gBrowser.mTabContainer.adjustTabstrip", "}", function() { + TU_hookCode("gBrowser.mTabContainer.adjustTabstrip", "{", function() { if (this.mAllTabsPopup) { let n = gBrowser.mTabs.length - gBrowser._removingTabs.length; let m = gBrowser.allTabs.length; From 478253160816c992bfb3217b435028a129ffb7fb Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 16 Feb 2015 07:03:24 +0800 Subject: [PATCH 014/116] Fix the urlbar stop works with NoScript enabled --- chrome/content/tabutils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 5d58b1b..846dde4 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -320,7 +320,7 @@ tabutils._openUILinkInTab = function() { ["aTriggeringEvent.preventDefault();", ""], ["aTriggeringEvent.stopPropagation();", ""] ); - TU_hookCode("openLinkIn", /(?=let uriObj)/, "w.gURLBar.handleRevert();"); + // TU_hookCode("openLinkIn", /(?=let uriObj)/, "w.gURLBar.handleRevert();"); //搜索栏回车键 if (BrowserSearch.searchBar) From 546c18ee3056624d3ea8fe0b865cbefffbc45b0d Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Wed, 18 Feb 2015 03:15:47 +0800 Subject: [PATCH 015/116] Fix the extensions.tabutils.closeLastWindowWithLastTab on Fx31+ https://hg.mozilla.org/releases/mozilla-release/diff/09863b96e772/browser/base/content/tabbrowser.xml --- chrome/content/tabutils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 846dde4..54917f8 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -981,7 +981,9 @@ tabutils._tabClosingOptions = function() { TU_hookCode("gBrowser.updateCurrentBrowser", /.*dispatchEvent[\s\S]*_tabAttrModified.*/, "$&};if (window.windowState != window.STATE_MINIMIZED) {"); //Don't close the last primary window with the las tab - TU_hookCode("gBrowser._beginRemoveTab", "_closeWindowWithLastTab", "$& && " + (function() { //Bug 607893 + TU_hookCode("gBrowser._beginRemoveTab", + /_closeWindowWithLastTab|Services\.prefs\.getBoolPref\("browser\.tabs\.closeWindowWithLastTab"\)/, // Bug 997681 [Fx31] + "$& && " + (function() { //Implement to Bug 607893 (TU_getPref("extensions.tabutils.closeLastWindowWithLastTab", false) || function() { var winEnum = Services.wm.getEnumerator("navigator:browser"); while (winEnum.hasMoreElements()) { From 87a3b9476c804fdd46e3239de48fcc75449ce368 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 19 Feb 2015 08:18:08 +0800 Subject: [PATCH 016/116] Preparations for release to the AMO --- install.rdf | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/install.rdf b/install.rdf index d4dd2ea..f2699b8 100644 --- a/install.rdf +++ b/install.rdf @@ -1,11 +1,12 @@ - tabutils@ithinc.cn + tabutilsfixed@addon.cn 2 - Tab Utilities - 1.5.28.1 - ithinc + Tab Utilities Fixed + 1.5.2015.02.18 + YFdyh000 + ithinc (Former author) Leszek(teo)呕yczkowski Emanuele Alimonda Cye3s (zh-CN) @@ -18,14 +19,14 @@ matsumoto (ja-JP) Klezzon (it) Open Bookmarks/History/URL/Search in new tabs, and more utilities for tabbed browsing. - http://addons.mozilla.org/addon/59961 + chrome://tabutils/skin/tabutils.png chrome://tabutils/content/preferences.xul {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 17.0 - 28.* + 36.* false From 23662321ca0672959720e2a64a5229a9f73c275b Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 19 Feb 2015 09:47:23 +0800 Subject: [PATCH 017/116] Fixes for release --- chrome/content/preferences.xul | 4 ++-- install.rdf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chrome/content/preferences.xul b/chrome/content/preferences.xul index 66476c8..b5c70c5 100644 --- a/chrome/content/preferences.xul +++ b/chrome/content/preferences.xul @@ -21,8 +21,8 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2015.02.18 + 1.5.2015.02.19 YFdyh000 ithinc (Former author) Leszek(teo)呕yczkowski @@ -19,7 +19,7 @@ matsumoto (ja-JP) Klezzon (it) Open Bookmarks/History/URL/Search in new tabs, and more utilities for tabbed browsing. - + https://addons.mozilla.org/firefox/addon/tab-utilities-fixed/ chrome://tabutils/skin/tabutils.png chrome://tabutils/content/preferences.xul From 4cefda97606d0646d059667240ba5a46fbf1cf61 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 19 Feb 2015 09:57:56 +0800 Subject: [PATCH 018/116] Fix the description l10n --- chrome/locale/de/tabutils.properties | 2 +- chrome/locale/en-US/tabutils.properties | 2 +- chrome/locale/es-ES/tabutils.properties | 2 +- chrome/locale/it/tabutils.properties | 2 +- chrome/locale/ja-JP/tabutils.properties | 2 +- chrome/locale/pl/tabutils.properties | 2 +- chrome/locale/pt-BR/tabutils.properties | 2 +- chrome/locale/ru/tabutils.properties | 2 +- chrome/locale/zh-CN/tabutils.properties | 2 +- chrome/locale/zh-TW/tabutils.properties | 2 +- defaults/preferences/prefs.js | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/chrome/locale/de/tabutils.properties b/chrome/locale/de/tabutils.properties index a37e187..52ddd5f 100644 --- a/chrome/locale/de/tabutils.properties +++ b/chrome/locale/de/tabutils.properties @@ -1 +1 @@ -extensions.tabutils@ithinc.cn.description=Lesezeichen/Chronik/Adressen/Suchergebnisse in neuen Tabs 枚ffnen und weitere Funktionen f眉r das Surfen mit Tabs. +extensions.tabutilsfixed@addon.cn.description=Lesezeichen/Chronik/Adressen/Suchergebnisse in neuen Tabs 枚ffnen und weitere Funktionen f眉r das Surfen mit Tabs. diff --git a/chrome/locale/en-US/tabutils.properties b/chrome/locale/en-US/tabutils.properties index a59d88c..d7f0d48 100644 --- a/chrome/locale/en-US/tabutils.properties +++ b/chrome/locale/en-US/tabutils.properties @@ -1 +1 @@ -extensions.tabutils@ithinc.cn.description=Open Bookmarks/History/URL/Search in new tabs, and more utilities for tabbed browsing. +extensions.tabutilsfixed@addon.cn.description=Open Bookmarks/History/URL/Search in new tabs, and more utilities for tabbed browsing. diff --git a/chrome/locale/es-ES/tabutils.properties b/chrome/locale/es-ES/tabutils.properties index 05d0758..42e4afd 100644 --- a/chrome/locale/es-ES/tabutils.properties +++ b/chrome/locale/es-ES/tabutils.properties @@ -1 +1 @@ -extensions.tabutils@ithinc.cn.description=Abra marcadores, historial, direcciones y b煤squedas en nuevas pesta帽as, entre muchas otras utilidades para la navegaci贸n con pesta帽as. +extensions.tabutilsfixed@addon.cn.description=Abra marcadores, historial, direcciones y b煤squedas en nuevas pesta帽as, entre muchas otras utilidades para la navegaci贸n con pesta帽as. diff --git a/chrome/locale/it/tabutils.properties b/chrome/locale/it/tabutils.properties index 02ae656..4ce8a51 100644 --- a/chrome/locale/it/tabutils.properties +++ b/chrome/locale/it/tabutils.properties @@ -1 +1 @@ -extensions.tabutils@ithinc.cn.description=Nuove funzioni per le Schede sull'apertura di Segnalibri, Cronologie e Nuove Pagine. +extensions.tabutilsfixed@addon.cn.description=Nuove funzioni per le Schede sull'apertura di Segnalibri, Cronologie e Nuove Pagine. diff --git a/chrome/locale/ja-JP/tabutils.properties b/chrome/locale/ja-JP/tabutils.properties index fcf9749..af2b284 100644 --- a/chrome/locale/ja-JP/tabutils.properties +++ b/chrome/locale/ja-JP/tabutils.properties @@ -1 +1 @@ -extensions.tabutils@ithinc.cn.description=銉栥儍銈優銉笺偗/灞ユ/URL/妞滅储銈掓柊銇椼亜銈裤儢銇ч枊銇嶃併偪銉栥儢銉┿偊銈搞兂銈般伀鏈夌敤銇鑳姐倰杩藉姞銇椼伨銇欍 +extensions.tabutilsfixed@addon.cn.description=銉栥儍銈優銉笺偗/灞ユ/URL/妞滅储銈掓柊銇椼亜銈裤儢銇ч枊銇嶃併偪銉栥儢銉┿偊銈搞兂銈般伀鏈夌敤銇鑳姐倰杩藉姞銇椼伨銇欍 diff --git a/chrome/locale/pl/tabutils.properties b/chrome/locale/pl/tabutils.properties index 3118e1c..915e0c4 100644 --- a/chrome/locale/pl/tabutils.properties +++ b/chrome/locale/pl/tabutils.properties @@ -1 +1 @@ -extensions.tabutils@ithinc.cn.description=Otwiera elementy z zak艂adek/historii/adres贸w URL/paska szukania w nowych kartach oraz inne narz臋dzia dla przegl膮dania w kartach. +extensions.tabutilsfixed@addon.cn.description=Otwiera elementy z zak艂adek/historii/adres贸w URL/paska szukania w nowych kartach oraz inne narz臋dzia dla przegl膮dania w kartach. diff --git a/chrome/locale/pt-BR/tabutils.properties b/chrome/locale/pt-BR/tabutils.properties index 11601a2..eb09c29 100644 --- a/chrome/locale/pt-BR/tabutils.properties +++ b/chrome/locale/pt-BR/tabutils.properties @@ -1 +1 @@ -extensions.tabutils@ithinc.cn.description=Abre em novas abas o favoritos/hist贸rico/endere莽os/busca, e mais utilidades para uma navega莽茫o com abas. +extensions.tabutilsfixed@addon.cn.description=Abre em novas abas o favoritos/hist贸rico/endere莽os/busca, e mais utilidades para uma navega莽茫o com abas. diff --git a/chrome/locale/ru/tabutils.properties b/chrome/locale/ru/tabutils.properties index 7285052..b4a59e0 100644 --- a/chrome/locale/ru/tabutils.properties +++ b/chrome/locale/ru/tabutils.properties @@ -1 +1 @@ -extensions.tabutils@ithinc.cn.description=袪邪褋褕懈褉械薪薪芯械 褍锌褉邪胁谢械薪懈械 胁泻谢邪写泻邪屑懈 懈 屑薪芯谐芯械 写褉褍谐芯械. +extensions.tabutilsfixed@addon.cn.description=袪邪褋褕懈褉械薪薪芯械 褍锌褉邪胁谢械薪懈械 胁泻谢邪写泻邪屑懈 懈 屑薪芯谐芯械 写褉褍谐芯械. diff --git a/chrome/locale/zh-CN/tabutils.properties b/chrome/locale/zh-CN/tabutils.properties index a07d0ce..44d6603 100644 --- a/chrome/locale/zh-CN/tabutils.properties +++ b/chrome/locale/zh-CN/tabutils.properties @@ -1 +1 @@ -extensions.tabutils@ithinc.cn.description=鍦ㄦ柊鏍囩椤垫墦寮涔︾銆佸巻鍙层佸湴鍧銆佹悳绱紝浠ュ強鏇村澧炲己鏍囩寮忔祻瑙堢殑瀹炵敤鍔熻兘銆 +extensions.tabutilsfixed@addon.cn.description=鍦ㄦ柊鏍囩椤垫墦寮涔︾銆佸巻鍙层佸湴鍧銆佹悳绱紝浠ュ強鏇村澧炲己鏍囩寮忔祻瑙堢殑瀹炵敤鍔熻兘銆 diff --git a/chrome/locale/zh-TW/tabutils.properties b/chrome/locale/zh-TW/tabutils.properties index 4735a88..291c4d5 100644 --- a/chrome/locale/zh-TW/tabutils.properties +++ b/chrome/locale/zh-TW/tabutils.properties @@ -1 +1 @@ -extensions.tabutils@ithinc.cn.description=鏂兼柊鍒嗛爜闁嬪暉鏇哥堡銆佹鍙茶閷勩佺恫鍧銆佹悳灏嬶紝浠ュ強鏇村澧炲挤鍒嗛爜鐎忚鐨勫鐢ㄥ姛鑳姐 +extensions.tabutilsfixed@addon.cn.description=鏂兼柊鍒嗛爜闁嬪暉鏇哥堡銆佹鍙茶閷勩佺恫鍧銆佹悳灏嬶紝浠ュ強鏇村澧炲挤鍒嗛爜鐎忚鐨勫鐢ㄥ姛鑳姐 diff --git a/defaults/preferences/prefs.js b/defaults/preferences/prefs.js index 275840d..009ddcd 100644 --- a/defaults/preferences/prefs.js +++ b/defaults/preferences/prefs.js @@ -1,4 +1,4 @@ -pref("extensions.tabutils@ithinc.cn.description", "chrome://tabutils/locale/tabutils.properties"); +pref("extensions.tabutilsfixed@addon.cn.description", "chrome://tabutils/locale/tabutils.properties"); pref("extensions.tabutils.openBookmarksInTab", true); pref("extensions.tabutils.openHomepageInTab", true); From 3ce96c9b651a96153a9369bb193c89cc5a397e27 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 19 Feb 2015 15:25:06 +0800 Subject: [PATCH 019/116] Fix the browser window does not appear in Fx37+ Note: Not understand its causes at this moment --- chrome/skin/tabutils.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/skin/tabutils.css b/chrome/skin/tabutils.css index 1c092da..233e16a 100644 --- a/chrome/skin/tabutils.css +++ b/chrome/skin/tabutils.css @@ -83,7 +83,7 @@ menuseparator:last-child { } .tabbrowser-tab[autoReload]:not(:hover) .tab-close-button { - list-style-image: url("jar:resource://app/chrome/classic.jar!/skin/classic/browser/Toolbar-small.png") !important; + list-style-image: url("chrome://browser/skin/classic/browser/Toolbar-small.png") !important; -moz-image-region: rect(1px, 111px, 15px, 97px) !important; } @@ -243,7 +243,7 @@ toolbar[iconsize="small"] #undoclosetab-button .toolbarbutton-icon { #statusbar-openintab, #statusbar-loadinbackground, #statusbar-loadinforeground { - list-style-image: url("jar:resource://app/chrome/classic.jar!/skin/classic/browser/Toolbar-small.png"); + list-style-image: url("chrome://browser/skin/classic/browser/Toolbar-small.png"); font-weight: bold; color: green; } From 4da116fbbf42b9d3ab89a4ce68f29d5a76408d02 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sat, 21 Feb 2015 05:20:57 +0800 Subject: [PATCH 020/116] Remove the extra space when tabs overflow Just fix #5, not understand its causes at this moment --- chrome/skin/tabutils.css | 2 +- install.rdf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/skin/tabutils.css b/chrome/skin/tabutils.css index 233e16a..98b799f 100644 --- a/chrome/skin/tabutils.css +++ b/chrome/skin/tabutils.css @@ -132,7 +132,7 @@ menuseparator:last-child { } #PinnedTabsBar:empty > *, -#PinnedTabsBarItems:empty > * { +#PinnedTabsBarItems:empty { display: none; } diff --git a/install.rdf b/install.rdf index 915e521..8aecb3a 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2015.02.19 + 1.5.2015.02.21 YFdyh000 ithinc (Former author) Leszek(teo)呕yczkowski From 22a64f89371a461b7fa376a91b217b95abfe9825 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 23 Feb 2015 12:51:18 +0800 Subject: [PATCH 021/116] Fix toolbars popup break during FullScreen in Fx35+ Due to https://hg.mozilla.org/mozilla-central/rev/cfbe5fc74ea2 [Bug 1071821] This is an not perfect realization, but I really did not find a compatible way. Tested on Fx36/30/28 --- chrome/content/tabutils-vt.js | 64 +++++++++++++++++++++-------------- chrome/content/tabutils.xul | 8 ++--- install.rdf | 2 +- 3 files changed, 44 insertions(+), 30 deletions(-) diff --git a/chrome/content/tabutils-vt.js b/chrome/content/tabutils-vt.js index 6e370bb..b158bd4 100644 --- a/chrome/content/tabutils-vt.js +++ b/chrome/content/tabutils-vt.js @@ -31,34 +31,48 @@ tabutils._verticalTabs = function() { gBrowser.mTabContainer.visible = aShow; }); - TU_hookCode("FullScreen.toggle", /.*_expandCallback.*\n.*_expandCallback.*/, function() { - for (let fullScrToggler of this._fullScrTogglers) { - fullScrToggler.addEventListener("mouseover", this._expandCallback, false); - fullScrToggler.addEventListener("dragenter", this._expandCallback, false); - } - }); - - TU_hookCode("FullScreen.enterDomFullscreen", /.*_expandCallback.*\n.*_expandCallback.*/, function() { - for (let fullScrToggler of this._fullScrTogglers) { - fullScrToggler.removeEventListener("mouseover", this._expandCallback, false); - fullScrToggler.removeEventListener("dragenter", this._expandCallback, false); - } - }); + if (parseFloat(Services.appinfo.version) >= 35.0) { // Bug 1071821 [Fx35] + // I did not find a compatible approach + TU_hookCode("FullScreen.toggle", /.*if.*\(\!this\._fullScrToggler\).*\n.*\n.*\n.*\n.*\}/, function() { + if (!this._eventLoaded) { // the equivalent to "if (!this._fullScrToggler)" + for (let fullScrToggler of this._fullScrTogglers) { + fullScrToggler.addEventListener("mouseover", this._expandCallback, false); + fullScrToggler.addEventListener("dragenter", this._expandCallback, false); + fullScrToggler.collapsed = false; + } + this._eventLoaded = true; + } + }); - TU_hookCode("FullScreen.cleanup", /.*_expandCallback.*\n.*_expandCallback.*/, function() { - for (let fullScrToggler of this._fullScrTogglers) { - fullScrToggler.removeEventListener("mouseover", this._expandCallback, false); - fullScrToggler.removeEventListener("dragenter", this._expandCallback, false); - } - }); + } else { // Earlier than Fx35 + TU_hookCode("FullScreen.toggle", /.*_expandCallback.*\n.*_expandCallback.*/, function() { + for (let fullScrToggler of this._fullScrTogglers) { + fullScrToggler.addEventListener("mouseover", this._expandCallback, false); + fullScrToggler.addEventListener("dragenter", this._expandCallback, false); + fullScrToggler.hidden = false; + } + }); + TU_hookCode("FullScreen.enterDomFullscreen", /.*_expandCallback.*\n.*_expandCallback.*/, function() { + for (let fullScrToggler of this._fullScrTogglers) { + fullScrToggler.removeEventListener("mouseover", this._expandCallback, false); + fullScrToggler.removeEventListener("dragenter", this._expandCallback, false); + } + }); - TU_hookCode("FullScreen.mouseoverToggle", /.*collapsed = aShow.*/, function() { + TU_hookCode("FullScreen.cleanup", /.*_expandCallback.*\n.*_expandCallback.*/, function() { + for (let fullScrToggler of this._fullScrTogglers) { + fullScrToggler.removeEventListener("mouseover", this._expandCallback, false); + fullScrToggler.removeEventListener("dragenter", this._expandCallback, false); + } + }); + } + TU_hookCode("FullScreen.mouseoverToggle", /.*(collapsed|hidden) = aShow.*/, function() { let tabBarPosition = TU_getPref("extensions.tabutils.tabBarPosition"); - this._fullScrTogglers[0].collapsed = aShow; - this._fullScrTogglers[1].collapsed = aShow || tabBarPosition != 1; - this._fullScrTogglers[2].collapsed = aShow || tabBarPosition != 2; - this._fullScrTogglers[3].collapsed = aShow || tabBarPosition != 3; - }); + this._fullScrTogglers[0].$1 = aShow; + this._fullScrTogglers[1].$1 = aShow || tabBarPosition != 1; + this._fullScrTogglers[2].$1 = aShow || tabBarPosition != 2; + this._fullScrTogglers[3].$1 = aShow || tabBarPosition != 3; + }); // Note: mozFullScreen is Fx9+. I did not add " || document.mozFullScreen" because it seems always return to false, unknown reason. TU_hookCode("FullScreen.showXULChrome", ['fullscreenctls.parentNode == navbar', 'document.getElementById("TabsToolbar").parentNode == gNavToolbox'], diff --git a/chrome/content/tabutils.xul b/chrome/content/tabutils.xul index fa443af..c5d4634 100644 --- a/chrome/content/tabutils.xul +++ b/chrome/content/tabutils.xul @@ -419,13 +419,13 @@ key="key_toggleTabsToolbar"/> - - + - - + diff --git a/install.rdf b/install.rdf index 8aecb3a..ab87040 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2015.02.21 + 1.5.2015.02.23 YFdyh000 ithinc (Former author) Leszek(teo)呕yczkowski From 97cad9bed988be8873aa26a5d5934ad88ed0dfbb Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 26 Feb 2015 08:50:02 +0800 Subject: [PATCH 022/116] Fix the vertical tabbar may get stuck on Fx29+ https://bugzilla.mozilla.org/show_bug.cgi?id=971630 [the be land to Fx29~31] the fixing #7 --- chrome/content/tabutils-vt.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chrome/content/tabutils-vt.js b/chrome/content/tabutils-vt.js index b158bd4..df0b31a 100644 --- a/chrome/content/tabutils-vt.js +++ b/chrome/content/tabutils-vt.js @@ -6,6 +6,8 @@ tabutils._verticalTabs = function() { var [start, end, size] = vertical ? ["top", "bottom", "height"] : ["left", "right", "width"]; }], + ["left:", "[start]", "g"], // Bug 971630 [Fx29] + ["right:", "[end]", "g"], [".left", "[start]", "g"], [".right", "[end]", "g"], [".width", "[size]", "g"] From 54a9825eaa001cc44c618b58eb2d9d06a64fbe86 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 26 Feb 2015 10:26:25 +0800 Subject: [PATCH 023/116] Written README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index e69de29..a677a1d 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,10 @@ +# Tab Utilities Fixed +Tab Utilities's compatibility fixes release. + +The project's focused goal: Compatibility fixes for Firefox 28 to the latest Beta for Windows. + +Issue reports or patches are welcome. + +[TODO and notes](https://github.com/yfdyh000/tabutils/wiki/TODO). + +[Release versions and notes](https://github.com/yfdyh000/tabutils/releases) < Download latest versions. From 060697dd8a1423dcc38f8088a3954531ec8daba4 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 1 Mar 2015 07:02:19 +0800 Subject: [PATCH 024/116] Fix a typo for vertical tabbar fixing thanks to issue #9 --- chrome/content/tabutils-vt.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/tabutils-vt.js b/chrome/content/tabutils-vt.js index df0b31a..d3723c4 100644 --- a/chrome/content/tabutils-vt.js +++ b/chrome/content/tabutils-vt.js @@ -6,8 +6,8 @@ tabutils._verticalTabs = function() { var [start, end, size] = vertical ? ["top", "bottom", "height"] : ["left", "right", "width"]; }], - ["left:", "[start]", "g"], // Bug 971630 [Fx29] - ["right:", "[end]", "g"], + ["left:", "[start]:", "g"], // Bug 971630 [Fx29] + ["right:", "[end]:", "g"], [".left", "[start]", "g"], [".right", "[end]", "g"], [".width", "[size]", "g"] From 9d6da475bba7291db77185ee70f90eae946d9a61 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 8 Mar 2015 05:19:33 +0800 Subject: [PATCH 025/116] Mark the closeButtons fail on Fx29+ --- chrome/content/tabutils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 54917f8..ffda9e9 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -3191,6 +3191,7 @@ tabutils._tabPrefObserver = { }, closeButtons: function() { + // Fail on Fx29+, Dut to https://hg.mozilla.org/mozilla-central/rev/1f5f1fe135b9, needs a patching. gBrowser.mTabContainer.mCloseButtons = TU_getPref("extensions.tabutils.closeButtons"); gBrowser.mTabContainer.adjustTabstrip(); }, From 2046d1b0c4cd1f986c970f54b9f620dd20fab59d Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 9 Mar 2015 05:59:26 +0800 Subject: [PATCH 026/116] Replace a `getPreventDefault()` to `defaultPrevented` For the `Use of getPreventDefault() is deprecated. Use defaultPrevented instead.` warning --- chrome/content/tabutils.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils.xml b/chrome/content/tabutils.xml index 61b653e..29d6269 100644 --- a/chrome/content/tabutils.xml +++ b/chrome/content/tabutils.xml @@ -221,7 +221,7 @@ Date: Mon, 9 Mar 2015 07:54:30 +0800 Subject: [PATCH 027/116] Eliminate the 'let expressions', including rewrite the 'extensions.tabutils.invertAlt' code For the 'JavaScript 1.7's let expressions are deprecated' warning --- chrome/content/tabutils.js | 8 ++++++-- install.rdf | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index ffda9e9..d4ba98c 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -310,7 +310,11 @@ tabutils._openUILinkInTab = function() { //地址栏回车键 TU_hookCode("gURLBar.handleCommand", - [/((aTriggeringEvent)\s*&&\s*(aTriggeringEvent.altKey))(?![\s\S]*\1)/, "let (newTabPref = TU_getPref('extensions.tabutils.openUrlInTab', true)) ($1 || newTabPref) && !(($2 ? $3 : false) && newTabPref && TU_getPref('extensions.tabutils.invertAlt', true))"], + [/(let altEnter\s*=.+)((aTriggeringEvent)\s*&&\s*(aTriggeringEvent\.altKey)).*;/, function() { + let newTabPref = TU_getPref('extensions.tabutils.openUrlInTab', true); + let TU_altEnter = ($2 || newTabPref) && !(($3 ? $4 : false) && newTabPref && TU_getPref('extensions.tabutils.invertAlt', true)); + $1TU_altEnter; + }], [/(?=.*openUILinkIn\(url\, where\, params.*)/, function() { params.inBackground = TU_getPref('extensions.tabutils.loadUrlInBackground', false); params.disallowInheritPrincipal = !mayInheritPrincipal; @@ -629,7 +633,7 @@ tabutils._tabOpeningOptions = function() { [/\S*insertRelatedAfterCurrent\S*(?=\))/, "false"], [/(?=(return t;)(?![\s\S]*\1))/, function() { if (t.hasAttribute("opener")) { - function shouldStack(tab) let (args = tab.arguments) (args.aReferrerURI || args.aRelatedToCurrent && args.aURI != "about:blank"); + function shouldStack(tab) { let args = tab.arguments; args.aReferrerURI || args.aRelatedToCurrent && args.aURI != "about:blank"; } let lastRelatedTab = this.mCurrentTab; let isStack = this.isStackedTab(lastRelatedTab); diff --git a/install.rdf b/install.rdf index ab87040..8c1bebf 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2015.02.23 + 1.5.2015.03.09 YFdyh000 ithinc (Former author) Leszek(teo)呕yczkowski @@ -26,7 +26,7 @@ {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 17.0 - 36.* + 37.* false From 5d2457899eb0dffc50c9b69ec0d2bc83725423e3 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 9 Mar 2015 14:27:58 +0800 Subject: [PATCH 028/116] Fix a broken on Fx38+ Due to https://hg.mozilla.org/mozilla-central/diff/409102634a1a/browser/components/places/PlacesUIUtils.jsm [Bug 821724] --- chrome/content/utilityOverlay.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/utilityOverlay.js b/chrome/content/utilityOverlay.js index 46a4c6d..d8b4733 100644 --- a/chrome/content/utilityOverlay.js +++ b/chrome/content/utilityOverlay.js @@ -147,7 +147,7 @@ ); //Open internal links in current tab - TU_hookCode("TU__openNodeIn", /.*inBackground.*/, "$&, event: aEvent"); + TU_hookCode("TU__openNodeIn", /(.*inBackground.*?\))(,?)/, "$1, event: aEvent$2"); TU_hookCode("openUILinkIn", ["{", "var lastArg = Object(arguments[arguments.length - 1]);"], @@ -176,7 +176,7 @@ }); //Open bookmarks with title/history - TU_hookCode("TU__openNodeIn", /.*inBackground.*/, "$&, title: aNode.title, itemId: aNode.itemId == -1 ? null : aNode.itemId"); + TU_hookCode("TU__openNodeIn", /(.*inBackground.*aEvent)(,?)/, "$1, title: aNode.title, itemId: aNode.itemId == -1 ? null : aNode.itemId$2"); TU_hookCode("openUILinkIn", ["{", "var lastArg = Object(arguments[arguments.length - 1]);"], From b2550e2575369a9c3f23024a36bc308a327588c5 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Fri, 13 Mar 2015 00:27:44 +0800 Subject: [PATCH 029/116] Fix a typo in shouldStack #13 --- chrome/content/tabutils.js | 2 +- install.rdf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index d4ba98c..bbd0799 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -633,7 +633,7 @@ tabutils._tabOpeningOptions = function() { [/\S*insertRelatedAfterCurrent\S*(?=\))/, "false"], [/(?=(return t;)(?![\s\S]*\1))/, function() { if (t.hasAttribute("opener")) { - function shouldStack(tab) { let args = tab.arguments; args.aReferrerURI || args.aRelatedToCurrent && args.aURI != "about:blank"; } + 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); diff --git a/install.rdf b/install.rdf index 8c1bebf..3a0d2f3 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2015.03.09 + 1.5.2015.03.09-fix YFdyh000 ithinc (Former author) Leszek(teo)呕yczkowski From 81a93fa86b862167537c4d1872190130f42bc2ad Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sat, 14 Mar 2015 06:56:20 +0800 Subject: [PATCH 030/116] Invalidate a replacement, its purpose is unknown and has broken since Fx38 The changes fixing 'Select download location' window does not appear in Fx38+ --- chrome/content/tabutils.js | 5 +++++ install.rdf | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index bbd0799..1528eb9 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -599,6 +599,10 @@ tabutils._tabOpeningOptions = function() { } }); + // Not understand the purpose of the module, + // and it has been broken since Firefox 38. + // https://hg.mozilla.org/releases/mozilla-aurora/diff/120b108aa176/toolkit/mozapps/downloads/DownloadLastDir.jsm [Bug 1115248] + /* let tmp = {}; Cu.import("resource://gre/modules/DownloadLastDir.jsm", tmp); @@ -626,6 +630,7 @@ tabutils._tabOpeningOptions = function() { getFileAsync.apply(this, arguments); }; })(); + */ //在当前标签页的右侧打开新标签页 //连续打开后台标签时保持原有顺序 diff --git a/install.rdf b/install.rdf index 3a0d2f3..b5491d3 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2015.03.09-fix + 1.5.2015.03.14 YFdyh000 ithinc (Former author) Leszek(teo)呕yczkowski From 1504830eb71be16fd981078e6a05b515fe44325c Mon Sep 17 00:00:00 2001 From: Kamui-Solo Date: Sun, 29 Mar 2015 15:04:48 +0900 Subject: [PATCH 031/116] Update preferences.dtd --- chrome/locale/en-US/preferences.dtd | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/chrome/locale/en-US/preferences.dtd b/chrome/locale/en-US/preferences.dtd index 25b5217..c6effdc 100644 --- a/chrome/locale/en-US/preferences.dtd +++ b/chrome/locale/en-US/preferences.dtd @@ -123,11 +123,9 @@ - + - - From 7253f2ae89f78625213896f7d4ef7a7de8d17fbc Mon Sep 17 00:00:00 2001 From: Kamui-Solo Date: Sun, 29 Mar 2015 15:04:56 +0900 Subject: [PATCH 032/116] Update prefs.js --- defaults/preferences/prefs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/preferences/prefs.js b/defaults/preferences/prefs.js index 009ddcd..fcbf4f2 100644 --- a/defaults/preferences/prefs.js +++ b/defaults/preferences/prefs.js @@ -77,7 +77,7 @@ pref("extensions.tabutils.mouseScrollSelectDir", false); pref("extensions.tabutils.mouseScrollSelectWrap", false); pref("extensions.tabutils.tabBarPosition", 0); -pref("extensions.tabutils.closeButtons", 1); +pref("extensions.tabutils.closeButtons", 10); pref("extensions.tabutils.showTabCounter", false); pref("extensions.tabutils.showLeftSpace", false); pref("extensions.tabutils.showRightSpace", false); From 1484f70a17d8937ad286400acbfdb42939179ee4 Mon Sep 17 00:00:00 2001 From: Kamui-Solo Date: Sun, 29 Mar 2015 15:05:00 +0900 Subject: [PATCH 033/116] Update preferences.dtd --- chrome/locale/ru/preferences.dtd | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/chrome/locale/ru/preferences.dtd b/chrome/locale/ru/preferences.dtd index 8def588..9d44bb3 100644 --- a/chrome/locale/ru/preferences.dtd +++ b/chrome/locale/ru/preferences.dtd @@ -123,11 +123,9 @@ - + - - From 48f22df25fc9563268d5f7942b0458c496755295 Mon Sep 17 00:00:00 2001 From: Kamui-Solo Date: Sun, 29 Mar 2015 15:05:11 +0900 Subject: [PATCH 034/116] Update preferences.xul --- chrome/content/preferences.xul | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/chrome/content/preferences.xul b/chrome/content/preferences.xul index b5c70c5..c6a6f9f 100644 --- a/chrome/content/preferences.xul +++ b/chrome/content/preferences.xul @@ -480,7 +480,7 @@ - + @@ -575,16 +575,14 @@ - + + - - - - @@ -1155,7 +1153,8 @@ } function closeButtons() { - $("tabClipWidth").disabled = ($("closeButtons").value & 0x0f) != 1; + var value = $("closeButtons").value; + $("tabClipWidth").disabled = (value != 1) && (value != 10); } function hideLoadInBackground() { @@ -1317,4 +1316,4 @@ } ]]> - \ No newline at end of file + From c5c577596b0b325998bbd665da0ea046cdb16a2c Mon Sep 17 00:00:00 2001 From: Kamui-Solo Date: Sun, 29 Mar 2015 15:05:12 +0900 Subject: [PATCH 035/116] Update tabutils.css --- chrome/skin/tabutils.css | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/chrome/skin/tabutils.css b/chrome/skin/tabutils.css index 98b799f..6af586a 100644 --- a/chrome/skin/tabutils.css +++ b/chrome/skin/tabutils.css @@ -9,12 +9,21 @@ menuseparator:last-child { } /* Close Tab buttons */ -.tabbrowser-tabs[closeButtonOnPointedTab="true"] > .tabbrowser-tab:hover .tab-close-button, -.tabbrowser-tabs[closebuttons="activetab"] > .tabbrowser-tab:only-child .tab-close-button, -.tabbrowser-tabs[closebuttons="alltabs"] > .tabbrowser-tab:only-child .tab-close-button { +.tabbrowser-tabs[closebuttons="pointedtab"] > .tabbrowser-tab:hover .tab-close-button, +.tabbrowser-tabs[closebuttons="activepointedtab"] > .tabbrowser-tab:hover .tab-close-button, +.tabbrowser-tabs[closebuttons="activetab"] > .tabbrowser-tab[selected] .tab-close-button, +.tabbrowser-tabs[closebuttons="activepointedtab"] > .tabbrowser-tab[selected] .tab-close-button, +.tabbrowser-tabs[closebuttons="alltabs"] > .tabbrowser-tab .tab-close-button { display: -moz-box; } +.tabbrowser-tabs[closebuttons="pointedtab"] > .tabbrowser-tab:not(:hover) .tab-close-button, +.tabbrowser-tabs[closebuttons="activetab"] > .tabbrowser-tab:not([selected]) .tab-close-button, +.tabbrowser-tabs[closebuttons="activepointedtab"] > .tabbrowser-tab:not(:hover):not([selected]) .tab-close-button, +.tabbrowser-tabs[closebuttons="hidden"] > .tabbrowser-tab .tab-close-button { + display: none; +} + /* All Tabs button */ .tabs-alltabs-button[showTabCounter="true"] { visibility: visible !important; /* Fx12 */ @@ -47,12 +56,6 @@ menuseparator:last-child { -moz-box-flex: 0 !important; } -.tabbrowser-tabs[tabfittitle="true"][closeButtonOnPointedTab="true"][closebuttons="activetab"] > .tabbrowser-tab:not([selected]):not(:hover) .tab-close-button, -.tabbrowser-tabs[tabfittitle="true"][closeButtonOnPointedTab="true"]:not([closebuttons="activetab"]):not([closebuttons="alltabs"]) > .tabbrowser-tab:not(:hover) .tab-close-button { - display: -moz-box; - visibility: hidden; -} - /* Tab Highlighting */ .tabbrowser-tab[locked] .tab-throbber:not([busy]), .tabbrowser-tab[locked] .tab-throbber:not([busy]) + .tab-icon-image, @@ -87,11 +90,6 @@ menuseparator:last-child { -moz-image-region: rect(1px, 111px, 15px, 97px) !important; } -.tabbrowser-tabs[closeButtonOnPointedTab="false"][closebuttons="activetab"] > .tabbrowser-tab[autoReload]:not([selected]):hover .tab-close-button, -.tabbrowser-tabs[closeButtonOnPointedTab="false"]:not([closebuttons="activetab"]):not([closebuttons="alltabs"]) > .tabbrowser-tab[autoReload]:hover .tab-close-button { - visibility: hidden; -} - /* Pinned Tab */ .tabbrowser-tabs[orient="vertical"] > .tabbrowser-tab[pinned], .tabbrowser-tabs[autoFaviconizePinned="true"] > .tabbrowser-tab[pinned], From 52f731425c661e76cb0ceaefc249c60f15eed734 Mon Sep 17 00:00:00 2001 From: Kamui-Solo Date: Sun, 29 Mar 2015 15:05:16 +0900 Subject: [PATCH 036/116] Update tabutils.js --- chrome/content/tabutils.js | 110 +++++++++++++++++++++---------------- 1 file changed, 62 insertions(+), 48 deletions(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 1528eb9..3dab757 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -53,7 +53,12 @@ var tabutils = { document.documentElement.setAttribute("v17", true); document.documentElement.setAttribute("v29", version >= 29.0); document.documentElement.setAttribute("v31", version >= 31.0); - + + gBrowser.mTabContainer._originalAdjustTabstripFunc = gBrowser.mTabContainer.adjustTabstrip; + gBrowser.mTabContainer.adjustTabstrip = function adjustTabstrip() { + this._originalAdjustTabstripFunc(); + } + // Function.prototype.__defineGetter__("stack", function() { // var stack = []; // for (let caller = this; caller && stack.length < 15; caller = caller.caller) { @@ -305,10 +310,10 @@ tabutils._PlacesUtilsExt = function() { tabutils._openUILinkInTab = function() { - //主页 + //涓婚〉 TU_hookCode("BrowserGoHome", "browser.tabs.loadBookmarksInBackground", "extensions.tabutils.loadHomepageInBackground"); - //地址栏回车键 + //鍦板潃鏍忓洖杞﹂敭 TU_hookCode("gURLBar.handleCommand", [/(let altEnter\s*=.+)((aTriggeringEvent)\s*&&\s*(aTriggeringEvent\.altKey)).*;/, function() { let newTabPref = TU_getPref('extensions.tabutils.openUrlInTab', true); @@ -326,14 +331,14 @@ tabutils._openUILinkInTab = function() { ); // TU_hookCode("openLinkIn", /(?=let uriObj)/, "w.gURLBar.handleRevert();"); - //搜索栏回车键 + //鎼滅储鏍忓洖杞﹂敭 if (BrowserSearch.searchBar) TU_hookCode("BrowserSearch.searchBar.handleSearchCommand", [/(\(aEvent && aEvent.altKey\)) \^ (newTabPref)/, "($1 || $2) && !($1 && $2 && TU_getPref('extensions.tabutils.invertAlt', true)) && !isTabEmpty(gBrowser.selectedTab)"], [/"tab"/, "TU_getPref('extensions.tabutils.loadSearchInBackground', false) ? 'background' : 'foreground'"] ); - //右键点击书签 + //鍙抽敭鐐瑰嚮涔︾ TU_hookCode("BookmarksEventHandler.onClick", ["aEvent.button == 2", "$& && (aEvent.ctrlKey || aEvent.altKey || aEvent.metaKey || !TU_getPref('extensions.tabutils.rightClickBookmarks', 0))"], ["aEvent.button == 1", "aEvent.button > 0"], @@ -345,7 +350,7 @@ tabutils._openUILinkInTab = function() { ); TU_hookCode("whereToOpenLink", "e.button == 1", "e.button > 0"); - //保持菜单打开 + //淇濇寔鑿滃崟鎵撳紑 TU_hookCode("BookmarksEventHandler.onClick", /.*hidePopup.*/, "if (!(TU_getPref('extensions.tabutils.middleClickBookmarks', 0) & 4)) $&"); TU_hookCode("checkForMiddleClick", /.*closeMenus.*/, "if (!(TU_getPref('extensions.tabutils.middleClickBookmarks', 0) & 4)) $&"); @@ -369,7 +374,7 @@ tabutils._openUILinkInTab = function() { tabutils._openLinkInTab = function() { - //强制在新标签页打开所有链接 + //寮哄埗鍦ㄦ柊鏍囩椤垫墦寮鎵鏈夐摼鎺 TU_hookCode("contentAreaClick", /if[^{}]*event.button == 0[^{}]*{([^{}]|{[^{}]*}|{([^{}]|{[^{}]*})*})*(?=})/, "$&" + (function() { if (tabutils.gOpenLinkInTab && !href.startsWith("javascript:")) { openNewTabWith(href, linkNode.ownerDocument, null, event, false); @@ -383,11 +388,11 @@ tabutils._openLinkInTab = function() { aWhere = Ci.nsIBrowserDOMWindow.OPEN_NEWTAB; }); - //强制在后台打开所有新标签页 + //寮哄埗鍦ㄥ悗鍙版墦寮鎵鏈夋柊鏍囩椤 TU_hookCode("gBrowser.loadOneTab", /(?=var owner)/, "bgLoad = bgLoad && !tabutils.gLoadAllInForeground || tabutils.gLoadAllInBackground;"); TU_hookCode("gBrowser.loadTabs", /(?=var owner)/, "aLoadInBackground = aLoadInBackground && !tabutils.gLoadAllInForeground || tabutils.gLoadAllInBackground;"); - //强制在新标签页打开外部链接 + //寮哄埗鍦ㄦ柊鏍囩椤垫墦寮澶栭儴閾炬帴 TU_hookCode("contentAreaClick", /if[^{}]*event.button == 0[^{}]*{([^{}]|{[^{}]*}|{([^{}]|{[^{}]*})*})*(?=})/, "$&" + (function() { if (/^(https?|ftp)/.test(href) && TU_getPref("extensions.tabutils.openExternalInTab", false)) { let ourDomain = tabutils.getDomainFromURI(linkNode.ownerDocument.documentURIObject); @@ -400,7 +405,7 @@ tabutils._openLinkInTab = function() { } }).toString().replace(/^.*{|}$/g, "")); - //外来链接 + //澶栨潵閾炬帴 TU_hookCode("nsBrowserAccess.prototype.openURI", '"browser.link.open_newwindow"', 'isExternal ? "browser.link.open_external" : $&'); // L-click @@ -420,7 +425,7 @@ tabutils._openLinkInTab = function() { ); TU_hookCode("openNewTabWith", "aEvent.button == 1", "aEvent.button > 0"); - //拖曳链接 + //鎷栨洺閾炬帴 TU_hookCode("handleDroppedLink", /.*loadURI.*/, function(s) (function() { { switch (true) { @@ -439,7 +444,7 @@ tabutils._openLinkInTab = function() { b.droppedLinkHandler = handleDroppedLink; } - //在新标签页打开链接时继承历史 + //鍦ㄦ柊鏍囩椤垫墦寮閾炬帴鏃剁户鎵垮巻鍙 TU_hookCode("gBrowser.loadOneTab", ["{", function() { var currentTab = this.mCurrentTab; @@ -456,7 +461,7 @@ tabutils._openLinkInTab = function() { ); }; -//单窗口模式 +//鍗曠獥鍙fā寮 tabutils._singleWindowMode = function() { if (TU_getPref("extensions.tabutils.singleWindowMode", false)) { var win = (function() { @@ -546,7 +551,7 @@ tabutils._singleWindowMode = function() { tabutils._tabOpeningOptions = function() { - //新建标签页时利用已有空白标签页 + //鏂板缓鏍囩椤垫椂鍒╃敤宸叉湁绌虹櫧鏍囩椤 TU_hookCode("gBrowser.addTab", [/if \(arguments.length == 2[^{}]*\) {[^{}]*}/, "$&" + (function() { if (!isBlankPageURL(aURI)) { @@ -586,7 +591,7 @@ tabutils._tabOpeningOptions = function() { }; TU_hookCode("isBlankPageURL", 'aURL == "about:blank"', "gInitialPages.indexOf(aURL) > -1"); - //自动关闭非主动打开的空白标签页 + //鑷姩鍏抽棴闈炰富鍔ㄦ墦寮鐨勭┖鐧芥爣绛鹃〉 TU_hookCode("gBrowser.mTabProgressListener", /(?=var location)/, function() { if (aWebProgress.DOMWindow.document.documentURI == "about:blank" && aRequest.QueryInterface(nsIChannel).URI.spec != "about:blank" @@ -632,8 +637,8 @@ tabutils._tabOpeningOptions = function() { })(); */ - //在当前标签页的右侧打开新标签页 - //连续打开后台标签时保持原有顺序 + //鍦ㄥ綋鍓嶆爣绛鹃〉鐨勫彸渚ф墦寮鏂版爣绛鹃〉 + //杩炵画鎵撳紑鍚庡彴鏍囩鏃朵繚鎸佸師鏈夐『搴 TU_hookCode("gBrowser.addTab", [/\S*insertRelatedAfterCurrent\S*(?=\))/, "false"], [/(?=(return t;)(?![\s\S]*\1))/, function() { @@ -684,7 +689,7 @@ tabutils._tabOpeningOptions = function() { this.updateCurrentBrowser(true); }); - //新建标签页 + //鏂板缓鏍囩椤 if (BrowserOpenTab.name == "BrowserOpenTab") { //Compatibility with Speed Dial TU_hookCode("BrowserOpenTab", [/.*openUILinkIn\((.*)\)/, function(s, s1) s.replace(s1, ( @@ -704,7 +709,7 @@ tabutils._tabOpeningOptions = function() { return this.mTabContainer.getElementsByAttribute("linkedpanel", this.mPanelContainer.lastChild.id)[0]; }; - //复制标签页 + //澶嶅埗鏍囩椤 TU_hookCode("gBrowser.duplicateTab", [/return/g, "var tab ="], ["}", function() { @@ -722,7 +727,7 @@ tabutils._tabOpeningOptions = function() { }] ); - //撤销关闭标签页 + //鎾ら攢鍏抽棴鏍囩椤 TU_hookCode("gBrowser.moveTabTo", "}", function() { if (TMP_console.callerName() == "ssi_undoCloseTab" && !TU_getPref("extensions.tabutils.restoreOriginalPosition", true)) @@ -732,7 +737,7 @@ tabutils._tabOpeningOptions = function() { tabutils._tabClosingOptions = function() { - //关闭标签页时选择左侧/右侧/第一个/最后一个标签 + //鍏抽棴鏍囩椤垫椂閫夋嫨宸︿晶/鍙充晶/绗竴涓/鏈鍚庝竴涓爣绛 gBrowser._tabsToSelect = function _tabsToSelect(aTabs) { if (!aTabs) aTabs = this.visibleTabs; @@ -810,7 +815,7 @@ tabutils._tabClosingOptions = function() { } }; - //关闭标签页时选择亲属标签 + //鍏抽棴鏍囩椤垫椂閫夋嫨浜插睘鏍囩 TU_hookCode("gBrowser.onTabSelect", "}", function() { var panelId = aTab.linkedPanel + "#"; Array.forEach(this.visibleTabs, function(aTab) { @@ -844,7 +849,7 @@ tabutils._tabClosingOptions = function() { || bTab.getAttribute("opener").startsWith(aTab.linkedPanel + "#"); }; - //关闭标签页时选择上次浏览的标签 + //鍏抽棴鏍囩椤垫椂閫夋嫨涓婃娴忚鐨勬爣绛 gBrowser.mTabContainer._tabHistory = Array.slice(gBrowser.mTabs); TU_hookCode("gBrowser.onTabOpen", "}", function() { var tabHistory = this.mTabContainer._tabHistory; @@ -899,8 +904,8 @@ tabutils._tabClosingOptions = function() { || tabHistory[aDir < 0 ? tabHistory.length - 1 : 0]; }; - //Ctrl+Tab切换到上次浏览的标签 - //Ctrl+左右方向键切换到前一个/后一个标签 + //Ctrl+Tab鍒囨崲鍒颁笂娆℃祻瑙堢殑鏍囩 + //Ctrl+宸﹀彸鏂瑰悜閿垏鎹㈠埌鍓嶄竴涓/鍚庝竴涓爣绛 tabutils.addEventListener(window, "keydown", function(event) { if (!event.ctrlKey || event.altKey || event.metaKey) return; @@ -1116,7 +1121,7 @@ tabutils._tabClosingOptions = function() { }, false); }; -//标记未读标签页 +//鏍囪鏈鏍囩椤 tabutils._unreadTab = function() { gBrowser.unreadTab = function unreadTab(aTab, aForce) { if (aForce == null) @@ -1155,7 +1160,7 @@ tabutils._unreadTab = function() { }); } -//保护标签页、锁定标签页、冻结标签页 +//淇濇姢鏍囩椤点侀攣瀹氭爣绛鹃〉銆佸喕缁撴爣绛鹃〉 tabutils._protectAndLockTab = function() { /* aRestoring = null: setAttribute + setTabValue + tagURI * aRestoring = false: setAttribute + setTabValue @@ -1284,7 +1289,7 @@ tabutils._protectAndLockTab = function() { }).toString().replace(/^.*{|}$/g, "")); }; -//图标化标签页 +//鍥炬爣鍖栨爣绛鹃〉 tabutils._faviconizeTab = function() { gBrowser.faviconizeTab = function faviconizeTab(aTab, aForce, aRestoring) { if (aForce == aTab.hasAttribute("faviconized")) @@ -1328,11 +1333,11 @@ tabutils._faviconizeTab = function() { TU_hookCode("gBrowser.onLocationChange", "}", "this.autoFaviconizeTab(aTab, uri, tags);"); }; -//固定标签页 +//鍥哄畾鏍囩椤 tabutils._pinTab = function() { }; -//重命名标签页 +//閲嶅懡鍚嶆爣绛鹃〉 tabutils._renameTab = function() { gBrowser.renameTab = function renameTab(aTab, aTitle, aRestoring) { if (aTab.getAttribute("title") == aTitle) @@ -1448,7 +1453,7 @@ tabutils._restartTab = function() { }); }; -//自动刷新标签页 +//鑷姩鍒锋柊鏍囩椤 tabutils._reloadEvery = function() { gBrowser.autoReloadTab = function autoReloadTab(aTab, aForce, aRestoring, aInterval) { if (aForce == aTab.hasAttribute("autoReload") && (!aForce || aInterval == aTab._reloadInterval)) @@ -1793,7 +1798,7 @@ tabutils._multiTabHandler = function() { }, []); }; - //关闭多个标签页 + //鍏抽棴澶氫釜鏍囩椤 TU_hookCode("gBrowser.warnAboutClosingTabs", /\w+(?= <= 1)/, "($& = arguments[1] && 'length' in arguments[1] ? arguments[1].length : $&)"); // Bug 866880 [Fx24] gBrowser.removeTabsBut = function removeTabsBut(aTabs, bTabs) { aTabs = aTabs ? "length" in aTabs ? aTabs : [aTabs] : []; @@ -1834,7 +1839,7 @@ tabutils._multiTabHandler = function() { gBrowser.closeAllTabs = function() this.removeTabsBut(this.allTabs); gBrowser.closeAllDuplicateTabs = function() this.removeTabsBut(this.allTabs, this.uniqueTabsOf(this.allTabs)); - //拖曳多个标签页 + //鎷栨洺澶氫釜鏍囩椤 gBrowser.gatherTabs = function gatherTabs(aTabs, aTab, aSuppressTabMove) { let index = 0; if (aTab) { @@ -2035,7 +2040,7 @@ tabutils._multiTabHandler = function() { tabutils._tabClickingOptions = function() { - //载入剪贴板URL + //杞藉叆鍓创鏉縐RL gBrowser.loadURLFromClipboard = function loadURLFromClipboard(aTab) { var url = readFromClipboard(); if (!url) @@ -2050,7 +2055,7 @@ tabutils._tabClickingOptions = function() { } }; - //浏览历史菜单 + //娴忚鍘嗗彶鑿滃崟 TU_hookCode("FillHistoryMenu", ["count <= 1", "count == 0"], [/(?=var webNav)/, function() { @@ -2447,7 +2452,7 @@ tabutils._miscFeatures = function() { } }; -//浏览区右键菜单 +//娴忚鍖哄彸閿彍鍗 tabutils._mainContextMenu = function() { nsContextMenu.prototype.isLinkSelected = function() { var focusedWindow = document.commandDispatcher.focusedWindow; @@ -2771,7 +2776,7 @@ tabutils._hideTabBar = function() { TU_hookCode("gBrowser.mTabContainer.updateVisibility", "{", 'if (!TU_getPref("browser.tabs.autoHide")) return;'); }; -//撤销关闭标签页按钮 +//鎾ら攢鍏抽棴鏍囩椤垫寜閽 tabutils._undoCloseTabButton = function() { TU_hookCode("RecentlyClosedTabsAndWindowsMenuUtils" in window ? "RecentlyClosedTabsAndWindowsMenuUtils._undoCloseMiddleClick" : // Bug 928640 [Fx27] @@ -2865,17 +2870,26 @@ tabutils._tabPrefObserver = { //Close buttons TU_hookCode("gBrowser.mTabContainer.adjustTabstrip", - [/let tab.*/, function() { - let tab; - Array.some(this.tabbrowser.visibleTabs, function(aTab) { - return !aTab.collapsed && getComputedStyle(aTab).MozBoxFlex > 0 && (tab = aTab); - }); - }], - ["this.mCloseButtons", "($& & 0x0f)"], - ["this.mCloseButtons != 3", "(this.mCloseButtons & 0x0f) != 3 && !(this.mCloseButtons & 0x20)"], // Fail on Fx31+ - ["this._closeWindowWithLastTab", "false", "g"], // Fail on Fx31+ - ["}", function() { - this.setAttribute("closeButtonOnPointedTab", (this.mCloseButtons & 0x0f) == 1 || !!(this.mCloseButtons & 0x10)); // Fail on Fx31+ + ["this._originalAdjustTabstripFunc();", "if (this.mCloseButtons == 10) {$&}"], + ["}", function() { + if (this.mCloseButtons != 10) { + var def = "alltabs"; + var map = { + 0: "activetab", + 1: "alltabs", + 2: "hidden", + 16: "activepointedtab", + 18: "pointedtab" + }; + var value = map[this.mCloseButtons] || def; + if (value == "alltabs") { + let tab = this.tabbrowser.visibleTabs[this.tabbrowser._numPinnedTabs]; + if (tab && tab.getBoundingClientRect().width <= this.mTabClipWidth) { + value = "hidden"; + } + } + this.setAttribute("closebuttons", value); + } }] ); From ad4a2f0a5b5e6100a0ba42c62521f1c037c42959 Mon Sep 17 00:00:00 2001 From: Kamui-Solo Date: Sun, 29 Mar 2015 15:05:19 +0900 Subject: [PATCH 037/116] Update tabutils_mac.css --- chrome/skin/tabutils_mac.css | 6 ------ 1 file changed, 6 deletions(-) diff --git a/chrome/skin/tabutils_mac.css b/chrome/skin/tabutils_mac.css index 3d4529c..1d3534f 100644 --- a/chrome/skin/tabutils_mac.css +++ b/chrome/skin/tabutils_mac.css @@ -1,9 +1,3 @@ -/* Close Tab buttons */ -window[OS="Darwin"][v4="true"] .tabbrowser-tabs[closeButtonOnPointedTab="true"][closebuttons="activetab"] > .tabbrowser-tab:not([selected]):not(:hover) .tab-close-button, -window[OS="Darwin"][v4="true"] .tabbrowser-tabs[closeButtonOnPointedTab="true"]:not([closebuttons="activetab"]):not([closebuttons="alltabs"]) > .tabbrowser-tab:not(:hover) .tab-close-button { - display: -moz-box; - visibility: hidden; -} /* Tab Stacking */ window[OS="Darwin"][v4="true"] .tabbrowser-tab[group-selected]:not([group-counter="1"])[group-collapsed] .tab-twisty { From f10f41d79dc9c2d0100e8b95f4abcdca9143cbdd Mon Sep 17 00:00:00 2001 From: Kamui-Solo Date: Sun, 29 Mar 2015 20:57:27 +0900 Subject: [PATCH 038/116] Options: Disable "Close Tab button" Options: Disable "Close Tab button" list if checkbox is unchecked --- chrome/content/preferences.xul | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chrome/content/preferences.xul b/chrome/content/preferences.xul index c6a6f9f..cc2af52 100644 --- a/chrome/content/preferences.xul +++ b/chrome/content/preferences.xul @@ -575,7 +575,7 @@ - @@ -1155,6 +1155,7 @@ function closeButtons() { var value = $("closeButtons").value; $("tabClipWidth").disabled = (value != 1) && (value != 10); + $("c.closeButtons").disabled = value == 2; } function hideLoadInBackground() { From 9c7b5b9d3f9c0eec2e085c259e1be9d9f94743b7 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 30 Mar 2015 07:04:49 +0800 Subject: [PATCH 039/116] Refine the closebutton pref * Add the missing string for other languages (not translated) to avoid breaking the preferences window * Fix the "Browser default" not work properly for Fx30 and earlier --- chrome/content/preferences.xul | 2 +- chrome/content/tabutils.js | 10 +++++----- chrome/locale/de/preferences.dtd | 1 + chrome/locale/en-US/preferences.dtd | 4 +++- chrome/locale/es-ES/preferences.dtd | 1 + chrome/locale/it/preferences.dtd | 1 + chrome/locale/ja-JP/preferences.dtd | 1 + chrome/locale/pl/preferences.dtd | 1 + chrome/locale/pt-BR/preferences.dtd | 1 + chrome/locale/ru/preferences.dtd | 4 +++- chrome/locale/zh-CN/preferences.dtd | 1 + chrome/locale/zh-TW/preferences.dtd | 1 + 12 files changed, 20 insertions(+), 8 deletions(-) diff --git a/chrome/content/preferences.xul b/chrome/content/preferences.xul index cc2af52..20fb7b8 100644 --- a/chrome/content/preferences.xul +++ b/chrome/content/preferences.xul @@ -578,7 +578,7 @@ - + diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 3dab757..55a05ba 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -2870,9 +2870,9 @@ tabutils._tabPrefObserver = { //Close buttons TU_hookCode("gBrowser.mTabContainer.adjustTabstrip", - ["this._originalAdjustTabstripFunc();", "if (this.mCloseButtons == 10) {$&}"], + ["this._originalAdjustTabstripFunc();", "if (this.TU_mCloseButtons == 10) {this.mCloseButtons = this.legacy_mCloseButtons; $&}"], ["}", function() { - if (this.mCloseButtons != 10) { + if (this.TU_mCloseButtons != 10) { var def = "alltabs"; var map = { 0: "activetab", @@ -2881,7 +2881,7 @@ tabutils._tabPrefObserver = { 16: "activepointedtab", 18: "pointedtab" }; - var value = map[this.mCloseButtons] || def; + var value = map[this.TU_mCloseButtons] || def; if (value == "alltabs") { let tab = this.tabbrowser.visibleTabs[this.tabbrowser._numPinnedTabs]; if (tab && tab.getBoundingClientRect().width <= this.mTabClipWidth) { @@ -3214,8 +3214,8 @@ tabutils._tabPrefObserver = { }, closeButtons: function() { - // Fail on Fx29+, Dut to https://hg.mozilla.org/mozilla-central/rev/1f5f1fe135b9, needs a patching. - gBrowser.mTabContainer.mCloseButtons = TU_getPref("extensions.tabutils.closeButtons"); + gBrowser.mTabContainer.legacy_mCloseButtons = TU_getPref("browser.tabs.closeButtons"); + gBrowser.mTabContainer.TU_mCloseButtons = TU_getPref("extensions.tabutils.closeButtons"); gBrowser.mTabContainer.adjustTabstrip(); }, diff --git a/chrome/locale/de/preferences.dtd b/chrome/locale/de/preferences.dtd index 0aa5eef..95745d4 100644 --- a/chrome/locale/de/preferences.dtd +++ b/chrome/locale/de/preferences.dtd @@ -124,6 +124,7 @@ + diff --git a/chrome/locale/en-US/preferences.dtd b/chrome/locale/en-US/preferences.dtd index c6effdc..172cc1a 100644 --- a/chrome/locale/en-US/preferences.dtd +++ b/chrome/locale/en-US/preferences.dtd @@ -123,9 +123,11 @@ - + + + diff --git a/chrome/locale/es-ES/preferences.dtd b/chrome/locale/es-ES/preferences.dtd index 36fed8a..6abef01 100644 --- a/chrome/locale/es-ES/preferences.dtd +++ b/chrome/locale/es-ES/preferences.dtd @@ -124,6 +124,7 @@ + diff --git a/chrome/locale/it/preferences.dtd b/chrome/locale/it/preferences.dtd index f2bd8dd..5338440 100644 --- a/chrome/locale/it/preferences.dtd +++ b/chrome/locale/it/preferences.dtd @@ -124,6 +124,7 @@ + diff --git a/chrome/locale/ja-JP/preferences.dtd b/chrome/locale/ja-JP/preferences.dtd index 82e58d3..4e4a508 100644 --- a/chrome/locale/ja-JP/preferences.dtd +++ b/chrome/locale/ja-JP/preferences.dtd @@ -124,6 +124,7 @@ + diff --git a/chrome/locale/pl/preferences.dtd b/chrome/locale/pl/preferences.dtd index 91bf634..44b8415 100644 --- a/chrome/locale/pl/preferences.dtd +++ b/chrome/locale/pl/preferences.dtd @@ -124,6 +124,7 @@ + diff --git a/chrome/locale/pt-BR/preferences.dtd b/chrome/locale/pt-BR/preferences.dtd index b826d9b..8198a1e 100644 --- a/chrome/locale/pt-BR/preferences.dtd +++ b/chrome/locale/pt-BR/preferences.dtd @@ -124,6 +124,7 @@ + diff --git a/chrome/locale/ru/preferences.dtd b/chrome/locale/ru/preferences.dtd index 9d44bb3..7bdb82e 100644 --- a/chrome/locale/ru/preferences.dtd +++ b/chrome/locale/ru/preferences.dtd @@ -123,9 +123,11 @@ - + + + diff --git a/chrome/locale/zh-CN/preferences.dtd b/chrome/locale/zh-CN/preferences.dtd index 2de8ac2..f10e80a 100644 --- a/chrome/locale/zh-CN/preferences.dtd +++ b/chrome/locale/zh-CN/preferences.dtd @@ -124,6 +124,7 @@ + diff --git a/chrome/locale/zh-TW/preferences.dtd b/chrome/locale/zh-TW/preferences.dtd index 159ed29..6002598 100644 --- a/chrome/locale/zh-TW/preferences.dtd +++ b/chrome/locale/zh-TW/preferences.dtd @@ -124,6 +124,7 @@ + From a5c2d31b495aaa935cb2663f6d0ff1d072fc1144 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 30 Mar 2015 07:48:00 +0800 Subject: [PATCH 040/116] Bump 2015.03.30 --- install.rdf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install.rdf b/install.rdf index b5491d3..a7107a9 100644 --- a/install.rdf +++ b/install.rdf @@ -4,9 +4,11 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2015.03.14 + 1.5.2015.03.30 YFdyh000 ithinc (Former author) + Phil Tsarik + Kamui-Solo Leszek(teo)呕yczkowski Emanuele Alimonda Cye3s (zh-CN) From d999da75226c63f088417eb214d96980b30c18d0 Mon Sep 17 00:00:00 2001 From: Kamui-Solo Date: Tue, 31 Mar 2015 23:09:41 +0800 Subject: [PATCH 041/116] Merge pull request #18 from Kamui-Solo/Fixed Picking stack color from favicon with pref Refine and squashed by YFdyh000 --- chrome/content/tabutils-st.js | 5 +++++ chrome/content/tabutils.js | 1 + defaults/preferences/prefs.js | 1 + 3 files changed, 7 insertions(+) diff --git a/chrome/content/tabutils-st.js b/chrome/content/tabutils-st.js index 1817f64..cce17de 100644 --- a/chrome/content/tabutils-st.js +++ b/chrome/content/tabutils-st.js @@ -113,6 +113,11 @@ tabutils._stackTabs = function() { if (bTab.getAttribute("group-counter") == 1) { bTab.setAttribute("group-collapsed", !options.expand && TU_getPref("extensions.tabutils.autoCollapseNewStack", true)); this.mTabContainer.mTabstrip.ensureElementIsVisible(bTab); + if (bTab.image && TU_getPref('extensions.tabutils.colorStackFromFavicon', false)) + Services.mozIColorAnalyzer.findRepresentativeColor(makeURI(bTab.image), function(success, color) { + if (success) + this.updateStack(bTab, {color: "#" + ("000000" + color.toString(16)).slice(-6)}); + }.bind(this)); } //must happen after "group" is set to avoid bypassing stack, and diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 55a05ba..21d0767 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -176,6 +176,7 @@ window.addEventListener("DOMContentLoaded", tabutils, false); [ ["@mozilla.org/browser/sessionstore;1", "nsISessionStore", "_ss", tabutils], // Bug 898732 [Fx26] ["@mozilla.org/docshell/urifixup;1", "nsIURIFixup"], // Bug 802026 [Fx20] + ["@mozilla.org/places/colorAnalyzer;1", "mozIColorAnalyzer"], ["@mozilla.org/widget/clipboardhelper;1", "nsIClipboardHelper"], ["@mozilla.org/uuid-generator;1", "nsIUUIDGenerator"] ].forEach(function([aContract, aInterface, aName, aObject]) diff --git a/defaults/preferences/prefs.js b/defaults/preferences/prefs.js index fcbf4f2..a9e84bd 100644 --- a/defaults/preferences/prefs.js +++ b/defaults/preferences/prefs.js @@ -209,6 +209,7 @@ pref("extensions.tabutils.dragToStack", false); pref("extensions.tabutils.mouseHoverPopup", true); pref("extensions.tabutils.mouseHoverPopupDelay", 750); +pref("extensions.tabutils.colorStackFromFavicon", false); pref("extensions.tabutils.colorStack", true); pref("extensions.tabutils.colorStack.0", "#50C2F8 20%"); pref("extensions.tabutils.colorStack.1", "#60FDC8 20%"); From c66c4002745669e7922727a842371d9e97e76878 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 5 Apr 2015 20:26:57 +0800 Subject: [PATCH 042/116] Fix opening external links always in a new window and reuseBlank pref in Fx37+ ReferenceError: can't access lexical declaration `usingPreloadedContent' before initialization https://hg.mozilla.org/mozilla-central/rev/3e110e958354#l1.293 Tested on Fx28, Fx37 --- chrome/content/tabutils.js | 2 +- install.rdf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 21d0767..a58d19b 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -563,7 +563,7 @@ tabutils._tabOpeningOptions = function() { } } }).toString().replace(/^.*{|}$/g, "")], - [/(?=return t;)/, gBrowser.addTab.toString().match(/var (uriIsBlankPage|uriIsNotAboutBlank|uriIsAboutBlank).*|let docShellsSwapped[\s\S]*(?=\n.*docShellsSwapped.*)|if \((uriIsNotAboutBlank|.*uriIsAboutBlank)\) {([^{}]|{[^{}]*})*}/g).join("\n")] // Bug 716108 [Fx16] + [/(?=return t;)/, gBrowser.addTab.toString().match(/var (uriIsBlankPage|uriIsNotAboutBlank|uriIsAboutBlank).*|let (docShellsSwapped|usingPreloadedContent)[\s\S]*(?=\n.*(docShellsSwapped|usingPreloadedContent).*)|if \((uriIsNotAboutBlank|.*uriIsAboutBlank)\) {([^{}]|{[^{}]*})*}/g).join("\n")] // Bug 716108 [Fx16], Bug 1077652 [Fx37] ); gBrowser.getBlankTab = function getBlankTab() { diff --git a/install.rdf b/install.rdf index a7107a9..35fa740 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2015.03.30 + 1.5.2015.04.05 YFdyh000 ithinc (Former author) Phil Tsarik From a8d815c1d7d8ef808e8c82f528f15589a115a3b5 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 25 May 2015 22:39:25 +0800 Subject: [PATCH 043/116] Fix export settings not works in Fx37+ due to String.quote(), fix #28 --- chrome/content/preferences.xul | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/preferences.xul b/chrome/content/preferences.xul index 20fb7b8..70f387f 100644 --- a/chrome/content/preferences.xul +++ b/chrome/content/preferences.xul @@ -1050,9 +1050,9 @@ var preferences = document.getElementsByTagName("preference"); for (let preference of preferences) { str += 'pref('; - str += preference.name.quote(); + str += JSON.stringify(preference.name); str += ', '; - str += preference.type == typeof preference.value ? preference.value.quote() : + str += preference.type == typeof preference.value ? JSON.stringify(preference.value) : preference.inverted ? !preference.value : preference.value; str += ');\n'; } From dc5d166842374df76c041e6641d3b3a9fe58e4ee Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Fri, 3 Jul 2015 05:38:57 +0800 Subject: [PATCH 044/116] Fix many listener failure in Fx40+ * It maybe due to chrome elements's scope changes, not confirmed --- chrome/content/tabutils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index a58d19b..478d60f 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -153,7 +153,7 @@ var tabutils = { _eventListeners: [], addEventListener: function() { - document.addEventListener.apply(arguments[0], Array.slice(arguments, 1)); + arguments[0].addEventListener.apply(arguments[0], Array.slice(arguments, 1)); this._eventListeners.push(arguments); }, From 6de104eddac892542a975e322337bb3cdca3e12b Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Fri, 3 Jul 2015 09:47:22 +0800 Subject: [PATCH 045/116] Bump 2015.07.03 --- install.rdf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.rdf b/install.rdf index 35fa740..2dccaa8 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2015.04.05 + 1.5.2015.07.03 YFdyh000 ithinc (Former author) Phil Tsarik @@ -28,7 +28,7 @@ {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 17.0 - 37.* + 39.* false From 718ba90cff68a82d1d3946b8936c59957bc73339 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Fri, 3 Jul 2015 10:43:36 +0800 Subject: [PATCH 046/116] Disable bookmarkWithHistory feature in Fx40+ to save Bookmarks feature --- chrome/content/tabutils.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 478d60f..fc0a667 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -1601,6 +1601,7 @@ tabutils._bookmarkTabs = function() { PlacesCommandHook.bookmarkPage(aTabs[0].linkedBrowser, PlacesUtils.bookmarksMenuFolderId, true); }; + if (parseFloat(Services.appinfo.version) < 40) { // https://hg.mozilla.org/mozilla-central/diff/d84b62b367b4/browser/base/content/browser-places.js TU_hookCode("PlacesCommandHook.bookmarkPage", [/(?=.*(createItem|PlacesCreateBookmarkTransaction).*)/, function() { var annos = [descAnno]; @@ -1612,6 +1613,7 @@ tabutils._bookmarkTabs = function() { }], [/.*(createItem|PlacesCreateBookmarkTransaction).*/, function(s) s.replace("[descAnno]", "annos")] // Bug 575955 [Fx13] ); + } TU_hookCode("PlacesCommandHook.bookmarkCurrentPages", ["this.uniqueCurrentPages", (function() { From 01c0d40319f1dd1066f8520fb93aa4a24c3c3d55 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Fri, 3 Jul 2015 10:52:45 +0800 Subject: [PATCH 047/116] refine variable name --- chrome/content/tabutils-vt.js | 2 +- chrome/content/tabutils.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/chrome/content/tabutils-vt.js b/chrome/content/tabutils-vt.js index d3723c4..e174dab 100644 --- a/chrome/content/tabutils-vt.js +++ b/chrome/content/tabutils-vt.js @@ -33,7 +33,7 @@ tabutils._verticalTabs = function() { gBrowser.mTabContainer.visible = aShow; }); - if (parseFloat(Services.appinfo.version) >= 35.0) { // Bug 1071821 [Fx35] + if (tabutils.fxVersion >= 35.0) { // Bug 1071821 [Fx35] // I did not find a compatible approach TU_hookCode("FullScreen.toggle", /.*if.*\(\!this\._fullScrToggler\).*\n.*\n.*\n.*\n.*\}/, function() { if (!this._eventLoaded) { // the equivalent to "if (!this._fullScrToggler)" diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index fc0a667..b32eb9b 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -44,15 +44,15 @@ var tabutils = { }); } - let os = Services.appinfo.OS; //WINNT, Linux or Darwin - let version = parseFloat(Services.appinfo.version); - document.documentElement.setAttribute("OS", os); + this.fxOnOS = Services.appinfo.OS; //WINNT, Linux or Darwin + this.fxVersion = parseFloat(Services.appinfo.version); + document.documentElement.setAttribute("OS", this.FxOnOS); document.documentElement.setAttribute("v4", true); document.documentElement.setAttribute("v6", true); document.documentElement.setAttribute("v14", true); document.documentElement.setAttribute("v17", true); - document.documentElement.setAttribute("v29", version >= 29.0); - document.documentElement.setAttribute("v31", version >= 31.0); + document.documentElement.setAttribute("v29", this.fxVersion >= 29.0); + document.documentElement.setAttribute("v31", this.fxVersion >= 31.0); gBrowser.mTabContainer._originalAdjustTabstripFunc = gBrowser.mTabContainer.adjustTabstrip; gBrowser.mTabContainer.adjustTabstrip = function adjustTabstrip() { @@ -1601,7 +1601,7 @@ tabutils._bookmarkTabs = function() { PlacesCommandHook.bookmarkPage(aTabs[0].linkedBrowser, PlacesUtils.bookmarksMenuFolderId, true); }; - if (parseFloat(Services.appinfo.version) < 40) { // https://hg.mozilla.org/mozilla-central/diff/d84b62b367b4/browser/base/content/browser-places.js + if (tabutils.fxVersion < 40) { // https://hg.mozilla.org/mozilla-central/diff/d84b62b367b4/browser/base/content/browser-places.js TU_hookCode("PlacesCommandHook.bookmarkPage", [/(?=.*(createItem|PlacesCreateBookmarkTransaction).*)/, function() { var annos = [descAnno]; From 3d86a3ba673ba7dff310443fcfc216a9c0d7c19c Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Fri, 3 Jul 2015 10:56:00 +0800 Subject: [PATCH 048/116] Bump 2015.07.03.1 --- install.rdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.rdf b/install.rdf index 2dccaa8..2673dd9 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2015.07.03 + 1.5.2015.07.03.1 YFdyh000 ithinc (Former author) Phil Tsarik From 2ab6d2c6545481501606bc4c67e45d768f7bfab5 Mon Sep 17 00:00:00 2001 From: Attack Helicopter Date: Sun, 5 Jul 2015 20:16:30 +0500 Subject: [PATCH 049/116] Fix empty pinned tabs styling --- chrome/skin/tabutils.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/skin/tabutils.css b/chrome/skin/tabutils.css index 6af586a..43a4203 100644 --- a/chrome/skin/tabutils.css +++ b/chrome/skin/tabutils.css @@ -129,9 +129,9 @@ menuseparator:last-child { position: relative; } -#PinnedTabsBar:empty > *, -#PinnedTabsBarItems:empty { - display: none; +#PinnedTabsBar:empty { + -moz-padding-end: 0; + -moz-padding-start: 0; } .tabbrowser-tabs[multirow]:not([showPhantom="true"]) #PinnedTabsBar, From 8dcdc9e86c4dfa159f801827adcde8a92452a6fa Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 6 Jul 2015 01:22:07 +0800 Subject: [PATCH 050/116] Bump to 2015.07.06 --- install.rdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.rdf b/install.rdf index 2673dd9..82d2298 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2015.07.03.1 + 1.5.2015.07.06 YFdyh000 ithinc (Former author) Phil Tsarik From b3c777c9693c313991989921fc6fd71e5c929335 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Fri, 17 Jul 2015 08:57:29 +0800 Subject: [PATCH 051/116] Fix the Statusbar buttons icon wrong in Fx29+ (Australis) Tested on Fx28/29/39/40; on Win8.1 and Linux --- chrome/skin/tabutils_fx29.css | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/chrome/skin/tabutils_fx29.css b/chrome/skin/tabutils_fx29.css index 1b974c9..cc0ab69 100644 --- a/chrome/skin/tabutils_fx29.css +++ b/chrome/skin/tabutils_fx29.css @@ -9,3 +9,14 @@ window[v29="true"]:not([OS="Linux"]) #nav-bar #closetab-button .toolbarbutton-ic width: 32px; height: 24px; } + +/* Statusbar buttons */ +window[v29="true"] #statusbar-openintab { + -moz-image-region: rect(0px, 360px, 18px, 342px); +} +window[v29="true"] #statusbar-loadinbackground { + -moz-image-region: rect(0px, 54px, 18px, 36px); +} +window[v29="true"] #statusbar-loadinforeground { + -moz-image-region: rect(0px, 72px, 18px, 54px); +} From db510a753e12d5f8c538dd1c1ce9c2fa8dcd4c88 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sat, 18 Jul 2015 15:22:15 +0800 Subject: [PATCH 052/116] convert status_buttons to toolbar_buttons --- chrome/content/tabutils.xul | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/chrome/content/tabutils.xul b/chrome/content/tabutils.xul index c5d4634..e846833 100644 --- a/chrome/content/tabutils.xul +++ b/chrome/content/tabutils.xul @@ -101,17 +101,6 @@ onpopupshowing="try {BookmarksEventHandler.onPopupShowing(event);} catch (e) {this.parentNode._placesView || new PlacesMenu(event, this.getAttribute('place'));}" tooltip="bhTooltip" popupsinherittooltip="true"/> - - - - - - - - - - - @@ -428,25 +417,22 @@ \ No newline at end of file From 065453117c0154b9db36b24adeb41efbff67f02a Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 11 Jan 2016 14:45:59 +0800 Subject: [PATCH 064/116] Fix SyntaxError: missing ] after element list tabutils.js:2396:28, #67 --- chrome/content/tabutils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 51c133c..ac25c62 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -2393,7 +2393,7 @@ tabutils._miscFeatures = function() { TU_hookCode("openGMarkLabelInTabs", [/.*openUILinkIn.*/, ""], [/(?=.*(labelArray)(?![\s\S]*\1))/, function() { - var urls = [label.url for (label of labelArray)]; + var urls = [for (label of labelArray) label.url]; var loadInBackground = TU_getPref("browser.tabs.loadBookmarksInBackground"); gBrowser.loadTabs(urls, loadInBackground, false); }] From bf66b2693e2958bd31b57f29895a3886dc2c0446 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 11 Jan 2016 15:02:58 +0800 Subject: [PATCH 065/116] Reduce burrs for Undo button in dark theme, #4 --- chrome/skin/toolbar_Fx4.png | Bin 524 -> 583 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/chrome/skin/toolbar_Fx4.png b/chrome/skin/toolbar_Fx4.png index c3d109f3ed4bb56f056e4bbd35a6664b975cb81f..e7aa3affbea250fe73d3d7af6d3c06f0da22716e 100644 GIT binary patch delta 559 zcmV+~0?_@81jhuBBYyw{XF*Lt006O%3;baP00009a7bBm000ic000ic0Tn1pfB*mh z7<5HgbW?9;ba!ELWdLwtX>N2bZe?^JG%heMHvEiZ-v9ss#Ysd#R5(w~kSTJZ_)U$otw{Oq)d*AnYE&sP5+$V*BmyticL|GCTAEJu~Mn_fJu&Nlz@TLzr<5D zf_q-)^=_S`(|uB)|&eFg7;5+4a-9hIUmuzfplT2@*hF`L> zo~P0{CX+AX5eo<<(rB?1JJtQ(V}1Sh9X(-Un49S0MAHR~>=wpao`8UyoPF*;o4x%8 xZ>tBq$|w~G8Y$vtjyIJ$^@B$LkbfwPLn17A==)EG4ybz?B78&-aVzgKsSRE)UL zo7~;GzkAMeES7)z6iX%kjIbhJ`ALg(U#yy~Ox>#fG z>LL@<1zf&C9K9;LtxnRJY-6lVKt4T5f8->-;Snxhzg1WK;o}<7WQK$OAu+0*dk-FN zjP37~Q4A9;F@J^{OViaCq&mA$SG>CRS#){~r#DD+G_^6*B6ZO1*YFI4I1&tVs4qbC zUMt1gT-}4hg&Evx1Y5UvYg?Ybb_4IAL5EY`8Z=d?iVWk(qWeEa*4MvUJ!%NQo*7aUED}2kCB?&8iq*4F?002ovPDHLkV1mH%>f8VT From 8153e2da74b260a62521402360e89f7fe599b541 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 20 Mar 2016 03:44:56 +0800 Subject: [PATCH 066/116] [Fix] Use "new RegExp" instead of deprecated flags for string.replace() https://bugzilla.mozilla.org/show_bug.cgi?id=1245801 --- chrome/content/tabutils-mt.js | 4 ++-- chrome/content/tabutils-st.js | 2 +- chrome/content/tabutils.js | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/chrome/content/tabutils-mt.js b/chrome/content/tabutils-mt.js index 3906266..e6ab93a 100644 --- a/chrome/content/tabutils-mt.js +++ b/chrome/content/tabutils-mt.js @@ -42,8 +42,8 @@ tabutils._multirowTabs = function() { }, false); TU_hookCode("gBrowser.mTabContainer._getDropIndex", - [/event.screenX.*width \/ 2/g, function(s) s + " && " + s.replace("screenX", "screenY", "g").replace("width / 2", "height") - + " || " + s.replace("screenX", "screenY", "g").replace("width / 2", "height * 0")] + [/event.screenX.*width \/ 2/g, function(s) s + " && " + s.replace(new RegExp("screenX", "g"), "screenY").replace("width / 2", "height") + + " || " + s.replace(new RegExp("screenX", "g"), "screenY").replace("width / 2", "height * 0")] ); tabutils.addEventListener(gBrowser.mTabContainer, "dragover", function(event) { diff --git a/chrome/content/tabutils-st.js b/chrome/content/tabutils-st.js index cce17de..fa4f8fc 100644 --- a/chrome/content/tabutils-st.js +++ b/chrome/content/tabutils-st.js @@ -519,7 +519,7 @@ tabutils._stackTabs = function() { event.preventDefault() : this.siblingTabsOf($1).map(function($1) ($1.hasAttribute("group-selected") ? "> " : "# ") + $0).join("\n") : $0 - }).toString().replace(/^.*{|}$/g, "").replace("$0", s, "g").replace("$1", s1, "g")); + }).toString().replace(/^.*{|}$/g, "").replace(new RegExp("$0", "g"), s).replace(new RegExp("$1", "g"), s1)); gBrowser._setMenuitemAttributes = function _setMenuitemAttributes(aItem, aTab) { ["label", "crop", "image"].forEach(function(aProp) { diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index ac25c62..8582629 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -1395,7 +1395,7 @@ tabutils._renameTab = function() { $0 if (aTitles && aTitles[$2]) $1.setAttribute("title", aTitles[$2]); - }).toString().replace(/^.*{|}$/g, "").replace("$0", s).replace("$1", s1, "g").replace("$2", s2, "g")] + }).toString().replace(/^.*{|}$/g, "").replace("$0", s).replace(new RegExp("$1", "g"), s1).replace(new RegExp("$2", "g"), s2)] ); }; @@ -1654,7 +1654,7 @@ tabutils._bookmarkTabs = function() { $1.linkedBrowser.stop(); tabutils._ss.setTabState($1, PlacesUtils.annotations.getItemAnnotation(aItemIds[$2], "bookmarkProperties/tabState")); } - }).toString().replace(/^.*{|}$/g, "").replace("$0", s).replace("$1", s1, "g").replace("$2", s2, "g")] + }).toString().replace(/^.*{|}$/g, "").replace("$0", s).replace(new RegExp("$1", "g"), s1).replace(new RegExp("$2", "g"), s2)] ); }; @@ -2963,7 +2963,7 @@ tabutils._tabPrefObserver = { if (!aData.startsWith("extensions.tabutils.")) return; - let name = aData.slice(20).replace(".", "_", "g"); + let name = aData.slice(20).replace(new RegExp("." ,"g"), "_"); if (name in this) { this[name](); return; @@ -2984,9 +2984,9 @@ tabutils._tabPrefObserver = { return; this.cssRules[prefName] = { - tab: tabutils.insertRule(this.tabSelector.replace('#Selector#', selector, 'g') + '{}'), - text: tabutils.insertRule(this.textSelector.replace('#Selector#', selector, 'g') + '{}'), - bg: tabutils.insertRule(this.bgSelector.replace('#Selector#', selector, 'g') + '{}') + tab: tabutils.insertRule(this.tabSelector.replace(new RegExp('#Selector#', 'g'), selector) + '{}'), + text: tabutils.insertRule(this.textSelector.replace(new RegExp('#Selector#', 'g'), selector) + '{}'), + bg: tabutils.insertRule(this.bgSelector.replace(new RegExp('#Selector#', 'g'), selector) + '{}') }; } From d88680020dee0c071eee7aefe779f7be939ec0d7 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 20 Mar 2016 04:36:32 +0800 Subject: [PATCH 067/116] [workaround] Avoid Bookmark Properties dialog appears as blank MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * The disable datetime as title for "Bookmark All Tabs鈥" --- chrome/content/bookmarkProperties.xul | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/bookmarkProperties.xul b/chrome/content/bookmarkProperties.xul index b0be7f0..b8d2636 100644 --- a/chrome/content/bookmarkProperties.xul +++ b/chrome/content/bookmarkProperties.xul @@ -3,9 +3,9 @@ From 2aa55a4ca5783bb46e91a2d9f88a00ff825c4fee Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 20 Mar 2016 11:49:52 +0800 Subject: [PATCH 070/116] [Fix] prevent tooltip of tabs become null string after changes to "new RegExp" * I don't know the reason, but it's baffling not work if use $0 and $1. --- chrome/content/tabutils-st.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chrome/content/tabutils-st.js b/chrome/content/tabutils-st.js index fa4f8fc..b7be41a 100644 --- a/chrome/content/tabutils-st.js +++ b/chrome/content/tabutils-st.js @@ -511,15 +511,15 @@ tabutils._stackTabs = function() { TU_hookCode("gBrowser.mTabContainer._selectNewTab", "aNewTab.hidden", "$& || aNewTab.collapsed"); TU_hookCode("gBrowser.createTooltip", /(tab|tn).getAttribute\("label"\)/, function(s, s1) (function() { - $1.mOverTwisty ? $1.hasAttribute("group-collapsed") ? + a1.mOverTwisty ? a1.hasAttribute("group-collapsed") ? document.getElementById("context_collapseStack").getAttribute("label_expand") : document.getElementById("context_collapseStack").getAttribute("label_collapse") - : this.isCollapsedStack($1) ? + : this.isCollapsedStack(a1) ? TU_getPref("extensions.tabutils.mouseHoverPopup", true) ? event.preventDefault() : - this.siblingTabsOf($1).map(function($1) ($1.hasAttribute("group-selected") ? "> " : "# ") + $0).join("\n") : - $0 - }).toString().replace(/^.*{|}$/g, "").replace(new RegExp("$0", "g"), s).replace(new RegExp("$1", "g"), s1)); + this.siblingTabsOf(a1).map(function(a1) (a1.hasAttribute("group-selected") ? "> " : "# ") + a0).join("\n") : + a0 + }).toString().replace(/^.*{|}$/g, "").replace(/a0/g, s).replace(/a1/g, s1)); gBrowser._setMenuitemAttributes = function _setMenuitemAttributes(aItem, aTab) { ["label", "crop", "image"].forEach(function(aProp) { From 446e2e0f63adfac0abf637f401554b3451426620 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 20 Mar 2016 12:12:39 +0800 Subject: [PATCH 071/116] [Fix] Adapt to new _tabListeners and _tabFilters Map objects in Fx46+ * https://bugzilla.mozilla.org/show_bug.cgi?id=1238685 --- chrome/content/tabutils.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 8582629..2db18e1 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -29,7 +29,15 @@ var tabutils = { window.addEventListener("load", this, false); window.addEventListener("unload", this, false); - if (gBrowser.mTabListeners.length > 0) { // Bug 463384 [Fx5] + if (typeof gBrowser._tabListeners === "object") { // Bug 1238685 [Fx46] + let tabListener = gBrowser._tabListeners.values().next().value; + gBrowser.browsers[0].webProgress.removeProgressListener(gBrowser._tabFilters.values().next().value); + gBrowser._tabFilters.values().next().value.removeProgressListener(gBrowser._tabListeners.values().next().value); + gBrowser._tabListeners.values().next().value = gBrowser.mTabProgressListener(tabListener.mTab, tabListener.mBrowser, tabListener.mBlank); + gBrowser._tabFilters.values().next().value.addProgressListener(gBrowser._tabListeners.values().next().value, Ci.nsIWebProgress.NOTIFY_ALL); + gBrowser.browsers[0].webProgress.addProgressListener(gBrowser._tabFilters.values().next().value, Ci.nsIWebProgress.NOTIFY_ALL); + } + else if (gBrowser.mTabListeners.length > 0) { // Bug 463384 [Fx5] let tabListener = gBrowser.mTabListeners[0]; gBrowser.browsers[0].webProgress.removeProgressListener(gBrowser.mTabFilters[0]); gBrowser.mTabFilters[0].removeProgressListener(gBrowser.mTabListeners[0]); From 114d23cad988197c6dadf42c3c2e23375e4a9038 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 20 Mar 2016 12:32:01 +0800 Subject: [PATCH 072/116] [Fix] _setEffectAllowedForDataTransfer changed in Fx44+ * The tabDragIndicator is still invisible when extensions.tabutils.disableTabMoveAnimation = true. #76 * https://bugzilla.mozilla.org/show_bug.cgi?id=1207594 --- chrome/content/tabutils-mt.js | 2 +- chrome/content/tabutils.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/chrome/content/tabutils-mt.js b/chrome/content/tabutils-mt.js index e6ab93a..a74c755 100644 --- a/chrome/content/tabutils-mt.js +++ b/chrome/content/tabutils-mt.js @@ -75,7 +75,7 @@ tabutils._multirowTabs = function() { if (TU_getPref("extensions.tabutils.disableTabMoveAnimation", true)) { TU_hookFunc(arguments.callee.caller.toString().match(/^.*{|var (ind|tabStrip|ltr).*|var pixelsToScroll[\s\S]*$/g).join("\n"), [/.*scrollByPixels.*/, ";"], - [/.*effects == "move"[\s\S]*?(?=var (newIndex|scrollRect|rect))/, ""] + [/.*effects == "move"[\s\S]*?(?=var (newIndex|scrollRect|rect))/, ""] // needs fix ).apply(this, arguments); return; } diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 2db18e1..b1b113a 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -1902,7 +1902,9 @@ tabutils._multiTabHandler = function() { } }, true); - TU_hookCode("gBrowser.mTabContainer._setEffectAllowedForDataTransfer", + TU_hookCode(typeof gBrowser.mTabContainer._setEffectAllowedForDataTransfer === 'function' ? + "gBrowser.mTabContainer._setEffectAllowedForDataTransfer" : // Firefox 43 and older + "gBrowser.mTabContainer._getDropEffectForTabDrag", // Firefox 44 and later ["dt.mozItemCount > 1", "false"] ); From 2ae164808e4e90ce3d0d019f32ee5b6fd9532052 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 20 Mar 2016 13:19:12 +0800 Subject: [PATCH 073/116] [Fix-follow] Fix tab counter become invisible after "new RegExp" * This may have an escape changes when replace with flags to replace with RegExp. --- chrome/content/tabutils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index b1b113a..0747bdf 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -2973,7 +2973,7 @@ tabutils._tabPrefObserver = { if (!aData.startsWith("extensions.tabutils.")) return; - let name = aData.slice(20).replace(new RegExp("." ,"g"), "_"); + let name = aData.slice(20).replace(/\./g, "_"); if (name in this) { this[name](); return; From 9d157abe5566d41c904663a4e1af7171dc2ed15c Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 20 Mar 2016 13:21:42 +0800 Subject: [PATCH 074/116] [Fix-follow] replace "new RegExp" to /text/g form * # and / characters should not need to escape. --- chrome/content/tabutils-mt.js | 4 ++-- chrome/content/tabutils.js | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/chrome/content/tabutils-mt.js b/chrome/content/tabutils-mt.js index a74c755..92d92f7 100644 --- a/chrome/content/tabutils-mt.js +++ b/chrome/content/tabutils-mt.js @@ -42,8 +42,8 @@ tabutils._multirowTabs = function() { }, false); TU_hookCode("gBrowser.mTabContainer._getDropIndex", - [/event.screenX.*width \/ 2/g, function(s) s + " && " + s.replace(new RegExp("screenX", "g"), "screenY").replace("width / 2", "height") - + " || " + s.replace(new RegExp("screenX", "g"), "screenY").replace("width / 2", "height * 0")] + [/event.screenX.*width \/ 2/g, function(s) s + " && " + s.replace(/screenX/g, "screenY").replace("width / 2", "height") + + " || " + s.replace(/screenX/g, "screenY").replace("width / 2", "height * 0")] ); tabutils.addEventListener(gBrowser.mTabContainer, "dragover", function(event) { diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 0747bdf..9b62238 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -1403,7 +1403,7 @@ tabutils._renameTab = function() { $0 if (aTitles && aTitles[$2]) $1.setAttribute("title", aTitles[$2]); - }).toString().replace(/^.*{|}$/g, "").replace("$0", s).replace(new RegExp("$1", "g"), s1).replace(new RegExp("$2", "g"), s2)] + }).toString().replace(/^.*{|}$/g, "").replace("$0", s).replace(/$1/g, s1).replace(/$2/g, s2)] ); }; @@ -1662,7 +1662,7 @@ tabutils._bookmarkTabs = function() { $1.linkedBrowser.stop(); tabutils._ss.setTabState($1, PlacesUtils.annotations.getItemAnnotation(aItemIds[$2], "bookmarkProperties/tabState")); } - }).toString().replace(/^.*{|}$/g, "").replace("$0", s).replace(new RegExp("$1", "g"), s1).replace(new RegExp("$2", "g"), s2)] + }).toString().replace(/^.*{|}$/g, "").replace("$0", s).replace(/$1/g, s1).replace(/$2/g, s2)] ); }; @@ -2994,9 +2994,9 @@ tabutils._tabPrefObserver = { return; this.cssRules[prefName] = { - tab: tabutils.insertRule(this.tabSelector.replace(new RegExp('#Selector#', 'g'), selector) + '{}'), - text: tabutils.insertRule(this.textSelector.replace(new RegExp('#Selector#', 'g'), selector) + '{}'), - bg: tabutils.insertRule(this.bgSelector.replace(new RegExp('#Selector#', 'g'), selector) + '{}') + tab: tabutils.insertRule(this.tabSelector.replace(/#Selector#/g, selector) + '{}'), + text: tabutils.insertRule(this.textSelector.replace(/#Selector#/g, selector) + '{}'), + bg: tabutils.insertRule(this.bgSelector.replace(/#Selector#/g, selector) + '{}') }; } From 11cb150c2e566983e8cdd16536211c84d8eeb78e Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 20 Mar 2016 13:39:03 +0800 Subject: [PATCH 075/116] Bump 2016.03.20 --- install.rdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.rdf b/install.rdf index a2dade2..9b64a5c 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2015.09.12.1-let-fixed + 1.5.2016.03.20 YFdyh000 ithinc (Former author) Phil Tsarik From e34ab33ba18491ff2a27dbe9317d297bbcf8500d Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Mon, 21 Mar 2016 18:02:15 +0800 Subject: [PATCH 076/116] Use a high-DPI resource for Undo closed tab button. #4 --- chrome/skin/toolbar_Fx4.png | Bin 583 -> 2098 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/chrome/skin/toolbar_Fx4.png b/chrome/skin/toolbar_Fx4.png index e7aa3affbea250fe73d3d7af6d3c06f0da22716e..dd864bc0170e06bd0fd64b077351e381a26c829e 100644 GIT binary patch literal 2098 zcmYjRdpHy98(xPIIYbGGPU<74(h|~voR4D;a~Lyo*v2rkF+137(`IeXr^!duhn7M_ z@=;P@D2IefD9WiQ)u-gQU%o%S=epked9LTWpZk8^>w2%319r8Om)#=^00872?5#Z{ z*+z0~w{4N&jmMSs0KjHFu(Rj?o9n*=ioi&+8#MSgBAmSfJ^VwxgHY~%AsYm+FCvwn zz5Myh2Eo-QIFdj|MiFsI?C_XG94RH9!YU{(f7(AZJTmtB&7`v@4D1`S`s0U$@9u}( z5OMK=O9nUUe>>hm64U=SB~w0dGzL#0&^RPIhn^~M_6`!{6xGx>xp)UP-n$R>MXs%_ zId}v}6r4Q+|EngcojhSUG8>MHLq-z3;b=522}fdK3AC_iA|xQp)dvoNg~wCbe_j)n zRo*NvtMmy*U#q$)nR4<9lvpo*`XsrjL}vqk3kFK;Bm_)64HZjvg22MC34TZ{0*z1R zW`{%)Bur9D8jF|B&n;%AWlHoj^Gg`qbclZ_EIhjE)@>K>K#zdX2OXWo<&{smdwoN& zZ>MKA)_yfU;Rp$E^9@N(%S%k*(|P$RfjEVq~blPjmI_*Uw9f3-71i^mlhZYHz+>Q+=)cGM_<<^n$n_K6F>( z(Psbvc*4Qj(i7UgFceB01*^5iS~ZV)kC+obps$Nx{SE_}W?g!^zM-k8aq#OBq4W$) zRd&HKXkmVxn>DjM^+r_?t`kicfuVDxifvft<>HZ zqiI9!5K=^-3|}**93{?b=>+HLWyHj@GJ$r_jrQ;v4NK^AkTdJxew8I@5U0LIRBqF* z&_hhNwATsS&@VBq99yux5E^US2% z1N7?iaYenZO`RY8%v+J$fX3y@G+J%n3eo@o7i-&1ZS@|6iGJ>^Vx=HEubWfpp zc`GueE7$Z~1w&Ep>cbd2sR0kr)ZJIkZDv1nYVYq-SkEd|ryUva!w0BDfKG4 zuu|%)#s}}PXIl!i*5~97W7j#e2P13^pTHY#q;Wu-{t86 zKq}UBGm6!(ooRMl&waSYn!z!{qrHmkj0TemfYwnpjld>@Z(EKh5gc-#%`4ngbUMIO zE-08|I+_^j-hkG}J$*LnTF{YD{0GpXTGU6^H-D*#e|UN^x_2+ktSI}Hnv4>ByR+GF z;aadMY)`F@=&d}Vb#-~BB9Va75pNc?v}k_c^|+8duhBHJAUm&oYp|BzKhQC>HdC7z zWfN|J-m-wQPV?j&^;HdeGZBRInc7F}YZ7Xk5km#XHBRx(>d+2EW2LXh)MQdFhK|0} zWQ$<15tVwG5A|w?fCsC=wL70H;mic*l({{4gb^F_ujvLm40W8#Krt9138 zAIb^|NeKFR@m!uJ$6s%_$Ht`XlHBR3cff57v4xk}LR+>&(lvddcOt@eHVB7ln)tY9 z7+n6N>_#gZ#4CC3Bp<(>JKdu<>PZatPn)2vYvfQj3D2qwm@GP7mHg%a2OC%GYAZP7 Ee`ur;L;wH) literal 583 zcmV-N0=WH&P)N2bZe?^J zG%heMHvEiZ-v9ss#Ysd#R5(w~kjW z=K6X=-M)h?JAcDg%{BB$9LeG0*1#}>4{d}(5vsLX?_xuvcJAA!dA?|HcVrytk%w{D z95%O#O;M31XBZfde0qwx=qkRYWm+H4+syBqEn=xGkNt~cR6E7ec4yewq=IUggp%uM@eIz{AhpBe zHgmIeB07D6>|UIVul#Wv;b4C+_S z51;TZ7);2@%|OL+O=Orr5#3)u{k^WPepo$P7{8t*S15G{U3|F|nH-9cn}3*^tyA=6 z6HRROSKvG4cilnf7nf{oZIeuIpoU+vvYw~XI3|-X;t>l7CDLfI6g$=Z-eZ0J_8mQ8 zVwjug;zZL0jO-T1TAqM_oSc2`KbyV%25+keyvh{_8Y$vtjyIJ$^@B$LkbfwP Date: Mon, 21 Mar 2016 22:06:51 +0800 Subject: [PATCH 077/116] [Fix-follow] fix some broken after "new RegExp" * e.g. Open All in Tabs open a tab only Since being broken. * $ must be escape since changes to RegExp, from string.replace flags "g". --- chrome/content/tabutils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 9b62238..b3cdffb 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -1403,7 +1403,7 @@ tabutils._renameTab = function() { $0 if (aTitles && aTitles[$2]) $1.setAttribute("title", aTitles[$2]); - }).toString().replace(/^.*{|}$/g, "").replace("$0", s).replace(/$1/g, s1).replace(/$2/g, s2)] + }).toString().replace(/^.*{|}$/g, "").replace("$0", s).replace(/\$1/g, s1).replace(/\$2/g, s2)] ); }; @@ -1662,7 +1662,7 @@ tabutils._bookmarkTabs = function() { $1.linkedBrowser.stop(); tabutils._ss.setTabState($1, PlacesUtils.annotations.getItemAnnotation(aItemIds[$2], "bookmarkProperties/tabState")); } - }).toString().replace(/^.*{|}$/g, "").replace("$0", s).replace(/$1/g, s1).replace(/$2/g, s2)] + }).toString().replace(/^.*{|}$/g, "").replace("$0", s).replace(/\$1/g, s1).replace(/\$2/g, s2)] ); }; From 31e077a15015a8a452cc4f95944247a72e570d85 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Wed, 23 Mar 2016 00:06:51 +0800 Subject: [PATCH 078/116] [Fix-follow] Fix compatibility broken for Fx28 and earlier, including Pale Moon. see #67. fix #85. --- chrome/content/tabutils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index b3cdffb..39b00c3 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -2403,10 +2403,14 @@ tabutils._miscFeatures = function() { TU_hookCode("openGMarkLabelInTabs", [/.*openUILinkIn.*/, ""], [/(?=.*(labelArray)(?![\s\S]*\1))/, function() { - var urls = [for (label of labelArray) label.url]; + var urls = $1; var loadInBackground = TU_getPref("browser.tabs.loadBookmarksInBackground"); gBrowser.loadTabs(urls, loadInBackground, false); - }] + }.toString().replace("$1", + tabutils.fxVersion >= 30.0 ? + "[for (label of labelArray) label.url]" : // Bug 979865 [Fx30] support + "[label.url for (label of labelArray)]" // Bug 1220564 [Fx46] removed + )] ); TU_hookCode("BookmarkingUI" in window ? "BookmarkingUI._updateStar" : "PlacesStarButton._updateStateInternal", /(?=.*this._itemIds.*)/, function() { //Bug 650527 From a1a7bf56253f467ed5d14c899a5af93803defb69 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Wed, 23 Mar 2016 01:37:32 +0800 Subject: [PATCH 079/116] [Fix] Fix the "tab-twisty" (tab stacking) isn't shown in Fx45+. fix #79 * https://bugzilla.mozilla.org/show_bug.cgi?id=1191230 --- chrome/content/tabutils.js | 1 + chrome/content/tabutils.xul | 1 + chrome/skin/tabutils_fx45.css | 8 ++++++++ 3 files changed, 10 insertions(+) create mode 100644 chrome/skin/tabutils_fx45.css diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 39b00c3..a9108f1 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -61,6 +61,7 @@ var tabutils = { document.documentElement.setAttribute("v17", true); document.documentElement.setAttribute("v29", this.fxVersion >= 29.0); document.documentElement.setAttribute("v31", this.fxVersion >= 31.0); + document.documentElement.setAttribute("v45", this.fxVersion >= 45.0); gBrowser.mTabContainer._originalAdjustTabstripFunc = gBrowser.mTabContainer.adjustTabstrip; gBrowser.mTabContainer.adjustTabstrip = function adjustTabstrip() { diff --git a/chrome/content/tabutils.xul b/chrome/content/tabutils.xul index 4bde359..690019d 100644 --- a/chrome/content/tabutils.xul +++ b/chrome/content/tabutils.xul @@ -5,6 +5,7 @@ + diff --git a/chrome/skin/tabutils_fx45.css b/chrome/skin/tabutils_fx45.css new file mode 100644 index 0000000..a7d33ff --- /dev/null +++ b/chrome/skin/tabutils_fx45.css @@ -0,0 +1,8 @@ +/* Tab Stacking */ +window[v45="true"] .tabbrowser-tab[group-selected]:not([group-counter="1"])[group-collapsed] .tab-twisty { + list-style-image: url("chrome://global/skin/tree/twisty.svg#clsd"); +} + +window[v45="true"] .tabbrowser-tab[group-first]:not([group-last]):not([group-collapsed]) .tab-twisty { + list-style-image: url("chrome://global/skin/tree/twisty.svg#open"); +} From 3d7cdcea0724ec9481f54ea00cd5dac3d92588fe Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Wed, 23 Mar 2016 21:52:32 +0800 Subject: [PATCH 080/116] Revert "Use a high-DPI resource for Undo closed tab button. #4" This reverts commit e34ab33ba18491ff2a27dbe9317d297bbcf8500d. * The icon size requires some CSS adaptation for Fx34 & Fx28. --- chrome/skin/toolbar_Fx4.png | Bin 2098 -> 583 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/chrome/skin/toolbar_Fx4.png b/chrome/skin/toolbar_Fx4.png index dd864bc0170e06bd0fd64b077351e381a26c829e..e7aa3affbea250fe73d3d7af6d3c06f0da22716e 100644 GIT binary patch literal 583 zcmV-N0=WH&P)N2bZe?^J zG%heMHvEiZ-v9ss#Ysd#R5(w~kjW z=K6X=-M)h?JAcDg%{BB$9LeG0*1#}>4{d}(5vsLX?_xuvcJAA!dA?|HcVrytk%w{D z95%O#O;M31XBZfde0qwx=qkRYWm+H4+syBqEn=xGkNt~cR6E7ec4yewq=IUggp%uM@eIz{AhpBe zHgmIeB07D6>|UIVul#Wv;b4C+_S z51;TZ7);2@%|OL+O=Orr5#3)u{k^WPepo$P7{8t*S15G{U3|F|nH-9cn}3*^tyA=6 z6HRROSKvG4cilnf7nf{oZIeuIpoU+vvYw~XI3|-X;t>l7CDLfI6g$=Z-eZ0J_8mQ8 zVwjug;zZL0jO-T1TAqM_oSc2`KbyV%25+keyvh{_8Y$vtjyIJ$^@B$LkbfwPw2%319r8Om)#=^00872?5#Z{ z*+z0~w{4N&jmMSs0KjHFu(Rj?o9n*=ioi&+8#MSgBAmSfJ^VwxgHY~%AsYm+FCvwn zz5Myh2Eo-QIFdj|MiFsI?C_XG94RH9!YU{(f7(AZJTmtB&7`v@4D1`S`s0U$@9u}( z5OMK=O9nUUe>>hm64U=SB~w0dGzL#0&^RPIhn^~M_6`!{6xGx>xp)UP-n$R>MXs%_ zId}v}6r4Q+|EngcojhSUG8>MHLq-z3;b=522}fdK3AC_iA|xQp)dvoNg~wCbe_j)n zRo*NvtMmy*U#q$)nR4<9lvpo*`XsrjL}vqk3kFK;Bm_)64HZjvg22MC34TZ{0*z1R zW`{%)Bur9D8jF|B&n;%AWlHoj^Gg`qbclZ_EIhjE)@>K>K#zdX2OXWo<&{smdwoN& zZ>MKA)_yfU;Rp$E^9@N(%S%k*(|P$RfjEVq~blPjmI_*Uw9f3-71i^mlhZYHz+>Q+=)cGM_<<^n$n_K6F>( z(Psbvc*4Qj(i7UgFceB01*^5iS~ZV)kC+obps$Nx{SE_}W?g!^zM-k8aq#OBq4W$) zRd&HKXkmVxn>DjM^+r_?t`kicfuVDxifvft<>HZ zqiI9!5K=^-3|}**93{?b=>+HLWyHj@GJ$r_jrQ;v4NK^AkTdJxew8I@5U0LIRBqF* z&_hhNwATsS&@VBq99yux5E^US2% z1N7?iaYenZO`RY8%v+J$fX3y@G+J%n3eo@o7i-&1ZS@|6iGJ>^Vx=HEubWfpp zc`GueE7$Z~1w&Ep>cbd2sR0kr)ZJIkZDv1nYVYq-SkEd|ryUva!w0BDfKG4 zuu|%)#s}}PXIl!i*5~97W7j#e2P13^pTHY#q;Wu-{t86 zKq}UBGm6!(ooRMl&waSYn!z!{qrHmkj0TemfYwnpjld>@Z(EKh5gc-#%`4ngbUMIO zE-08|I+_^j-hkG}J$*LnTF{YD{0GpXTGU6^H-D*#e|UN^x_2+ktSI}Hnv4>ByR+GF z;aadMY)`F@=&d}Vb#-~BB9Va75pNc?v}k_c^|+8duhBHJAUm&oYp|BzKhQC>HdC7z zWfN|J-m-wQPV?j&^;HdeGZBRInc7F}YZ7Xk5km#XHBRx(>d+2EW2LXh)MQdFhK|0} zWQ$<15tVwG5A|w?fCsC=wL70H;mic*l({{4gb^F_ujvLm40W8#Krt9138 zAIb^|NeKFR@m!uJ$6s%_$Ht`XlHBR3cff57v4xk}LR+>&(lvddcOt@eHVB7ln)tY9 z7+n6N>_#gZ#4CC3Bp<(>JKdu<>PZatPn)2vYvfQj3D2qwm@GP7mHg%a2OC%GYAZP7 Ee`ur;L;wH) From 994c57305edaa9946642364d842f6ff20cecf9f1 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Wed, 23 Mar 2016 21:54:40 +0800 Subject: [PATCH 081/116] Bump 2016.03.23 --- install.rdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.rdf b/install.rdf index 9b64a5c..a9da2bb 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2016.03.20 + 1.5.2016.03.23 YFdyh000 ithinc (Former author) Phil Tsarik From 5468cb51247c4d649910d96f5cfb6d64926493cf Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 5 Jun 2016 08:33:24 +0800 Subject: [PATCH 082/116] [Fix] Back/forward menu and Session History Menu be broken since Fx43 fix #68 These menu updates slower is the official bug. https://hg.mozilla.org/mozilla-central/rev/ca984908f2e5 [Fx43] --- chrome/content/tabutils.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index a9108f1..108edd7 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -2070,15 +2070,16 @@ tabutils._tabClickingOptions = function() { }; //娴忚鍘嗗彶鑿滃崟 - TU_hookCode("FillHistoryMenu", - ["count <= 1", "count == 0"], - [/(?=var webNav)/, function() { + TU_hookCode("FillHistoryMenu", // Fillin the history menu + ["count <= 1", "count == 0"], // Always show the menu + ["gBrowser.selectedTab", "tab", "g"], // since Bug 1148505 [Fx43]. + [FillHistoryMenu.toString().indexOf("var webNav")>0 ? /(?=var webNav)/ : /(?=let sessionHistory)/, function() { // Bug 1148505 [Fx43]. var tab = document.popupNode; if (!tab || tab.localName != 'tab') tab = gBrowser.selectedTab; aParent.value = tab._tPos; }], - ["gBrowser.webNavigation", "tab.linkedBrowser.webNavigation"] + ["gBrowser.webNavigation", "tab.linkedBrowser.webNavigation"] // Is no longer valid since Bug 1148505 [Fx43]. ); TU_hookCode("gotoHistoryIndex", ["gBrowser.selectedTab", "tab", "g"], From 99186a57beec27ed06a31b3734ff2f9342c99ee9 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 5 Jun 2016 08:35:24 +0800 Subject: [PATCH 083/116] Bump 2016.06.05 --- install.rdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.rdf b/install.rdf index a9da2bb..2ce220e 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2016.03.23 + 1.5.2016.06.05 YFdyh000 ithinc (Former author) Phil Tsarik From abc592071f174c02eb13bb78a8bb7a5cc8e97405 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Wed, 8 Jun 2016 00:44:20 +0800 Subject: [PATCH 084/116] [Fix] gBrowser.mFaviconService has been removed since Fx47, it causes problems if you have configured custom toolbar button fix #89 Bump 2016.06.08 https://hg.mozilla.org/releases/mozilla-release/rev/cbabb4769b50 --- chrome/content/tabutils.js | 3 ++- install.rdf | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 108edd7..55212d8 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -3099,7 +3099,8 @@ tabutils._tabPrefObserver = { if (!button) { button = document.getElementById("nav-bar").appendChild(document.createElement("toolbarbutton")); button.id = RegExp.$1; - button.image = gBrowser.mFaviconService.defaultFavicon.spec; + const FaviconService = Cc["@mozilla.org/browser/favicon-service;1"]. getService(Ci.nsIFaviconService); + button.image = FaviconService.defaultFavicon.spec; button.className = "toolbarbutton-1 chromeclass-toolbar-additional"; button.collapsed = !TU_getPref("extensions.tabutils.button." + RegExp.$1); } diff --git a/install.rdf b/install.rdf index 2ce220e..c397308 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2016.06.05 + 1.5.2016.06.08 YFdyh000 ithinc (Former author) Phil Tsarik From f1248802bc4c011b584cfda2853b533af265869c Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 31 Jul 2016 22:27:27 +0800 Subject: [PATCH 085/116] [Add] "extensions.tabutils.autoCleanupStack". fix #94 --- chrome/content/tabutils-st.js | 4 ++++ defaults/preferences/prefs.js | 1 + 2 files changed, 5 insertions(+) diff --git a/chrome/content/tabutils-st.js b/chrome/content/tabutils-st.js index b7be41a..173de93 100644 --- a/chrome/content/tabutils-st.js +++ b/chrome/content/tabutils-st.js @@ -226,6 +226,10 @@ tabutils._stackTabs = function() { let tabs = this.siblingTabsOf(aTab); if (tabs.length == 0) return; + if (tabs.length == 1 && TU_getPref("extensions.tabutils.autoCleanupStack", false)) { + gBrowser.detachTab(aTab); + return; + } if (typeof aTab == "string") { aTab = tabs[0]; diff --git a/defaults/preferences/prefs.js b/defaults/preferences/prefs.js index db2fd06..a2afcdd 100644 --- a/defaults/preferences/prefs.js +++ b/defaults/preferences/prefs.js @@ -203,6 +203,7 @@ pref("extensions.tabutils.restartAfter", 0); pref("extensions.tabutils.autoStack", false); pref("extensions.tabutils.autoExpandStackOnDragover", false); pref("extensions.tabutils.autoExpandStackAndCollapseOthersOnSelect", true); +pref("extensions.tabutils.autoCleanupStack", false); pref("extensions.tabutils.autoCollapseStackOnBlur", false); pref("extensions.tabutils.autoCollapseNewStack", true); pref("extensions.tabutils.dragToStack", false); From 3821e20ef07f67f16574bf6dba265d479298e740 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 31 Jul 2016 22:43:52 +0800 Subject: [PATCH 086/116] Bump 2016.07.31 --- install.rdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.rdf b/install.rdf index c397308..6d1ccde 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2016.06.08 + 1.5.2016.07.31 YFdyh000 ithinc (Former author) Phil Tsarik From cd8c8c5d680e7c7a380475ba40bb662253dcc5ba Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Tue, 23 Aug 2016 23:16:22 +0800 Subject: [PATCH 087/116] [Fix] mouse scroll to focus tab broken since Fx48, fix #97 https://hg.mozilla.org/integration/mozilla-inbound/rev/f46b25846856 [Fx48] --- chrome/content/tabutils.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 55212d8..28d2027 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -2350,9 +2350,12 @@ tabutils._tabClickingOptions = function() { }, false); //Mouse scroll to select - tabutils.addEventListener(gBrowser.mTabContainer, 'DOMMouseScroll', function(event) { + tabutils.addEventListener(gBrowser.mTabContainer, 'wheel', function(event) { + let isVertical = Math.abs(event.deltaY) > Math.abs(event.deltaX); + let delta = isVertical ? event.deltaY : event.deltaX; + let scrollByDelta = isVertical && this._isRTLScrollbox ? -delta : delta; if (event.ctrlKey) { - document.getElementById(event.detail < 0 ? "cmd_prevGroup" : "cmd_nextGroup").doCommand(); + document.getElementById(scrollByDelta < 0 ? "cmd_prevGroup" : "cmd_nextGroup").doCommand(); event.stopPropagation(); return; } @@ -2360,7 +2363,7 @@ tabutils._tabClickingOptions = function() { if (event.originalTarget != this.mTabstrip._scrollButtonUp && event.originalTarget != this.mTabstrip._scrollButtonDown && TU_getPref("extensions.tabutils.mouseScrollSelect", false)) { - let scrollDir = event.detail < 0 ^ TU_getPref("extensions.tabutils.mouseScrollSelectDir", false) ? -1 : 1; + let scrollDir = scrollByDelta < 0 ^ TU_getPref("extensions.tabutils.mouseScrollSelectDir", false) ? -1 : 1; this.advanceSelectedTab(scrollDir, TU_getPref("extensions.tabutils.mouseScrollSelectWrap", false)); event.stopPropagation(); } From 557228e4268dfce9596b556ebcc6d1d428423d80 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 25 Dec 2016 04:04:47 +0800 Subject: [PATCH 088/116] [Fix] Enter key on Address bar to open in new tab, since Fx50, fix #115 * https://hg.mozilla.org/integration/fx-team/rev/474f38fc48be#l14.54 [Bug 1180944] --- chrome/content/tabutils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 28d2027..2b37156 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -325,7 +325,7 @@ tabutils._openUILinkInTab = function() { //鍦板潃鏍忓洖杞﹂敭 TU_hookCode("gURLBar.handleCommand", - [/(let altEnter\s*=.+)((aTriggeringEvent)\s*&&\s*(aTriggeringEvent\.altKey)).*;/, function() { + [/(let altEnter\s*=.+)\s*((aTriggeringEvent|event)\s*&&\s*(aTriggeringEvent\.altKey|event\.altKey))\s*&&\s*.*isTabEmpty.*;/, function() { let newTabPref = TU_getPref('extensions.tabutils.openUrlInTab', true); let TU_altEnter = ($2 || newTabPref) && !(($3 ? $4 : false) && newTabPref && TU_getPref('extensions.tabutils.invertAlt', true)); $1TU_altEnter; From 18b2b0941ed0b4ebd8493de7cafa84bf0494db48 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 25 Dec 2016 09:10:01 +0800 Subject: [PATCH 089/116] [Fix] Avoid Bookmark Properties dialog appears as blank since Fx49 https://hg.mozilla.org/integration/fx-team/rev/1affe99093f5 [Bug 446171] --- chrome/content/bookmarkProperties.xul | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/bookmarkProperties.xul b/chrome/content/bookmarkProperties.xul index b8d2636..9133706 100644 --- a/chrome/content/bookmarkProperties.xul +++ b/chrome/content/bookmarkProperties.xul @@ -7,7 +7,7 @@ ['this._strings.getString("bookmarkAllTabsDefault")', "dialogInfo.URIList[0] instanceof Ci.nsIURI ? $& : new Date().toLocaleString()"] );*/ TU_hookCode("BookmarkPropertiesPanel._getTransactionsForURIList", - [/(?=.*_getURITitleFromHistory.*)/, "var annos; if (!(uri instanceof Ci.nsIURI)) [uri, annos] = uri;"], + [/(?=.*(uri\s*instanceof\s*Ci\.nsIURI|_getURITitleFromHistory).*)/, "var annos; if (!(uri instanceof Ci.nsIURI)) [uri, annos] = uri;"], [/title(?=\))/, "$&, null, annos"] ); ]]> From c0f7deaf19ed9cf65db1f87b72e42fbfa9d6de86 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sun, 25 Dec 2016 12:37:27 +0800 Subject: [PATCH 090/116] =?UTF-8?q?[Fix]=20Datetime=20as=20title=20for=20"?= =?UTF-8?q?Bookmark=20All=20Tabs=E2=80=A6"=20now=20works=20for=20Fx44+?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Maybe it's because bug 1202902 land, 'const' is inaccessible within hooked function * fix #65 --- chrome/content/bookmarkProperties.xul | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chrome/content/bookmarkProperties.xul b/chrome/content/bookmarkProperties.xul index 9133706..a731a23 100644 --- a/chrome/content/bookmarkProperties.xul +++ b/chrome/content/bookmarkProperties.xul @@ -3,9 +3,10 @@ diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index 1a3fcc1..f8e2145 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -1645,7 +1645,7 @@ tabutils._bookmarkTabs = function() { ); } - ("abHere2" in window) ? null : + if (!("abHere2" in window)) { // Compatibility with Add Bookmark Here 虏 TU_hookCode("PlacesCommandHook.bookmarkCurrentPages", ["this.uniqueCurrentPages", (function() { !gPrivateBrowsingUI.privateBrowsingEnabled && TU_getPref("extensions.tabutils.bookmarkAllWithHistory", true) ? @@ -1654,6 +1654,7 @@ tabutils._bookmarkTabs = function() { }).toString().replace(/^.*{|}$/g, "")], ["pages.length > 1", "true"] ); + } //Highlight bookmarks with history TU_hookCode("PlacesViewBase.prototype._createMenuItemForPlacesNode", /(?=return element;)/, function() { From 342bc3e54dc92f76d16851125a7e1c8618c9c114 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 9 Mar 2017 07:06:32 +0800 Subject: [PATCH 112/116] [Fix] textStyle of Tabs has broken since Fx53 [Bug 658467] https://hg.mozilla.org/integration/mozilla-inbound/rev/6fddc51e9d15#l3.158 --- chrome/content/tabutils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils.js b/chrome/content/tabutils.js index f8e2145..142927c 100644 --- a/chrome/content/tabutils.js +++ b/chrome/content/tabutils.js @@ -2980,7 +2980,7 @@ tabutils._tabPrefObserver = { '.alltabs-item#Selector#' ].join(), textSelector: [ - '.tabbrowser-tab#Selector# > * > .tab-content > .tab-text', + '.tabbrowser-tab#Selector# > * > .tab-content .tab-text', '.alltabs-item#Selector#' ].join(), bgSelector: [ From 87b5665832ebd82c7b99711d59d180faa293c673 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Sat, 5 Aug 2017 06:43:46 +0800 Subject: [PATCH 113/116] Update README.md add deprecated --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e1276ca..1e3327c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,22 @@ -# Tab Utilities Fixed +# Tab Utilities Fixed (Deprecated) + [Tab Utilities](https://addons.mozilla.org/firefox/addon/tab-utilities/)'s compatibility fixes release. -The project's focused goal: Compatibility fixes for Firefox 28 (orange 'Firefox' button or Pale Moon) to the latest Firefox Beta (for Windows). +The project's focused goal: Compatibility fixes for Firefox 28 (with orange 'Firefox' button or Pale Moon) to the latest Firefox Beta (tested for Windows). Issue reports and patches are welcome. -[new TODO board](https://github.com/yfdyh000/tabutils/projects); +## Deprecated +This project has been deprecated due to the new browser extension standard ([WebExtensions](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions); [W3C](https://browserext.github.io/browserext/); [Terminology](https://wiki.mozilla.org/Add-ons/Terminology)) to Firefox 57 and difficult to maintain, it still has some bugs in the final version, such as full screen support, as well as other quirks. + +If you would, you can continue to report problems (but no guaranteed for repair) or recommend alternatives on the issues. + +### My collections on AMO site +* [WebExtensions for tabs](https://addons.mozilla.org/firefox/collections/yfdyh000/webextensions-for-tabs/) +* [WebExtensions](https://addons.mozilla.org/firefox/collections/yfdyh000/webextensions/) + +## Resources +[newer TODO board](https://github.com/yfdyh000/tabutils/projects); [older TODO and notes](https://github.com/yfdyh000/tabutils/wiki/TODO). [Release versions and notes](https://github.com/yfdyh000/tabutils/releases) < may include the latest unsigned version. From 079d4a17e97dcdd27155a1ab8f3f0c2717d4b4d3 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 17 Aug 2017 23:50:54 +0800 Subject: [PATCH 114/116] [Fix] Tabs tooltip always shown as "Collapse Stack" in Fx55+ https://hg.mozilla.org/releases/mozilla-beta/rev/5d60a973693b73e39d1780fe6e70d531c675635f#l1.32 --- chrome/content/tabutils-st.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/tabutils-st.js b/chrome/content/tabutils-st.js index d5269f3..8d45274 100644 --- a/chrome/content/tabutils-st.js +++ b/chrome/content/tabutils-st.js @@ -514,7 +514,7 @@ tabutils._stackTabs = function() { TU_hookCode("gBrowser.mTabContainer._selectNewTab", "aNewTab.hidden", "$& || aNewTab.collapsed"); - TU_hookCode("gBrowser.createTooltip", /(tab|tn).getAttribute\("label"\)/, function(s, s1) (function() { + TU_hookCode("gBrowser.createTooltip", /(?:tab\._.+)(tab|tn).getAttribute\("label"\)/, function(s, s1) (function() { a1.mOverTwisty ? a1.hasAttribute("group-collapsed") ? document.getElementById("context_collapseStack").getAttribute("label_expand") : document.getElementById("context_collapseStack").getAttribute("label_collapse") From 236fee1b81223c848263a4ced71954d72fb87935 Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Thu, 17 Aug 2017 23:54:33 +0800 Subject: [PATCH 115/116] Set multiprocessCompatible to true, although this support is incomplete, and this may lead to some errors. https://developer.mozilla.org/en-US/Add-ons/Install_Manifests#multiprocessCompatible https://github.com/yfdyh000/tabutils/issues?q=is%3Aopen+is%3Aissue+milestone%3Ae10s --- install.rdf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install.rdf b/install.rdf index c2a4f4b..59f5f2d 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ tabutilsfixed@addon.cn 2 Tab Utilities Fixed - 1.5.2017.02.04 + 1.5.2017.08.17 YFdyh000 ithinc (Former author) Phil Tsarik @@ -32,5 +32,6 @@ false + true \ No newline at end of file From c1a9f054aae6b50dba1d084d55befaebb11edbbf Mon Sep 17 00:00:00 2001 From: YFdyh000 Date: Fri, 18 Aug 2017 00:00:10 +0800 Subject: [PATCH 116/116] Add badges to README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 1e3327c..f24fb2a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ +[![Mozilla Add-on](https://img.shields.io/amo/v/tab-utilities-fixed.svg)](https://addons.mozilla.org/firefox/addon/tab-utilities-fixed/) +[![Mozilla Add-on](https://img.shields.io/amo/d/tab-utilities-fixed.svg)]() +[![Mozilla Add-on](https://img.shields.io/amo/users/tab-utilities-fixed.svg)]() +[![GitHub release](https://img.shields.io/github/release/yfdyh000/tabutils/all.svg)]() + # Tab Utilities Fixed (Deprecated) [Tab Utilities](https://addons.mozilla.org/firefox/addon/tab-utilities/)'s compatibility fixes release.