[Pkg-mozext-commits] [tabmixplus] 13/23: Follow up bug 528005 - Let accel-click and middle-click on the new tab button toggle openTabNext preference [Firefox 51]
David Prévot
taffit at moszumanska.debian.org
Fri Sep 23 03:31:05 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 681dae0b35d9a58563ba010a93e4788f71d800ad
Author: onemen <tabmix.onemen at gmail.com>
Date: Sat Sep 3 15:13:48 2016 +0300
Follow up bug 528005 - Let accel-click and middle-click on the new tab button toggle openTabNext preference [Firefox 51]
---
chrome/content/click/click.js | 2 +-
chrome/content/links/userInterface.js | 31 +++++++++++++++++++++++++++----
chrome/content/minit/tablib.js | 4 ++--
chrome/content/utils.js | 4 +++-
4 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/chrome/content/click/click.js b/chrome/content/click/click.js
index 69784b6..6b6b3a5 100644
--- a/chrome/content/click/click.js
+++ b/chrome/content/click/click.js
@@ -431,7 +431,7 @@ var TabmixContext = {
Tabmix.setItem(newTab, "oncommand", "TMP_BrowserOpenTab();");
} else {
Tabmix.setItem(newTab, "label", newTab.getAttribute("_newtab") + " " + newTab.getAttribute("_afterthis"));
- Tabmix.setItem(newTab, "oncommand", "TMP_BrowserOpenTab(TabContextMenu.contextTab);");
+ Tabmix.setItem(newTab, "oncommand", "TMP_BrowserOpenTab(null, TabContextMenu.contextTab);");
}
// Duplicate Commands
diff --git a/chrome/content/links/userInterface.js b/chrome/content/links/userInterface.js
index 9bd329c..feea839 100644
--- a/chrome/content/links/userInterface.js
+++ b/chrome/content/links/userInterface.js
@@ -34,7 +34,7 @@ Tabmix.openOptionsDialog = function TMP_openDialog(panel) {
// Don't change this function name other extensions using it
// Speed-Dial, Fast-Dial, TabGroupManager
-function TMP_BrowserOpenTab(aTab, replaceLastTab) {
+function TMP_BrowserOpenTab(aEvent, aTab, replaceLastTab) {
var newTabContent = replaceLastTab ? Tabmix.prefs.getIntPref("replaceLastTabWith.type") :
Tabmix.prefs.getIntPref("loadOnNewTab.type");
var url;
@@ -87,9 +87,6 @@ function TMP_BrowserOpenTab(aTab, replaceLastTab) {
if (TabmixTabbar.widthFitTitle && replaceLastTab && !selectedTab.collapsed)
selectedTab.collapsed = true;
- // always select new tab when replacing last tab
- var loadInBackground = replaceLastTab ? false :
- Tabmix.prefs.getBoolPref("loadNewInBackground");
var loadBlank = isBlankPageURL(url);
if (!TabmixSessionManager.isPrivateWindow && replaceLastTab && !loadBlank &&
typeof privateTab == "object") {
@@ -100,8 +97,34 @@ function TMP_BrowserOpenTab(aTab, replaceLastTab) {
}
}
+ // always select new tab when replacing last tab
+ var loadInBackground = replaceLastTab ? false :
+ Tabmix.prefs.getBoolPref("loadNewInBackground");
let baseTab = aTab && aTab.localName == "tab" ? aTab : null;
let openTabNext = baseTab || !replaceLastTab && Tabmix.prefs.getBoolPref("openNewTabNext");
+ // Let accel-click and middle-click on the new tab button toggle openTabNext preference
+ // see bug 528005
+ if (Tabmix.isVersion(510) && aEvent && !aTab && !replaceLastTab &&
+ (aEvent instanceof MouseEvent || aEvent instanceof XULCommandEvent)) {
+ // don't replace 'window' to 'tab' in whereToOpenLink when singleWindowMode is on
+ Tabmix.skipSingleWindowModeCheck = true;
+ let where = whereToOpenLink(aEvent, false, true);
+ Tabmix.skipSingleWindowModeCheck = false;
+ switch (where) {
+ case "tabshifted":
+ loadInBackground = !loadInBackground;
+ /* falls through */
+ case "tab":
+ openTabNext = !openTabNext;
+ break;
+ case "window":
+ if (!Tabmix.getSingleWindowMode()) {
+ openUILinkIn(url, where);
+ return null;
+ }
+ break;
+ }
+ }
TMP_extensionsCompatibility.treeStyleTab.onBeforeNewTabCommand(baseTab || selectedTab, openTabNext);
var newTab = gBrowser.addTab(url, {
charset: loadBlank ? null : gBrowser.selectedBrowser.characterSet,
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 4188969..fd18e64 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -250,7 +250,7 @@ var tablib = { // eslint-disable-line
let code = gBrowser._beginRemoveTab.toString().indexOf(aboutNewtab) > -1 ?
aboutNewtab : aboutBlank;
Tabmix.changeCode(gBrowser, "gBrowser._beginRemoveTab")._replace(
- code, 'TMP_BrowserOpenTab(null, true)'
+ code, 'TMP_BrowserOpenTab(null, null, true)'
).toCode();
}
@@ -881,7 +881,7 @@ var tablib = { // eslint-disable-line
).toCode();
}
- if (Tabmix.isVersion(300)) {
+ if (Tabmix.isVersion(300) && !Tabmix.isVersion(510)) {
Tabmix.changeCode(window, "BrowserOpenNewTabOrWindow")._replace(
'event.shiftKey',
'$& && !Tabmix.singleWindowMode'
diff --git a/chrome/content/utils.js b/chrome/content/utils.js
index ae15a6d..faafbb8 100644
--- a/chrome/content/utils.js
+++ b/chrome/content/utils.js
@@ -62,11 +62,13 @@ var Tabmix = {
return Services.wm.getMostRecentWindow("navigator:browser");
},
+ skipSingleWindowModeCheck: false,
getSingleWindowMode: function TMP_getSingleWindowMode() {
// if we don't have any browser window opened return false
// so we can open new window
- if (!this.getTopWin())
+ if (this.skipSingleWindowModeCheck || !this.getTopWin()) {
return false;
+ }
return this.prefs.getBoolPref("singleWindow");
},
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list