[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 238/483: Composer: Warn when adding a filter to a disabled group

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:45 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 7f8fe0a6ca8a429e83b069ad62c3fb69320335dc
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Fri Oct 22 17:32:16 2010 +0200

    Composer: Warn when adding a filter to a disabled group
---
 chrome/content/composer.js       | 15 +++++++++++++--
 chrome/content/composer.xul      |  2 ++
 chrome/locale/en-US/composer.dtd |  5 +++++
 chrome/skin/composer.css         |  5 +++++
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/chrome/content/composer.js b/chrome/content/composer.js
index 8cdd32d..a0a2db0 100644
--- a/chrome/content/composer.js
+++ b/chrome/content/composer.js
@@ -36,6 +36,9 @@ var stylesheetURL;
 var previewStyle = null;
 var doc;
 
+let abpURL = Cc["@adblockplus.org/abp/public;1"].getService(Ci.nsIURI);
+Cu.import(abpURL.spec);
+
 /*******************
  * NodeData object *
  *******************/
@@ -154,6 +157,16 @@ function init() {
   doc = element.ownerDocument;
   var wnd = doc.defaultView;
 
+  // Check whether element hiding group is disabled
+  let subscription = AdblockPlus.getSubscription("~eh~");
+  if (subscription && subscription.disabled)
+  {
+    let warning = document.getElementById("groupDisabledWarning");
+    if (/\?1\?/.test(warning.textContent))
+      warning.textContent = warning.textContent.replace(/\?1\?/g, subscription.title);
+    warning.hidden = false;
+  }
+
   nodeData = new NodeData(element);
   nodeData.tagName.checked = true;
   if (nodeData.attributes.length > 0) {
@@ -572,8 +585,6 @@ function updateNodeSelection() {
 
 function addExpression()
 {
-  let abpURL = Cc["@adblockplus.org/abp/public;1"].getService(Ci.nsIURI);
-  Cu.import(abpURL.spec);
   AdblockPlus.addPatterns([document.getElementById("expression").value]);
 
   togglePreview(false);
diff --git a/chrome/content/composer.xul b/chrome/content/composer.xul
index f2f45e7..09b0d25 100644
--- a/chrome/content/composer.xul
+++ b/chrome/content/composer.xul
@@ -48,6 +48,8 @@
     windowtype="ehh:composer">
   <script type="application/x-javascript" src="composer.js"/>  
   
+  <description id="groupDisabledWarning" hidden="true">&groupDisabled.warning;</description>
+
   <vbox id="expressionBox">
     <label control="expression" value="&expression.label;"/>
     <hbox>
diff --git a/chrome/locale/en-US/composer.dtd b/chrome/locale/en-US/composer.dtd
index de6caec..6ca8dff 100644
--- a/chrome/locale/en-US/composer.dtd
+++ b/chrome/locale/en-US/composer.dtd
@@ -23,6 +23,11 @@
    - ***** END LICENSE BLOCK ***** -->
 
 <!ENTITY dialog.title             "Compose element hiding rule">
+<!ENTITY groupDisabled.warning    "
+  The filter group "?1?" that this filter will be added to is currently disabled.
+  You can still add the filter but it will not be applied unless you enable the filter group
+  in Adblock Plus preferences.
+">
 <!ENTITY accept.label             "Add element hiding rule">
 <!ENTITY advanced.label           "Advanced view">
 <!ENTITY basic.label              "Basic view">
diff --git a/chrome/skin/composer.css b/chrome/skin/composer.css
index b3d5736..6acc31c 100644
--- a/chrome/skin/composer.css
+++ b/chrome/skin/composer.css
@@ -29,6 +29,11 @@ scrollbox
   overflow: auto;
 }
 
+#groupDisabledWarning
+{
+  color: red;
+}
+
 dialog:not([advancedMode=true]) #nodes-tree,
 dialog:not([advancedMode=true]) #nodes-tree-splitter
 {

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