[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 386/483: Updated to build tools changes and split up the main module

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:59 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 c13133d17341902c4161c8f00d46c20ba09bb8aa
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Mon Jan 23 14:52:53 2012 +0100

    Updated to build tools changes and split up the main module
    
    --HG--
    rename : main.js => inspectorObserver.js
    rename : main.js => windowWrapper.js
---
 inspectorObserver.js |  62 +++++++
 main.js              | 459 ++++++++++-----------------------------------------
 windowWrapper.js     | 156 +++++++++++++++++
 3 files changed, 306 insertions(+), 371 deletions(-)

diff --git a/inspectorObserver.js b/inspectorObserver.js
new file mode 100644
index 0000000..0718aed
--- /dev/null
+++ b/inspectorObserver.js
@@ -0,0 +1,62 @@
+/*
+ * This Source Code is subject to the terms of the Mozilla Public License
+ * version 2.0 (the "License"). You can obtain a copy of the License at
+ * http://mozilla.org/MPL/2.0/.
+ */
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+
+let InspectorObserver =
+{
+  init: function()
+  {
+    Services.obs.addObserver(this, "inspector-opened", true);
+    onShutdown.add((function() Services.obs.removeObserver(this, "inspector-opened")).bind(this));
+  },
+
+  get inspectorButton()
+  {
+    // Randomize URI to work around bug 719376
+    let stringBundle = Services.strings.createBundle("chrome://elemhidehelper/locale/global.properties?" + Math.random());
+    let result = [stringBundle.GetStringFromName("inspector.button.label"), stringBundle.GetStringFromName("inspector.button.accesskey"), stringBundle.GetStringFromName("inspector.button.tooltiptext")];
+
+    delete this.inspectorButton;
+    this.__defineGetter__("inspectorButton", function() result);
+    return this.inspectorButton;
+  },
+
+  observe: function(subject, topic, data)
+  {
+    if (topic != "inspector-opened")
+      return;
+
+    let InspectorUI = subject.wrappedJSObject;
+    let hooks = InspectorUI.chromeDoc.getElementById("abp-hooks");
+    if (!hooks || !require("aardvark").Aardvark.canSelect(hooks.getBrowser()))
+      return;
+
+    let [label, accesskey, tooltiptext] = this.inspectorButton;
+    InspectorUI.registerTool({
+      id: "abp-elemhide",
+      label: label,
+      accesskey: accesskey,
+      tooltiptext: tooltiptext,
+      get isOpen() false,
+      show: function(selection)
+      {
+        InspectorUI.chromeWin.openDialog("chrome://elemhidehelper/content/composer.xul", "_blank",
+                                         "chrome,centerscreen,resizable,dialog=no", selection);
+        InspectorUI.closeInspectorUI();
+      }
+    });
+  },
+
+  QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObserver])
+};
+
+InspectorObserver.init();
diff --git a/main.js b/main.js
index 93941e3..bb860fb 100644
--- a/main.js
+++ b/main.js
@@ -9,395 +9,112 @@ const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
-let {Aardvark} = require("aardvark");
 let {Prefs} = require("prefs");
-let {KeySelector} = require("keySelector");
+let {WindowObserver} = require("windowObserver");
+let {WindowWrapper} = require("windowWrapper");
 
