[Pkg-mozext-commits] [tabmixplus] 28/47: Handle click on menu items in PanelUI-history button

David Prévot taffit at moszumanska.debian.org
Fri Sep 26 20:57:01 UTC 2014


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

taffit pushed a commit to branch upstream
in repository tabmixplus.

commit 177d5358c38c640818e79464ae7b1855311979f9
Author: onemen <tabmix.onemen at gmail.com>
Date:   Sat Sep 20 21:00:24 2014 +0300

    Handle click on menu items in PanelUI-history button
---
 chrome/content/links/userInterface.js | 13 ++++++++++++-
 chrome/content/places/places.js       | 21 +++++++++++++--------
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/chrome/content/links/userInterface.js b/chrome/content/links/userInterface.js
index ae48d51..678c569 100644
--- a/chrome/content/links/userInterface.js
+++ b/chrome/content/links/userInterface.js
@@ -271,8 +271,19 @@ Tabmix.openUILink_init = function TMP_openUILink_init() {
       source = code[1];
     else
       return; // nothing we can do
-    /* don't open blank tab when we are about to add new livemark */
+    /**
+     * don't open blank tab when we are about to add new livemark
+     * divert call from PanelUI-history to our function
+     */
     this.changeCode(window, "openUILink")._replace(
+      '{',
+      '{\n' +
+       '  if (event && event.target && event.target.parentNode &&\n' +
+       '      event.target.parentNode.id == "PanelUI-historyItems") {\n' +
+       '    TMP_Places.openHistoryItem(url, event);\n' +
+       '    return;\n' +
+       '  }', {check: Tabmix.isVersion(280)}
+    )._replace(
       'aIgnoreAlt = params.ignoreAlt;',
       'aIgnoreAlt = params.ignoreAlt || null;'
     )._replace(
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index 5c6838b..9f028fa 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -173,17 +173,22 @@ var TMP_Places = {
       var node = aEvent.target._placesNode;
       if (node) {
          PlacesUIUtils.markPageAsTyped(node.uri);
-         var where = this.isBookmarklet(node.uri) ? "current" :
-                      this.fixWhereToOpen(aEvent, whereToOpenLink(aEvent, false, true), this.prefHistory);
-         if (where == "current")
-           Tabmix.getTopWin().gBrowser.mCurrentBrowser.tabmix_allowLoad = true;
-         openUILinkIn(node.uri, where, {
-           inBackground: Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground"),
-           initiatingDoc: aEvent ? aEvent.target.ownerDocument : null
-         });
+         this.openHistoryItem(node.uri, aEvent);
       }
    },
 
+   // open PanelUI-historyItems from history button, diverted from openUILink
+   openHistoryItem: function(aUri, aEvent) {
+      var where = this.isBookmarklet(aUri) ? "current" :
+                   this.fixWhereToOpen(aEvent, whereToOpenLink(aEvent, false, true), this.prefHistory);
+      if (where == "current")
+        Tabmix.getTopWin().gBrowser.mCurrentBrowser.tabmix_allowLoad = true;
+      openUILinkIn(aUri, where, {
+        inBackground: Services.prefs.getBoolPref("browser.tabs.loadBookmarksInBackground"),
+        initiatingDoc: aEvent ? aEvent.target.ownerDocument : null
+      });
+   },
+
    isBookmarklet: function (url) {
       var jsURL = /^ *javascript:/;
       return jsURL.test(url) ? true : false;

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