[Pkg-mozext-commits] [itsalltext] 270/459: You can now select the position of the gumdrop button!

David Prévot taffit at moszumanska.debian.org
Tue Feb 24 23:26:28 UTC 2015


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

taffit pushed a commit to branch master
in repository itsalltext.

commit e5480c6bbe97d0e74a6c46c52f7d3e33c2aa6fbd
Author: docwhat at gerf.org <docwhat at gerf.org>
Date:   Mon Oct 1 11:44:43 2007 -0400

    You can now select the position of the gumdrop button!
---
 src/chrome/content/cacheobj.js          | 37 +++++++++++++++++++++------------
 src/chrome/content/itsalltext.js        |  4 ++--
 src/chrome/content/preferences.xul      | 22 ++++++++++++++------
 src/chrome/locale/en-US/preferences.dtd | 24 ++++++++++++---------
 src/defaults/preferences/itsalltext.js  |  2 +-
 5 files changed, 57 insertions(+), 32 deletions(-)

diff --git a/src/chrome/content/cacheobj.js b/src/chrome/content/cacheobj.js
index 932a0a4..df6d38d 100644
--- a/src/chrome/content/cacheobj.js
+++ b/src/chrome/content/cacheobj.js
@@ -529,15 +529,14 @@ CacheObj.prototype.addGumDrop = function() {
     }
     cache_object.button = gumdrop; // Store it for easy finding in the future.
 
-    // Image Attributes & Position
-    // @todo [1] Options for which corner it is next to.
-    gumdrop.style.setProperty('cursor',   'pointer', 'important');
-    gumdrop.style.setProperty('display',  'block', 'important');
-    gumdrop.style.setProperty('position',  'absolute', 'important');
-    gumdrop.style.setProperty('padding',   '0', 'important');
-    gumdrop.style.setProperty('margin',   '0', 'important');
-    gumdrop.style.setProperty('border',    'none', 'important');
-    gumdrop.style.setProperty('zIndex',    '1', 'important'); // we want it just above normal items.
+    // Image Attributes
+    gumdrop.style.setProperty('cursor',   'pointer',  'important');
+    gumdrop.style.setProperty('display',  'block',    'important');
+    gumdrop.style.setProperty('position', 'absolute', 'important');
+    gumdrop.style.setProperty('padding',  '0',        'important');
+    gumdrop.style.setProperty('margin',   '0',        'important');
+    gumdrop.style.setProperty('border',   'none',     'important');
+    gumdrop.style.setProperty('zIndex',   '1',        'important'); // we want it just above normal items.
 
     gumdrop.style.setProperty('width',  this.gumdrop_width+'px',  'important');
     gumdrop.style.setProperty('height', this.gumdrop_height+'px', 'important');
@@ -596,10 +595,22 @@ CacheObj.prototype.adjust = function() {
         style.setProperty('display', display, 'important');
     }
 