-let Main = exports.Main =
-{
-  initialized: false,
-  elementMarkerClass: null,
-  styleURI: null,
-
-  init: function()
-  {
-    if (this.initialized)
-      return;
-    this.initialized = true;
-
-    Prefs.init("extensions.elemhidehelper.", {
-      "extensions.adblockplus.ehh-selectelement_key": "selectelement_key",
-      "extensions.adblockplus.ehh.showhelp": "showhelp"
-    });
+Prefs.init("extensions.elemhidehelper.", {
+  "extensions.adblockplus.ehh-selectelement_key": "selectelement_key",
+  "extensions.adblockplus.ehh.showhelp": "showhelp"
+});
 
-    // Use random marker class
-    let rnd = [];
-    let offset = "a".charCodeAt(0);
-    for (let i = 0; i < 20; i++)
-      rnd.push(offset + Math.random() * 26);
-
-    this.elementMarkerClass = String.fromCharCode.apply(String, rnd);
-
-    // Load CSS asynchronously
-    let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIJSXMLHttpRequest);
-    request.open("GET", "chrome://elemhidehelper/content/elementmarker.css");
-    request.overrideMimeType("text/plain");
-    request.addEventListener("load", function()
-    {
-      if (!this.initialized)
-        return;
-
-      let data = request.responseText.replace(/%%CLASS%%/g, this.elementMarkerClass);
-      let styleService = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
-      this.styleURI = Services.io.newURI("data:text/css," + encodeURIComponent(data), null, null);
-      styleService.loadAndRegisterSheet(this.styleURI, Ci.nsIStyleSheetService.USER_SHEET);
-    }.bind(this), false);
-    request.send(null);
-
-    // Load overlay asynchonously and start attaching to windows once done
-    let request2 = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIJSXMLHttpRequest);
-    request2.open("GET", "chrome://elemhidehelper/content/overlay.xul");
-    request2.addEventListener("load", function()
-    {
-      if (!this.initialized)
-        return;
+onShutdown.add(function() require("aardvark").Aardvark.quit());
 
-      WindowObserver.overlay = {__proto__: null, "_processing": []};
-      for (let child = request2.responseXML.documentElement.firstElementChild; child; child = child.nextElementSibling)
-        if (child.hasAttribute("id"))
-          WindowObserver.overlay[child.getAttribute("id")] = child;
-      for (let child = request2.responseXML.firstChild; child; child = child.nextSibling)
-        if (child.nodeType == child.PROCESSING_INSTRUCTION_NODE)
-          WindowObserver.overlay._processing.push(child);
-      WindowObserver.init();
-      InspectorObserver.init();
-    }.bind(this), false);
-    request2.send(null);
-  },
-
-  shutdown: function()
-  {
-    if (!this.initialized)
-      return;
-    this.initialized = false;
-
-    if (this.styleURI)
-    {
-      let styleService = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
-      styleService.unregisterSheet(this.styleURI, Ci.nsIStyleSheetService.USER_SHEET);
-      this.styleURI = null;
-    }
-
-    Prefs.shutdown();
-    Aardvark.quit();
-    WindowObserver.shutdown();
-    InspectorObserver.shutdown();
-  }
-};
-
-let WindowObserver =
+// Use random marker class
+let elementMarkerClass = null;
 {
-  initialized: false,
-
-  overlay: null,
-
-  init: function()
-  {
-    if (this.initialized)
-      return;
-    this.initialized = true;
+  let rnd = [];
+  let offset = "a".charCodeAt(0);
+  for (let i = 0; i < 20; i++)
+    rnd.push(offset + Math.random() * 26);
 
-    let e = Services.ww.getWindowEnumerator();
-    while (e.hasMoreElements())
-    {
-      let window = e.getNext().QueryInterface(Ci.nsIDOMWindow);
-      if (window.document.readyState == "complete")
-        this.applyToWindow(window);
-      else
-        this.observe(window, "domwindowopened", null);
-    }
-
-    Services.ww.registerNotification(this);
-  },
-
-  shutdown: function()
-  {
-    if (!this.initialized)
-      return;
-    this.initialized = false;
-
-    let e = Services.ww.getWindowEnumerator();
-    while (e.hasMoreElements())
-      this.removeFromWindow(e.getNext().QueryInterface(Ci.nsIDOMWindow));
-
-    Services.ww.unregisterNotification(this);
-  },
-
-  applyToWindow: function(window)
-  {
-    if (!window.document.getElementById("abp-hooks"))
-      return;
-
-    for (let id in this.overlay)
-      if (id != "_processing")
-        window.document.documentElement.appendChild(window.document.importNode(this.overlay[id], true));
-    for (let i = 0; i < this.overlay._processing.length; i++)
-    {
-      let node = window.document.importNode(this.overlay._processing[i], true);
-      node.data += ' class="elemhidehelper-node"';
-      window.document.insertBefore(node, window.document.firstChild);
-    }
-
-    window._ehhWrapper = new WindowWrapper(window);
-  },
-
-  removeFromWindow: function(window)
-  {
-    if (!window._ehhWrapper)
-      return;
-
-    window._ehhWrapper.shutdown();
-    delete window._ehhWrapper;
+  elementMarkerClass = String.fromCharCode.apply(String, rnd);
+}
 
-    let remove = [];
-    for (let id in this.overlay)
+// Load CSS asynchronously
+let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIJSXMLHttpRequest);
+request.open("GET", "chrome://elemhidehelper/content/elementmarker.css");
+request.overrideMimeType("text/plain");
+request.addEventListener("load", function(event)
+{
+  if (onShutdown.done)
+    return;
+
+  let data = event.target.responseText.replace(/%%CLASS%%/g, elementMarkerClass);
+  let styleService = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
+  let styleURI = Services.io.newURI("data:text/css," + encodeURIComponent(data), null, null);
+  styleService.loadAndRegisterSheet(styleURI, Ci.nsIStyleSheetService.USER_SHEET);
+  onShutdown.add(function() styleService.unregisterSheet(styleURI, Ci.nsIStyleSheetService.USER_SHEET));
+}, false);
+request.send(null);
+
+// Load overlay asynchonously and start attaching to windows once done
+request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIJSXMLHttpRequest);
+request.open("GET", "chrome://elemhidehelper/content/overlay.xul");
+request.addEventListener("load", function(event)
+{
+  if (onShutdown.done)
+    return;
+
+  let overlay = {__proto__: null, "_processing": []};
+  for (let child = event.target.responseXML.documentElement.firstElementChild; child; child = child.nextElementSibling)
+    if (child.hasAttribute("id"))
+      overlay[child.getAttribute("id")] = child;
+  for (let child = event.target.responseXML.firstChild; child; child = child.nextSibling)
+    if (child.nodeType == child.PROCESSING_INSTRUCTION_NODE)
+      overlay._processing.push(child);
+
+  // Initialization done, we can start up now
+  require("inspectorObserver");
+  new WindowObserver({
+    applyToWindow: function(window)
     {
-      if (id != "_processing")
+      window.setTimeout(function()
       {
-        let element = window.document.getElementById(id);
-        if (element)
-          remove.push(element);
-      }
-    }
-
-    for (let child = window.document.firstChild; child; child = child.nextSibling)
-      if (child.nodeType == child.PROCESSING_INSTRUCTION_NODE && child.data.indexOf("elemhidehelper-node") >= 0)
-        remove.push(child);
-
-    for (let i = 0; i < remove.length; i++)
-      remove[i].parentNode.removeChild(remove[i]);
-  },
-
-  get menuItem()
-  {
-    // Randomize URI to work around bug 719376
-    let stringBundle = Services.strings.createBundle("chrome://elemhidehelper/locale/global.properties?" + Math.random());
-    let result = [stringBundle.GetStringFromName("selectelement.label"), stringBundle.GetStringFromName("stopselection.label")];
-
-    delete this.menuItem;
-    this.__defineGetter__("menuItem", function() result);
-    return this.menuItem;
-  },
+        if (onShutdown.done || !window.document.getElementById("abp-hooks"))
+          return;
 
-  observe: function(subject, topic, data)
-  {
-    if (topic == "domwindowopened")
-    {
-      let window = subject.QueryInterface(Ci.nsIDOMWindow);
-      window.addEventListener("load", function()
-      {
-        window.setTimeout(function()
+        for (let id in overlay)
+          if (id != "_processing")
+            window.document.documentElement.appendChild(window.document.importNode(overlay[id], true));
+        for (let i = 0; i < overlay._processing.length; i++)
         {
-          if (this.initialized)
-            this.applyToWindow(window);
-        }.bind(this), 0);
-      }.bind(this), false);
-    }
-  },
-
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObserver])
-};
-
-let InspectorObserver =
-{
-  initialized: false,
-
-  init: function()
-  {
-    if (this.initialized)
-      return;
-    this.initialized = true;
-
-    Services.obs.addObserver(this, "inspector-opened", true);
-  },
-
-  shutdown: function()
-  {
-    if (!this.initialized)
-      return;
-    this.initialized = false;
-
-    Services.obs.removeObserver(this, "inspector-opened");
-  },
+          let node = window.document.importNode(overlay._processing[i], true);
+          node.data += ' class="elemhidehelper-node"';
+          window.document.insertBefore(node, window.document.firstChild);
+        }
 
-  get inspectorButton()
-  {
-    // Randomize URI to work around bug 719376
-    let stringBundle = Services.strings.createBundle("chrome://elemhidehelper/locale/global.properties?" + Math.random());
-    let result = [stringBundle.GetStringFromName("inspector.button.label"), stringBundle.GetStringFromName("inspector.button.accesskey"), stringBundle.GetStringFromName("inspector.button.tooltiptext")];
+        window._ehhWrapper = new WindowWrapper(window, elementMarkerClass);
+      }, 0);
+    },
 
