[Pkg-mozext-commits] [nosquint] 23/47: Import of 2.0b5 release into git

David Prévot taffit at moszumanska.debian.org
Tue Apr 28 01:41:18 UTC 2015


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

taffit pushed a commit to annotated tag 2.1.6
in repository nosquint.

commit 1004678ec39fb31dfca37d54a2da707945327920
Author: Jason Tackaberry <tack at urandom.ca>
Date:   Fri Jan 13 19:41:14 2012 -0500

    Import of 2.0b5 release into git
---
 src/content/globalprefs.js       |  2 +-
 src/content/globalprefs.xul      |  6 +++---
 src/content/nosquint.js          | 30 +++++++++++++-----------------
 src/content/utils.js             | 28 ++++++++++++++++++++++------
 src/install.rdf                  |  4 ++--
 src/locale/en-US/globalprefs.dtd |  2 +-
 src/locale/en-US/help.html       |  2 +-
 7 files changed, 43 insertions(+), 31 deletions(-)

diff --git a/src/content/globalprefs.js b/src/content/globalprefs.js
index a7a7aa9..c0d5edf 100644
--- a/src/content/globalprefs.js
+++ b/src/content/globalprefs.js
@@ -20,7 +20,7 @@ var NoSquintPrefs = {
             NoSquintPrefs.prefs = prefService.getBranch("extensions.nosquint.")
         }
 
-        // Options tab
+        // General tab
         var forget_cb = doc.getElementById("siteForget");
         var months = NoSquintPrefs.prefs.getIntPref("forgetMonths");
         forget_cb.checked = (months != 0);
diff --git a/src/content/globalprefs.xul b/src/content/globalprefs.xul
index 7f49a06..ae974dc 100644
--- a/src/content/globalprefs.xul
+++ b/src/content/globalprefs.xul
@@ -22,15 +22,15 @@
 
     <tabbox flex="1">
         <tabs>
-            <tab label="&ns.pref.tab.options.label;" />
+            <tab label="&ns.pref.tab.general.label;" />
             <tab label="&ns.pref.tab.zooming.label;" />
             <tab label="&ns.pref.tab.colors.label;" />
             <tab label="&ns.pref.tab.exceptions.label;" />
         </tabs>
 
         <tabpanels flex="1">
-            <!-- Options Tab -->
-            <tabpanel id="optionstab" flex="1">
+            <!-- General Tab -->
+            <tabpanel id="generaltab" flex="1">
                 <vbox flex="1">
                     <groupbox id="persistence">
                         <caption label="&ns.pref.persistence.caption;" />
