[Pkg-mozext-commits] [tabmixplus] 26/56: Use text-link handler for links from our about dialog. Remove obsolete Tabmix.openURL function that used to open links from old Extension/Theme Managers

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

    Use text-link handler for links from our about dialog. Remove obsolete Tabmix.openURL function that used to open links from old Extension/Theme Managers
---
 chrome/content/about.xul              |  6 ++--
 chrome/content/links/links.xul        | 28 +++++++--------
 chrome/content/links/setup.js         |  7 +---
 chrome/content/links/userInterface.js | 64 -----------------------------------
 4 files changed, 17 insertions(+), 88 deletions(-)

diff --git a/chrome/content/about.xul b/chrome/content/about.xul
index fdaeb55..1776643 100644
--- a/chrome/content/about.xul
+++ b/chrome/content/about.xul
@@ -45,12 +45,12 @@
         </vbox>
         <vbox id="extensionHomepage" style="cursor:default;">
           <label class="text-link" value="&homepage.label;" style="cursor:pointer;"
-                 onclick="Tabmix.openURL('http://tabmixplus.org', event)"/>
+                 href="http://tabmixplus.org"/>
           <hbox flex="1">
             <label value="&forum.label;" style="cursor:pointer;" class="text-link"
-                   onclick="Tabmix.openURL('http://tabmixplus.org/forum', event)"/>
+                   href="http://tabmixplus.org/forum"/>
             <label value="&help.label;" style="cursor:pointer;" class="text-link"
-                   onclick="Tabmix.openURL('http://tabmixplus.org/support/viewpage.php?t=3&p=introduction', event)"/>
+                   href="http://tabmixplus.org/support/viewpage.php?t=3&p=introduction"/>
           </hbox>
         </vbox>
       </hbox>
diff --git a/chrome/content/links/links.xul b/chrome/content/links/links.xul
index 3004869..0ea9654 100644
--- a/chrome/content/links/links.xul
+++ b/chrome/content/links/links.xul
@@ -1,21 +1,19 @@
 <?xml version="1.0"?>
 
 <overlay id="tabmixplus-tabprefs-overlay"
-   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
-   <script type="application/javascript" src="chrome://tabmixplus/content/utils.js"/>
-   <script type="application/javascript" src="chrome://tabmixplus/content/links/contentLinks.js"/>
-   <script type="application/javascript" src="chrome://tabmixplus/content/links/userInterface.js"/>
-   <script type="application/javascript" src="chrome://tabmixplus/content/links/setup.js"/>
+  <script type="application/javascript" src="chrome://tabmixplus/content/utils.js"/>
+  <script type="application/javascript" src="chrome://tabmixplus/content/links/contentLinks.js"/>
+  <script type="application/javascript" src="chrome://tabmixplus/content/links/userInterface.js"/>
+  <script type="application/javascript" src="chrome://tabmixplus/content/links/setup.js"/>
 
-   <script type="application/javascript">
-
-   <![CDATA[
-      window.addEventListener("load", function TMP_onLoad_tabPreverenceOverlay(aEvent) {
-        aEvent.currentTarget.removeEventListener("load", TMP_onLoad_tabPreverenceOverlay, false);
-        Tabmix.linkHandling_init(window.document.documentElement.getAttribute("windowtype"));
-      }, false);
-   ]]>
-
-   </script>
+  <script type="application/javascript">
+  <![CDATA[
+    window.addEventListener("load", function TMP_onLoad_tabPreverenceOverlay(aEvent) {
+      aEvent.currentTarget.removeEventListener("load", TMP_onLoad_tabPreverenceOverlay, false);
+      Tabmix.linkHandling_init();
+    }, false);
+  ]]>
+  </script>
 </overlay>
diff --git a/chrome/content/links/setup.js b/chrome/content/links/setup.js
index d871a77..85a52f1 100644
--- a/chrome/content/links/setup.js
+++ b/chrome/content/links/setup.js
@@ -14,12 +14,7 @@
  *
  * @returns   Nothing.
  */
-Tabmix.linkHandling_init = function TMP_TBP_init(aWindowType) {
-  if (aWindowType == "Extension:Manager") {
-    // we're in the EM
-    window.openURL = this.openURL;
-  }
-
+Tabmix.linkHandling_init = function TMP_TBP_init() {
   // for normal click this function calls urlbar.handleCommand
   // for middle click or click with modifiers whereToOpenLink can't be "current"
   // so we don't need to check for locked tabs only for blanks tabs
diff --git a/chrome/content/links/userInterface.js b/chrome/content/links/userInterface.js
index 4c90fa2..821ec45 100644
--- a/chrome/content/links/userInterface.js
+++ b/chrome/content/links/userInterface.js
@@ -32,70 +32,6 @@ Tabmix.openOptionsDialog = function TMP_openDialog(panel) {
   }
 };
 
-/**
- * @brief Load URLs from the Extension/Theme Managers, and item with text-link class
- *
- * This redefines chrome://mozapps/content/extensions/extensions.js:openURL()
- *
- * @param aURL       A valid URI string.
- * @param event      A valid event union. This can be null when
- *                   calling this function.
- * @return           true.
- *
- */
-Tabmix.openURL = function TMP_openURL(aURL, event) {
-  var linkTarget;
-  try {
-    linkTarget = Services.prefs.getIntPref("browser.link.open_newwindow");
-  } catch (e) {
-    linkTarget = 1;
-  }
-
-  if (!aURL)
-    aURL = "about:blank";
-
-  // check for an existing window and focus it; it's not application modal
-  var browserWindow = this.getTopWin();
-
-  if (!browserWindow) {
-    openDialog("chrome://browser/content/browser.xul", "_blank", "chrome,all,dialog=no", aURL, null, null, null);
-    if (event && event instanceof Event) {
-      event.preventDefault();
-      event.stopPropagation();
-    }
-    return true;
-  }
-
-  var tabBrowser = browserWindow.gBrowser;
-  var originCharset = tabBrowser.selectedBrowser.characterSet;
-
-  // if the current tab is empty, then do not open a new tab
-  if (tabBrowser.currentURI.spec == TabmixSvc.aboutBlank) {
-    // 1: CURRENT_TAB
-    linkTarget = 1;
-    originCharset = null;
-  }
-
-  switch (linkTarget) {
-    case 1 :
-      tabBrowser.loadURI(aURL, null, originCharset);
-      break;
-    case 2 :
-      browserWindow.openNewWindowWith(aURL, null, null, false);
-      break;
-    case 3 :
-      // added by request, for extensions with multiple homepages
-      browserWindow.Tabmix.loadTabs(aURL.split("|"), false);
-      break;
-  }
-
-  if (event && event instanceof Event) {
-    event.preventDefault();
-    event.stopPropagation();
-  }
-  return true;
-};
-
 // Don't change this function name other extensions using it
 // Speed-Dial, Fast-Dial, TabGroupManager
 function TMP_BrowserOpenTab(aTab, replaceLastTab) {

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