-    /* Reposition the gumdrops incase the dom changed. */
-    var left = Math.max(1, el.offsetWidth-this.gumdrop_width);
-    var top  = el.offsetHeight;
-    var coord;
+    /**
+     * Position the gumdrop.
+     * Updates in case the DOM changes.
+     */
+    var left, top, coord;
+    var pos = ItsAllText.preferences.gumdrop_position;
+    if (pos === 'upper-right' || pos === 'lower-right') {
+        left = Math.max(1, el.offsetWidth-this.gumdrop_width);
+    } else {
+        left = 0;
+    }
+    if (pos === 'lower-left' || pos === 'lower-right') {
+        top  = el.offsetHeight;
+    } else {
+        top  = 0 - this.gumdrop_height;
+    }
     if (el.offsetParent === gumdrop.offsetParent) {
         left += el.offsetLeft;
         top  += el.offsetTop;
diff --git a/src/chrome/content/itsalltext.js b/src/chrome/content/itsalltext.js
index 4de3c07..f60e35d 100644
--- a/src/chrome/content/itsalltext.js
+++ b/src/chrome/content/itsalltext.js
@@ -228,7 +228,7 @@ var ItsAllText = function() {
             editor:             'Char',
             refresh:            'Int',
             debug:              'Bool',
-            disable_gumdrops:   'Bool',
+            gumdrop_position:   'Char',
             extensions:         'Char'
         },
 
@@ -354,7 +354,7 @@ var ItsAllText = function() {
      * @returns {bool}
      */
     that.getDisableGumdrops = function() {
-        return that.preferences.disable_gumdrops;
+        return that.preferences.gumdrop_position === 'none';
     };
 
     /**
diff --git a/src/chrome/content/preferences.xul b/src/chrome/content/preferences.xul
index 47e87be..8a89b44 100644
--- a/src/chrome/content/preferences.xul
+++ b/src/chrome/content/preferences.xul
@@ -27,8 +27,8 @@
                 name="extensions.itsalltext.refresh" type="int"/>
     <preference id="pref_extensions"
                 name="extensions.itsalltext.extensions" type="string"/>
-    <preference id="pref_disable_gumdrops"
-                name="extensions.itsalltext.disable_gumdrops" type="bool"/>
+    <preference id="pref_gumdrop_position"
+                name="extensions.itsalltext.gumdrop_position" type="string"/>
     <preference id="pref_debug"
                 name="extensions.itsalltext.debug" type="bool"/>
   </preferences>
@@ -75,10 +75,20 @@
           <textbox preference="pref_extensions" id="extensions" size="30" tabindex="4"/>
         </row>
         <row align="center">
-          <label control="disable_gumdrops"
-                 value="&disable_gumdrops.label;"/>
-          <checkbox preference="pref_disable_gumdrops" id="disable_gumdrops" tabindex="5"
-          label="&disable_gumdrops.checkbox;"/>
+          <label control="gumdrop_pos" value="&gumdrop_position.label;"/>
+          <radiogroup id="gumpdrop_pos" preference="pref_gumdrop_position">
+            <vbox>
+              <hbox>
+                <radio value="upper-left"  label="&gumdrop_position.upper_left;"/>
+                <radio value="upper-right" label="&gumdrop_position.upper_right;"/>
+              </hbox>
+              <hbox>
+                <radio value="lower-left"  label="&gumdrop_position.lower_left;"/>
+                <radio value="lower-right" label="&gumdrop_position.lower_right;"/>
+              </hbox>
+            </vbox>
+            <radio value="none"        label="&gumdrop_position.disable;"/>
+          </radiogroup>
         </row>
         <row align="center">
           <label control="debug"
diff --git a/src/chrome/locale/en-US/preferences.dtd b/src/chrome/locale/en-US/preferences.dtd
index af26ad9..e4e4aa9 100644
--- a/src/chrome/locale/en-US/preferences.dtd
+++ b/src/chrome/locale/en-US/preferences.dtd
@@ -1,10 +1,14 @@
-<!ENTITY title                       "It's All Text! Preferences">
-<!ENTITY editor.label                "Editor:">
-<!ENTITY picker.label                "Browse">
-<!ENTITY seconds.label               "Seconds between refreshing:">
-<!ENTITY charset.label               "Character Set (default: UTF-8):">
-<!ENTITY extensions.label            "File Extensions:">
-<!ENTITY debug.label                 "Debugging:">
-<!ENTITY debug.humor                 "Remove all bugs">
-<!ENTITY disable_gumdrops.label      "In-Page Edit Buttons:">
-<!ENTITY disable_gumdrops.checkbox   "Disable">
+<!ENTITY title                          "It's All Text! Preferences">
+<!ENTITY editor.label                   "Editor:">
+<!ENTITY picker.label                   "Browse">
+<!ENTITY seconds.label                  "Seconds between refreshing:">
+<!ENTITY charset.label                  "Character Set (default: UTF-8):">
+<!ENTITY extensions.label               "File Extensions:">
+<!ENTITY debug.label                    "Debugging:">
+<!ENTITY debug.humor                    "Remove all bugs">
+<!ENTITY gumdrop_position.label         "Edit button position">
+<!ENTITY gumdrop_position.disable       "Disable">
+<!ENTITY gumdrop_position.upper_left    "Upper Left">
+<!ENTITY gumdrop_position.upper_right   "Upper Right">
+<!ENTITY gumdrop_position.lower_left    "Lower Left">
+<!ENTITY gumdrop_position.lower_right   "Lower Right">
diff --git a/src/defaults/preferences/itsalltext.js b/src/defaults/preferences/itsalltext.js
index d7f0bb3..e14fe23 100644
--- a/src/defaults/preferences/itsalltext.js
+++ b/src/defaults/preferences/itsalltext.js
@@ -2,5 +2,5 @@ pref("extensions.itsalltext.charset",  "UTF-8");
 pref("extensions.itsalltext.editor",   "");
 pref("extensions.itsalltext.refresh",  3);
 pref("extensions.itsalltext.debug",  false);
-pref("extensions.itsalltext.disable_gumdrops", false);
+pref("extensions.itsalltext.gumdrop_position", 'lower-right');
 pref("extensions.itsalltext.extensions",  '.txt,.html,.css,.xml,.xsl,.js');

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



More information about the Pkg-mozext-commits mailing list