[Pkg-mozext-commits] [tabmixplus] 22/27: Follow up bug 1106101 (landed on Firefox 35) - Cmd/Ctrl-Click and middle-click on a one-off button should open the search in a new tab

David Prévot taffit at moszumanska.debian.org
Fri Dec 26 01:04:31 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository tabmixplus.

commit d7a4632e24cd2be921e1e55b2f2fefc3d8a5d5a8
Author: onemen <tabmix.onemen at gmail.com>
Date:   Sun Dec 21 18:00:29 2014 +0200

    Follow up bug 1106101 (landed on Firefox 35) - Cmd/Ctrl-Click and middle-click on a one-off button should open the search in a new tab
---
 chrome/content/minit/minit.js   | 43 ++++++++++++++++++++++++++++-------------
 chrome/content/places/places.js | 25 ++++++++++++------------
 2 files changed, 43 insertions(+), 25 deletions(-)

diff --git a/chrome/content/minit/minit.js b/chrome/content/minit/minit.js
index 2e90065..b279e51 100644
--- a/chrome/content/minit/minit.js
+++ b/chrome/content/minit/minit.js
@@ -1187,6 +1187,17 @@ Tabmix.navToolbox = {
     }
   },
 
+  whereToOpenSearch: function(aWhere) {
+    var tab = gBrowser.selectedTab;
+    var isBlankTab = gBrowser.isBlankNotBusyTab(tab);
+    var isLockTab = !isBlankTab && tab.hasAttribute("locked");
+    if (aWhere == "current" && isLockTab)
+      aWhere = "tab";
+    else if (/^tab/.test(aWhere) && isBlankTab)
+      aWhere = "current";
+    return aWhere;
+  },
+
   initializeSearchbar: function TMP_navToolbox_initializeSearchbar() {
     var searchbar = document.getElementById("searchbar");
     if (!searchbar)
@@ -1212,28 +1223,34 @@ Tabmix.navToolbox = {
     let [obj, fn] = searchLoadExt ? [esteban_torres.searchLoad_Options, "MOZdoSearch"] :
                                     [organizeSE ? window.organizeSE : searchbar, "doSearch"];
     let fnString = obj[fn].toString();
-    if (fnString.indexOf("tabmixArg") > -1)
+    if (/Tabmix/.test(fnString))
       return;
 
     // Personas Interactive Theme Engine 1.6.5
     let pIte = fnString.indexOf("BTPIServices") > -1;
 
+    let $LF = '\n          ';
     Tabmix.changeCode(obj, "searchbar." + fn)._replace(
-      /(openUILinkIn[^\(]*\([^\)]+)(\))/,
-      '$1, null, tabmixArg$2'
-    )._replace(
-      'openUILinkIn',
-      '  var tabmixArg = {backgroundPref: "extensions.tabmix.loadSearchInBackground"};' +
-      '  var isBlankTab = gBrowser.isBlankNotBusyTab(gBrowser.mCurrentTab);' +
-      '  var isLockTab = !isBlankTab && gBrowser.mCurrentTab.hasAttribute("locked");' +
-      '  if (aWhere == "current" && isLockTab)' +
-      '    aWhere = "tab";' +
-      '  else if ((/^tab/).test(aWhere) && isBlankTab)' +
-      '    aWhere = "current";' +
+      /let params|openUILinkIn/,
+      'aWhere = Tabmix.navToolbox.whereToOpenSearch(aWhere);' + $LF +
       '$&'
     )._replace(
+      /openUILinkIn\(.*\);/,
+      'let params = {' + $LF +
+      '  postData: submission.postData,' + $LF +
+      '  inBackground: Tabmix.prefs.getBoolPref("loadSearchInBackground")' + $LF +
+      '};' + $LF +
+      'openUILinkIn(submission.uri.spec, aWhere, params);',
+      {check: !Tabmix.isVersion(350)}
+    )._replace(
+      'inBackground: aWhere == "tab-background"',
+      '$& ||' + $LF +
+      '                Tabmix.prefs.getBoolPref("loadSearchInBackground")',
+      {check: Tabmix.isVersion(350)}
+    )._replace(
       'var loadInBackground = prefs.getBoolPref("loadBookmarksInBackground");',
-      'var loadInBackground = Tabmix.prefs.getBoolPref("loadSearchInBackground");', {check: !searchLoadExt && organizeSE}
+      'var loadInBackground = aWhere == "tab-background" || Tabmix.prefs.getBoolPref("loadSearchInBackground");',
+      {check: !searchLoadExt && organizeSE}
     )._replace(
       /searchbar\.currentEngine/g,
       'this.currentEngine', {check: pIte}
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index db42876..068da93 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -50,16 +50,23 @@ var TMP_Places = {
 
       // fix small bug when the event is not mouse event
       // inverse focus of middle/ctrl/meta clicked bookmarks/history
+      // don't inverse focus when called from onPopupClick and One-Click Search
+      // Bar Interface is on
       // when we are in single window mode set the function to return "tab"
+      let $LF = '\n  ';
       Tabmix.changeCode(window, "whereToOpenLink")._replace(
         'var middle = !ignoreButton && e.button == 1;',
         'var middle = !ignoreButton && e.button && e.button == 1;'
       )._replace(
         'return shift ? "tabshifted" : "tab";',
         '{let pref = Tabmix.isCallerInList("openUILink", "handleLinkClick", "TMP_tabshifted", "TMP_contentLinkClick") ?\
-                 "extensions.tabmix.inversefocusLinks" : "extensions.tabmix.inversefocusOther";\
-         if(getBoolPref(pref, true)) shift = !shift; \
-         $&}'
+                 "extensions.tabmix.inversefocusLinks" : "extensions.tabmix.inversefocusOther";' + $LF +
+        'Tabmix.log("callerName " + Tabmix.callerName());' + $LF +
+        'let notOneClickSearch = !getBoolPref("browser.search.showOneOffButtons", false) ||' + $LF +
+        '                        Tabmix.callerName() != "onPopupClick";' + $LF +
+        'if (notOneClickSearch && getBoolPref(pref, true))' + $LF +
+        '  shift = !shift;' + $LF +
+        '$&}'
       )._replace(
         'return "window";',
         'return Tabmix.getSingleWindowMode() ? "tab" : "window";'
@@ -67,15 +74,9 @@ var TMP_Places = {
 
       Tabmix.changeCode(window, "openUILinkIn")._replace(
         'params.fromChrome = true;',
-        '$&' +
-        /* only in use when openUILinkIn called from searchbar.doSearch */
-        ' var tabmixArg = arguments.length > 5 ? arguments[5] : null;' +
-        ' if (tabmixArg) {' +
-        '   if ("backgroundPref" in tabmixArg)' +
-        '     params.inBackground = getBoolPref(tabmixArg.backgroundPref);' +
-        ' }' +
-        ' else if (Tabmix.isCallerInList("BG_observe"))' +
-        '   params.inBackground = getBoolPref("browser.tabs.loadInBackground");'
+        '$&\n' +
+        '  if (Tabmix.isCallerInList("BG_observe"))\n' +
+        '    params.inBackground = getBoolPref("browser.tabs.loadInBackground");'
       ).toCode();
 
       // update incompatibility with X-notifier(aka WebMail Notifier) 2.9.13+

-- 
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