[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 237/483: Allow to specify more than one option for hotkeys, use Ctrl-Shift-S when Ctrl-Shift-K is not available

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:44 UTC 2015


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

taffit pushed a commit to branch master
in repository adblock-plus-element-hiding-helper.

commit d1ed10c2e97fa0ca2a4bd621069a7083c030cbd4
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Fri Oct 22 16:57:51 2010 +0200

    Allow to specify more than one option for hotkeys, use Ctrl-Shift-S when Ctrl-Shift-K is not available
---
 defaults/preferences/elemhidehelper.js |  2 +-
 modules/AppIntegration.jsm             | 71 +++++++++++++++++++---------------
 2 files changed, 40 insertions(+), 33 deletions(-)

diff --git a/defaults/preferences/elemhidehelper.js b/defaults/preferences/elemhidehelper.js
index 415aba7..1183c8b 100644
--- a/defaults/preferences/elemhidehelper.js
+++ b/defaults/preferences/elemhidehelper.js
@@ -1,3 +1,3 @@
-pref("extensions.elemhidehelper.selectelement_key", "Accel Shift K");
+pref("extensions.elemhidehelper.selectelement_key", "Accel Shift K, Accel Shift S");
 pref("extensions.elemhidehelper.showhelp", true);
 
diff --git a/modules/AppIntegration.jsm b/modules/AppIntegration.jsm
index c199137..2d9d7b2 100644
--- a/modules/AppIntegration.jsm
+++ b/modules/AppIntegration.jsm
@@ -183,43 +183,50 @@ WindowWrapper.prototype =
     if (!command)
       return;
 
-    let modifiers = [];
-    let seenModifier = {__proto__: null};
-    let keychar = null;
-    let keycode = null;
-    for each (let part in value.split(/\s+/))
+    for each (let variant in value.split(/\s*,\s*/))
     {
-      if (part.toLowerCase() in validModifiers)
-      {
-        if (part in seenModifier)
-          continue;
+      if (!variant)
+        continue;
 
-        seenModifier[part] = true;
-        modifiers.push(validModifiers[part.toLowerCase()]);
-      }
-      else if (part.length == 1)
-        keychar = part.toUpperCase();
-      else if ("DOM_VK_" + part.toUpperCase() in Ci.nsIDOMKeyEvent)
-        keycode = "VK_" + part.toUpperCase();
-    }
+      let modifiers = [];
+      let seenModifier = {__proto__: null};
+      let keychar = null;
+      let keycode = null;
+      for each (let part in variant.split(/\s+/))
+      {
+        if (part.toLowerCase() in validModifiers)
+        {
+          if (part in seenModifier)
+            continue;
   
-    if (keychar || keycode)
-    {
+          seenModifier[part] = true;
+          modifiers.push(validModifiers[part.toLowerCase()]);
+        }
+        else if (part.length == 1)
+          keychar = part.toUpperCase();
+        else if ("DOM_VK_" + part.toUpperCase() in Ci.nsIDOMKeyEvent)
+          keycode = "VK_" + part.toUpperCase();
+      }
+    
+      if (!keychar && !keycode)
+        continue;
+
       modifiers.sort();
       let canonical = modifiers.concat([keychar || keycode]).join(" ");
-      if (!(canonical in existing))
-      {
-        let element = this.window.document.createElement("key");
-        element.setAttribute("id", "ehh-key-" + id);
-        element.setAttribute("command", "ehh-command-" + id);
-        if (keychar)
-          element.setAttribute("key", keychar);
-        else
-          element.setAttribute("keycode", keycode);
-        element.setAttribute("modifiers", modifiers.join(","));
-    
-        this.E("abp-keyset").appendChild(element);
-      }
+      if (canonical in existing)
+        continue;
+
+      let element = this.window.document.createElement("key");
+      element.setAttribute("id", "ehh-key-" + id);
+      element.setAttribute("command", "ehh-command-" + id);
+      if (keychar)
+        element.setAttribute("key", keychar);
+      else
+        element.setAttribute("keycode", keycode);
+      element.setAttribute("modifiers", modifiers.join(","));
+  
+      this.E("abp-keyset").appendChild(element);
+      return;
     }
   },
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus-element-hiding-helper.git



More information about the Pkg-mozext-commits mailing list