[Pkg-mozext-commits] [tabmixplus] 25/56: Update compatibility with Sage 1.5.4

David Prévot taffit at moszumanska.debian.org
Mon Jun 6 00:02:34 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 c856e8cf2313d2dfe813d374c896fa2e5a2dcabc
Author: onemen <tabmix.onemen at gmail.com>
Date:   Thu May 12 14:49:35 2016 +0300

    Update compatibility with Sage 1.5.4
---
 chrome/content/extensions/sage.js | 51 +++++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 21 deletions(-)

diff --git a/chrome/content/extensions/sage.js b/chrome/content/extensions/sage.js
index 9059fa9..613cf1a 100644
--- a/chrome/content/extensions/sage.js
+++ b/chrome/content/extensions/sage.js
@@ -3,46 +3,55 @@
 // prevent Sage from load pages in locked tabs
 // code by onemen
 
-// last updated for sage version 1.5.2 - 2013-08-12
+// last updated for sage version 1.5.4 - 2016-04-06
+// https://addons.mozilla.org/en-us/firefox/addon/sage/
 var TMP_Sage = {
   OPEN_TAB_FOR_SAGE: "extensions.tabmix.opentabfor.sage",
   init: function() {
     TMP_Places.contextMenu.toggleEventListener(true);
 
-    Tabmix.changeCode(window, "updateItemContextMenu")._replace(
-      'readStateController.onCommandUpdate();',
-      '$& TMP_Sage.buildContextMenu();'
-    ).toCode();
+    if ("updateItemContextMenu" in window) {
+      Tabmix.changeCode(window, "updateItemContextMenu")._replace(
+        'readStateController.onCommandUpdate();',
+        '$& TMP_Sage.buildContextMenu();'
+      ).toCode();
+    }
 
-    if ("bookmarksTreeClick" in window) // for older sage version
+    // for older sage version
+    if ("bookmarksTreeClick" in window) {
       Tabmix.changeCode(window, "bookmarksTreeClick")._replace(
         'const BOOKMARK_SEPARATOR',
         'var where = TMP_Places.fixWhereToOpen(aEvent, CreateHTML._tabbed ? "tab" : "current", TMP_Sage.openTabPref); \
          CreateHTML.tabbed = where == "tab"; \
          $&'
       ).toCode();
+    }
 
-    if ("bookmarksOpen" in window) // for older sage version
+    // for older sage version
+    if ("bookmarksOpen" in window) {
       Tabmix.changeCode(window, "bookmarksOpen")._replace(
         'getContentBrowser().loadURI(lastResource.url);',
         'if (CreateHTML._tabbed) getContentBrowser().addTab(lastResource.url); \
          else $&'
       ).toCode();
+    }
 
-    var fn = openURI.toString();
-    if (fn.indexOf("switch (windowType)") > -1) {
-      Tabmix.changeCode(window, "openURI")._replace(
-        'switch (windowType)',
-        'windowType = TMP_Places.fixWhereToOpen((oType instanceof Event)? oType : null, !windowType ? "current" : windowType, TMP_Sage.openTabPref); \
-         $&'
-      ).toCode();
-    } else {
-      Tabmix.changeCode(window, "openURI")._replace(
-        'switch (getWindowType(aEvent))',
-        'var windowType = getWindowType(aEvent);\
-         windowType = TMP_Places.fixWhereToOpen(aEvent, typeof (windowType) != "string" || !windowType ? "current" : windowType, TMP_Sage.openTabPref); \
-         switch (windowType)'
-      ).toCode();
+    if ("openURI" in window) {
+      let fn = window.openURI.toString();
+      if (fn.indexOf("switch (windowType)") > -1) {
+        Tabmix.changeCode(window, "openURI")._replace(
+          'switch (windowType)',
+          'windowType = TMP_Places.fixWhereToOpen((oType instanceof Event)? oType : null, !windowType ? "current" : windowType, TMP_Sage.openTabPref); \
+           $&'
+        ).toCode();
+      } else {
+        Tabmix.changeCode(window, "openURI")._replace(
+          'switch (getWindowType(aEvent))',
+          'var windowType = getWindowType(aEvent);\
+           windowType = TMP_Places.fixWhereToOpen(aEvent, typeof (windowType) != "string" || !windowType ? "current" : windowType, TMP_Sage.openTabPref); \
+           switch (windowType)'
+        ).toCode();
+      }
     }
   },
 

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