[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 06/483: Make context menu initialization work in SeaMonkey
David Prévot
taffit at moszumanska.debian.org
Thu Jan 22 21:41:21 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 8795af8b7532df474390c4729e3ce894a23db98d
Author: Wladimir Palant <trev at gtchat.de>
Date: Mon Jan 8 10:37:44 2007 +0000
Make context menu initialization work in SeaMonkey
--HG--
extra : convert_revision : svn%3Ad8bf93c1-8190-44a8-bb31-1ea94378a4df/trunk%40603
---
chrome/content/overlay.js | 52 +++++++++++++++++++++++++++++++++++++----------
1 file changed, 41 insertions(+), 11 deletions(-)
diff --git a/chrome/content/overlay.js b/chrome/content/overlay.js
index bf5bc92..b3f962c 100644
--- a/chrome/content/overlay.js
+++ b/chrome/content/overlay.js
@@ -25,10 +25,27 @@
window.addEventListener("load", ehhInit, false);
function ehhInit() {
- document.getElementById("abp-status-popup").addEventListener("popupshowing", ehhFillPopup, false);
- document.getElementById("abp-toolbar-popup").addEventListener("popupshowing", ehhFillPopup, false);
+ if (document.getElementById("abp-status-popup"))
+ document.getElementById("abp-status-popup").addEventListener("popupshowing", ehhFillPopup, false);
+ if (document.getElementById("abp-toolbar-popup"))
+ document.getElementById("abp-toolbar-popup").addEventListener("popupshowing", ehhFillPopup, false);
window.addEventListener("blur", ehhHideTooltips, true);
getBrowser().addEventListener("select", ehhStop, false);
+
+ // Make sure we configure the shortcut key even if the default pref isn't there
+ if (window.abpConfigureKey) {
+ var prefService = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefService);
+ var defaultBranch = prefService.getDefaultBranch("extensions.adblockplus.");
+ if (!defaultBranch.prefHasUserValue("ehh-selectelement_key")) {
+ var key = "Accel Shift H";
+ try {
+ key = prefService.getBranch("extensions.adblockplus.")
+ .getCharPref("ehh-selectelement_key");
+ } catch(e) {}
+ abpConfigureKey("ehh-selectelement", key);
+ }
+ }
}
function ehhHideTooltips() {
@@ -36,18 +53,31 @@ function ehhHideTooltips() {
document.getElementById("ehh-commandlabel").hidePopup();
}
-function ehhFillPopup() {
- var enabled = (window.content && content.document instanceof HTMLDocument && content.location.href != "about:blank");
- var running = (enabled && window.content == ehhAardvark.wnd);
+function ehhDisableElement(id, disable) {
+ var element = document.getElementById();
+ if (element)
+ element.setAttribute("disabled", disable);
+}
- document.getElementById("abp-status-ehh-selectelement").setAttribute("disabled", !enabled);
- document.getElementById("abp-toolbar-ehh-selectelement").setAttribute("disabled", !enabled);
+function ehhHideElement(id, hide) {
+ var element = document.getElementById();
+ if (element)
+ element.hidden = hide;
+}
- document.getElementById("abp-status-ehh-selectelement").hidden = running;
- document.getElementById("abp-toolbar-ehh-selectelement").hidden = running;
+function ehhFillPopup(event) {
+ var popup = event.target.getAttribute("id");
+ if (popup.match(/-/g).length != 2)
+ return;
+
+ popup = popup.replace(/popup$/, '');
+
+ var enabled = (window.content && content.document instanceof HTMLDocument && content.location.href != "about:blank");
+ var running = (enabled && window.content == ehhAardvark.wnd);
- document.getElementById("abp-status-ehh-stopselection").hidden = !running;
- document.getElementById("abp-toolbar-ehh-stopselection").hidden = !running;
+ document.getElementById(popup + "ehh-selectelement").setAttribute("disabled", !enabled);
+ document.getElementById(popup + "ehh-selectelement").hidden = running;
+ document.getElementById(popup + "ehh-stopselection").hidden = !running;
}
function ehhSelectElement() {
--
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