diff --git a/src/content/nosquint.js b/src/content/nosquint.js
index 3d506a5..4bcd0a4 100644
--- a/src/content/nosquint.js
+++ b/src/content/nosquint.js
@@ -50,16 +50,15 @@ var NoSquint = {
         var t0 = new Date().getTime();
 
         /* The multi-level TLDs list is an object shared between all windows.
-         * First iterate over all existing windows to see if we can find it;
-         * this prevents us from parsing the ~2000 line file each time a window
-         * is opened.  If not, read it from the two-level-tlds file.
+         * First see if it has already been attached to some window; this
+         * prevents us from parsing the ~2000 line file each time a window is
+         * opened.  If not, read it from the two-level-tlds file.
          */
         NoSquint.TLDs = window_get_global('tlds');
         if (NoSquint.TLDs == null) {
             // TLDs list not found in any existing window.  Load the stored list,
             // which is borrowed from http://www.surbl.org/two-level-tlds
             lines = readLines('chrome://nosquint/content/two-level-tlds');
-            //window._noSquintTLDs = NoSquint.TLDs = {};
             NoSquint.TLDs = {};
             for (var i in lines)
                 NoSquint.TLDs[lines[i]] = true;
@@ -107,7 +106,6 @@ var NoSquint = {
         NoSquint.styleAll();
         var t1 = new Date().getTime();
         debug("initialization took " + (t1-t0) + " ms");
-        //NoSquint.openGlobalPrefsDialog();
     },
 
     destroy: function() {
@@ -603,10 +601,14 @@ var NoSquint = {
      * and zoom levels.
      */
     updateStatus: function() {
+        var browser = gBrowser.selectedBrowser;
+        // Disable/enable context menu item.
+        document.getElementById('nosquint-menu-settings').disabled = browser._noSquintSite == null;
+
         if (NoSquint.hideStatus)
             // Pref indicates we're hiding status panel, no sense in updating.
             return;
-        var browser = gBrowser.selectedBrowser;
+
         var text = Math.round(browser.markupDocumentViewer.textZoom * 100);
         var full = Math.round(browser.markupDocumentViewer.fullZoom * 100);
         var [text_default, full_default] = NoSquint.getZoomDefaults();
@@ -848,8 +850,8 @@ var NoSquint = {
         var is_wider = img.naturalWidth/img.naturalHeight > doc.body.clientWidth/doc.body.clientHeight;
 
         var cursor = (!fit && !is_bigger) || (fit && is_bigger) ? "-moz-zoom-in" : "-moz-zoom-out";
-        var css = "* { cursor: " + cursor + " !important; }";
-        css += "img { cursor: " + cursor + " !important;";
+        //var css = "* { cursor: " + cursor + " !important; }";
+        var css = "img { cursor: " + cursor + " !important;";
         css += "width: " + (fit && is_wider? "100%" : "auto") + " !important;";
         css += "height: " + (fit && !is_wider ? "100%" : "auto") + " !important;}";
         debug("Fitting: " + fit + ", css: " + css);
@@ -885,7 +887,8 @@ var NoSquint = {
             if (doc.body.firstChild) {
                 browser._noSquintFit = false;
                 NoSquint.adjustImage(null, browser, NoSquint.zoomImages ? undefined : -1);
-                doc.addEventListener("click", function(event) { 
+                var img = doc.body.firstChild;
+                img.addEventListener("click", function(event) { 
                     if (event.button == 0)
                         return NoSquint.adjustImage(event, browser);
                 }, true);
@@ -1412,16 +1415,9 @@ ProgressListener.prototype.QueryInterface = function(aIID) {
 }
 
 ProgressListener.prototype.onLocationChange = function(progress, request, uri) {
-    /* This is called when it's confirmed a URL is loading (including reload).
-     * We set a flag here to update the zoom levels on the next state change
-     * rather than doing it immediately, because sometime between now and then
-     * firefox's internal full zoom gets reset, and we want to update full
-     * zoom after that happens (to override it, in effect).
-     */
+    // This is called when it's confirmed a URL is loading (including reload).
     debug("Location change: " + uri.spec);
-    //alert("Location change: " + uri.spec + ' -- doc uri:' + this.browser.docShell.document.URL);
     this.style_applied = false;
-    this.zoom_override = false;
     this.browser._noSquintStyles = [];
     this.content_type = this.browser.docShell.document.contentType;
     NoSquint.locationChanged(this.browser, this.browser.currentURI);
diff --git a/src/content/utils.js b/src/content/utils.js
index accd5d1..2ed1ad8 100644
--- a/src/content/utils.js
+++ b/src/content/utils.js
@@ -21,19 +21,35 @@ function debug(msg) {
 //    dump("[nosquint] " + msg + "\n");
 }
 
-// TODO: benchmark this function, it is called a lot.
+/* This function is called a lot, so we take some care to optimize for the
+ * common cases.
+ */
 function is_chrome(browser) {
     var document = browser.docShell.document;
-    debug("IS CHROME: " + document.URL + " (" + browser.currentURI.spec + ")  -- type:" + document.contentType);
-    if (document.URL.replace(/#.*$/, '') != browser.currentURI.spec.replace(/#.*$/, ''))
+    
+    if (document.URL == undefined)
+        return true;
+
+    /* In the common case, document.URL == browser.currentURI.spec, so we test
+     * this simple equality first before resorting to the probably unnecessary
+     * regexp call.
+     */
+    if (document.URL !=  browser.currentURI.spec &&
+        document.URL.replace(/#.*$/, '') != browser.currentURI.spec.replace(/#.*$/, ''))
         /* Kludge: doc.URL doesn't match browser currentURI during host lookup failure,
          * SSL cert errors, or other scenarios that result in an internal page being
          * displayed that we consider chrome.
          */
         return true;
-    return document.URL == undefined || 
-           document.URL.search(/^about:/) != -1 ||
-           document.contentType.search(/^text\/(html|plain|css|xml|javascript)|^application\/(xhtml)/) != 0;
+
+    // A couple other common cases.
+    if (document.contentType == 'text/html' || document.contentType == 'application/xhtml+xml')
+        return false;
+    if (document.URL == undefined || document.URL.substr(0, 6) == 'about:')
+        return true;
+
+    // Less common cases that we'll cover with the more expensive regexp.
+    return document.contentType.search(/^text\/(plain|css|xml|javascript)/) != 0;
 }
 
 function is_image(browser) {
diff --git a/src/install.rdf b/src/install.rdf
index 663c215..e145f46 100644
--- a/src/install.rdf
+++ b/src/install.rdf
@@ -5,8 +5,8 @@
     <Description about="urn:mozilla:install-manifest">
     
         <em:id>nosquint at urandom.ca</em:id>
-        <em:name>No Squint</em:name>
-        <em:version>2.0b4</em:version>
+        <em:name>NoSquint</em:name>
+        <em:version>2.0b5</em:version>
         <em:description>Manage site-specific zoom levels and color settings</em:description>
         <em:creator>Jason Tackaberry</em:creator>
         <!-- optional items -->
diff --git a/src/locale/en-US/globalprefs.dtd b/src/locale/en-US/globalprefs.dtd
index 122af67..e03330b 100644
--- a/src/locale/en-US/globalprefs.dtd
+++ b/src/locale/en-US/globalprefs.dtd
@@ -1,5 +1,5 @@
 <!ENTITY ns.pref.title "NoSquint Global Settings">
-<!ENTITY ns.pref.tab.options.label "Options">
+<!ENTITY ns.pref.tab.general.label "General">
 <!ENTITY ns.pref.tab.zooming.label "Zooming">
 <!ENTITY ns.pref.tab.colors.label "Colors">
 <!ENTITY ns.pref.tab.exceptions.label "Exceptions">
diff --git a/src/locale/en-US/help.html b/src/locale/en-US/help.html
index 1baa13b..9d7fe31 100644
--- a/src/locale/en-US/help.html
+++ b/src/locale/en-US/help.html
@@ -52,7 +52,7 @@
 </style>
 
 <body>
-<h2>Options Tab</h2>
+<h2>General Tab</h2>
 
 <p>To NoSquint, a site is a web location where all pages have the same zoom
 level and color settings, and the site name is derived from the page's URL.</p>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/nosquint.git



More information about the Pkg-mozext-commits mailing list