-    delete this.inspectorButton;
-    this.__defineGetter__("inspectorButton", function() result);
-    return this.inspectorButton;
-  },
-
-  observe: function(subject, topic, data)
-  {
-    if (topic != "inspector-opened")
-      return;
+    removeFromWindow: function(window)
+    {
+      if (!window._ehhWrapper)
+        return;
 
-    let InspectorUI = subject.wrappedJSObject;
-    let hooks = InspectorUI.chromeDoc.getElementById("abp-hooks");
-    if (!hooks || !Aardvark.canSelect(hooks.getBrowser()))
-      return;
+      window._ehhWrapper.shutdown();
+      delete window._ehhWrapper;
 
-    let [label, accesskey, tooltiptext] = this.inspectorButton;
-    InspectorUI.registerTool({
-      id: "abp-elemhide",
-      label: label,
-      accesskey: accesskey,
-      tooltiptext: tooltiptext,
-      get isOpen() false,
-      show: function(selection)
+      let remove = [];
+      for (let id in overlay)
       {
-        InspectorUI.chromeWin.openDialog("chrome://elemhidehelper/content/composer.xul", "_blank",
-                                         "chrome,centerscreen,resizable,dialog=no", selection);
-        InspectorUI.closeInspectorUI();
+        if (id != "_processing")
+        {
+          let element = window.document.getElementById(id);
+          if (element)
+            remove.push(element);
+        }
       }
-    });
-  },
-
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObserver])
-};
-
-function WindowWrapper(wnd)
-{
-  this.window = wnd;
-  this.browser = this.E("abp-hooks").getBrowser();
-
-  this.popupShowingHandler = this.popupShowingHandler.bind(this);
-  this.popupHidingHandler = this.popupHidingHandler.bind(this);
-  this.keyPressHandler = this.keyPressHandler.bind(this);
-  this.toggleSelection = this.toggleSelection.bind(this);
-  this.hideTooltips = this.hideTooltips.bind(this);
-  this.stopSelection = this.stopSelection.bind(this);
-
-  this.E("ehh-elementmarker").firstElementChild.setAttribute("class", Main.elementMarkerClass);
-
-  this.init();
-}
-WindowWrapper.prototype =
-{
-  window: null,
-  browser: null,
-
-  init: function()
-  {
-    this.window.addEventListener("popupshowing", this.popupShowingHandler, false);
-    this.window.addEventListener("popuphiding", this.popupHidingHandler, false);
-    this.window.addEventListener("keypress", this.keyPressHandler, false);
-    this.window.addEventListener("blur", this.hideTooltips, true);
-    this.browser.addEventListener("select", this.stopSelection, false);
-  },
-
-  shutdown: function()
-  {
-    this.window.removeEventListener("popupshowing", this.popupShowingHandler, false);
-    this.window.removeEventListener("popuphiding", this.popupHidingHandler, false);
-    this.window.removeEventListener("keypress", this.keyPressHandler, false);
-    this.window.removeEventListener("blur", this.hideTooltips, true);
-    this.browser.removeEventListener("select", this.stopSelection, false);
-  },
-
-  E: function(id)
-  {
-    let doc = this.window.document;
-    this.E = function(id) doc.getElementById(id);
-    return this.E(id);
-  },
-
-  key: undefined,
-
-  popupShowingHandler: function(event)
-  {
-    let popup = event.target;
-    if (!/^(abp-(?:toolbar|status|menuitem)-)popup$/.test(popup.id))
-      return;
-
-    let enabled = Aardvark.canSelect(this.browser);
-    let running = (enabled && this.browser == Aardvark.browser);
-
-    let [labelStart, labelStop] = WindowObserver.menuItem;
-    let item = popup.ownerDocument.createElement("menuitem");
-    item.setAttribute("label", running ? labelStop : labelStart);
-    item.setAttribute("class", "elemhidehelper-item");
-    if (!enabled)
-      item.setAttribute("disabled", "true");
-
-    if (typeof this.key == "undefined")
-      this.configureKey(event.currentTarget);
-    item.setAttribute("acceltext", KeySelector.getTextForKey(this.key));
 
-    item.addEventListener("command", this.toggleSelection, false);
+      for (let child = window.document.firstChild; child; child = child.nextSibling)
+        if (child.nodeType == child.PROCESSING_INSTRUCTION_NODE && child.data.indexOf("elemhidehelper-node") >= 0)
+          remove.push(child);
 
-    let insertBefore = null;
-    for (let child = popup.firstChild; child; child = child.nextSibling)
-      if (/-options$/.test(child.id))
-        insertBefore = child;
-    popup.insertBefore(item, insertBefore);
-  },
-
-  popupHidingHandler: function(event)
-  {
-    let popup = event.target;
-    if (!/^(abp-(?:toolbar|status|menuitem)-)popup$/.test(popup.id))
-      return;
-
-    let items = popup.getElementsByClassName("elemhidehelper-item");
-    if (items.length)
-      items[0].parentNode.removeChild(items[0]);
-  },
-
-  keyPressHandler: function(event)
-  {
-    if (typeof this.key == "undefined")
-      this.configureKey(event.currentTarget);
-
-    if (KeySelector.matchesKey(event, this.key))
-    {
-      event.preventDefault();
-      this.toggleSelection();
+      for (let i = 0; i < remove.length; i++)
+        remove[i].parentNode.removeChild(remove[i]);
     }
-  },
-
-  configureKey: function(window)
-  {
-    this.key = new KeySelector(window).selectKey(Prefs.selectelement_key);
-  },
-
-  hideTooltips: function()
-  {
-    if (Aardvark.window == this.window)
-      Aardvark.hideTooltips();
-  },
-
-  toggleSelection: function()
-  {
-    if (this.browser == Aardvark.browser)
-      this.stopSelection();
-    else
-      this.startSelection();
-  },
-
-  startSelection: function()
-  {
-    Aardvark.start(this);
-  },
-
-  stopSelection: function()
-  {
-    Aardvark.quit();
-  }
-};
+  });
+}, false);
+request.send(null);
diff --git a/windowWrapper.js b/windowWrapper.js
new file mode 100644
index 0000000..29e27a9
--- /dev/null
+++ b/windowWrapper.js
@@ -0,0 +1,156 @@
+/*
+ * This Source Code is subject to the terms of the Mozilla Public License
+ * version 2.0 (the "License"). You can obtain a copy of the License at
+ * http://mozilla.org/MPL/2.0/.
+ */
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+
+let {Aardvark} = require("aardvark");
+let {Prefs} = require("prefs");
+let {KeySelector} = require("keySelector");
+
+let key = undefined;
+
+function getMenuItem()
+{
+  // Randomize URI to work around bug 719376
+  let stringBundle = Services.strings.createBundle("chrome://elemhidehelper/locale/global.properties?" + Math.random());
+  let result = [stringBundle.GetStringFromName("selectelement.label"), stringBundle.GetStringFromName("stopselection.label")];
+
+  getMenuItem = function() result;
+  return getMenuItem();
+}
+
+exports.WindowWrapper = WindowWrapper;
+function WindowWrapper(wnd, elementMarkerClass)
+{
+  this.window = wnd;
+  this.browser = this.E("abp-hooks").getBrowser();
+
+  this.popupShowingHandler = this.popupShowingHandler.bind(this);
+  this.popupHidingHandler = this.popupHidingHandler.bind(this);
+  this.keyPressHandler = this.keyPressHandler.bind(this);
+  this.toggleSelection = this.toggleSelection.bind(this);
+  this.hideTooltips = this.hideTooltips.bind(this);
+  this.stopSelection = this.stopSelection.bind(this);
+
+  this.E("ehh-elementmarker").firstElementChild.setAttribute("class", elementMarkerClass);
+
+  this.init();
+}
+WindowWrapper.prototype =
+{
+  window: null,
+  browser: null,
+
+  init: function()
+  {
+    this.window.addEventListener("popupshowing", this.popupShowingHandler, false);
+    this.window.addEventListener("popuphiding", this.popupHidingHandler, false);
+    this.window.addEventListener("keypress", this.keyPressHandler, false);
+    this.window.addEventListener("blur", this.hideTooltips, true);
+    this.browser.addEventListener("select", this.stopSelection, false);
+  },
+
+  shutdown: function()
+  {
+    this.window.removeEventListener("popupshowing", this.popupShowingHandler, false);
+    this.window.removeEventListener("popuphiding", this.popupHidingHandler, false);
+    this.window.removeEventListener("keypress", this.keyPressHandler, false);
+    this.window.removeEventListener("blur", this.hideTooltips, true);
+    this.browser.removeEventListener("select", this.stopSelection, false);
+  },
+
+  E: function(id)
+  {
+    let doc = this.window.document;
+    this.E = function(id) doc.getElementById(id);
+    return this.E(id);
+  },
+
+  key: undefined,
+
+  popupShowingHandler: function(event)
+  {
+    let popup = event.target;
+    if (!/^(abp-(?:toolbar|status|menuitem)-)popup$/.test(popup.id))
+      return;
+
+    let enabled = Aardvark.canSelect(this.browser);
+    let running = (enabled && this.browser == Aardvark.browser);
+
+    let [labelStart, labelStop] = getMenuItem();
+    let item = popup.ownerDocument.createElement("menuitem");
+    item.setAttribute("label", running ? labelStop : labelStart);
+    item.setAttribute("class", "elemhidehelper-item");
+    if (!enabled)
+      item.setAttribute("disabled", "true");
+
+    if (typeof key == "undefined")
+      this.configureKey(event.currentTarget);
+    item.setAttribute("acceltext", KeySelector.getTextForKey(key));
+
+    item.addEventListener("command", this.toggleSelection, false);
+
+    let insertBefore = null;
+    for (let child = popup.firstChild; child; child = child.nextSibling)
+      if (/-options$/.test(child.id))
+        insertBefore = child;
+    popup.insertBefore(item, insertBefore);
+  },
+
+  popupHidingHandler: function(event)
+  {
+    let popup = event.target;
+    if (!/^(abp-(?:toolbar|status|menuitem)-)popup$/.test(popup.id))
+      return;
+
+    let items = popup.getElementsByClassName("elemhidehelper-item");
+    if (items.length)
+      items[0].parentNode.removeChild(items[0]);
+  },
+
+  keyPressHandler: function(event)
+  {
+    if (typeof key == "undefined")
+      this.configureKey(event.currentTarget);
+
+    if (KeySelector.matchesKey(event, key))
+    {
+      event.preventDefault();
+      this.toggleSelection();
+    }
+  },
+
+  configureKey: function(window)
+  {
+    key = new KeySelector(window).selectKey(Prefs.selectelement_key);
+  },
+
+  hideTooltips: function()
+  {
+    if (Aardvark.window == this.window)
+      Aardvark.hideTooltips();
+  },
+
+  toggleSelection: function()
+  {
+    if (this.browser == Aardvark.browser)
+      this.stopSelection();
+    else
+      this.startSelection();
+  },
+
+  startSelection: function()
+  {
+    Aardvark.start(this);
+  },
+
+  stopSelection: function()
+  {
+    Aardvark.quit();
+  }
+};

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