[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 34/483: Adding "First child" attribute

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:24 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 67debdf1b81606fcc685f480e36985d1c6a5839a
Author: Wladimir Palant <trev at gtchat.de>
Date:   Tue Jan 16 21:01:17 2007 +0000

    Adding "First child" attribute
    
    --HG--
    extra : convert_revision : svn%3Ad8bf93c1-8190-44a8-bb31-1ea94378a4df/trunk%40634
---
 chrome/content/composer.js       | 18 ++++++++++++++++++
 chrome/content/composer.xul      |  5 ++++-
 chrome/locale/en-US/composer.dtd |  1 +
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/chrome/content/composer.js b/chrome/content/composer.js
index 5047c8f..c0063ab 100644
--- a/chrome/content/composer.js
+++ b/chrome/content/composer.js
@@ -47,6 +47,9 @@ function NodeData(node, parentNode) {
     prevSibling = prevSibling.previousSibling;
   this.prevSibling = (prevSibling ? new NodeData(prevSibling, this.parentNode) : null);
 
+  if (!prevSibling)
+    this.firstChild = {checked: false};
+
   this.attributes = [];
   for (var i = 0; i < node.attributes.length; i++) {
     var attribute = node.attributes[i];
@@ -241,6 +244,11 @@ function updateExpression() {
                                         .replace(/\}/, "\\7D ");
     }
 
+    if ("firstChild" in curNode && curNode.firstChild.checked) {
+      expressionSimple = null;
+      expressionRaw += ":first-child";
+    }
+
     curNode.expressionSimple = expressionSimple;
     curNode.expressionRaw = expressionRaw;
 
@@ -432,6 +440,16 @@ function fillAttributes(nodeData) {
   node.setAttribute("label", list.getAttribute("_labeltagname") + " " + nodeData.tagName.value);
   list.appendChild(node);
 
+  // Add first/last child entries
+  if (advancedMode && "firstChild" in nodeData) {
+    var node = document.createElement("attribute");
+    node.attr = nodeData.firstChild;
+    node.setAttribute("notextbox", "true");
+    node.setAttribute("checked", nodeData.firstChild.checked);
+    node.setAttribute("label", list.getAttribute("_labelfirstchild"));
+    list.appendChild(node);
+  }
+
   // Add attribute entries
   for (var i = 0; i < nodeData.attributes.length; i++) {
     var attr = nodeData.attributes[i];
diff --git a/chrome/content/composer.xul b/chrome/content/composer.xul
index 5459dfe..82dcf6e 100644
--- a/chrome/content/composer.xul
+++ b/chrome/content/composer.xul
@@ -77,7 +77,10 @@
           <treechildren id="nodes-tree-children"/>
         </tree>
         <splitter id="nodes-tree-splitter"/>
-        <scrollbox id="attributes-list" orient="vertical" flex="1" _labeltagname="&attributes.tagname.label;" _labelcustom="&attributes.custom.label;"/>
+        <scrollbox id="attributes-list" orient="vertical" flex="1"
+            _labeltagname="&attributes.tagname.label;"
+            _labelfirstchild="&attributes.firstchild.label;"
+            _labelcustom="&attributes.custom.label;"/>
       </hbox>
     </groupbox>
   </hbox>
diff --git a/chrome/locale/en-US/composer.dtd b/chrome/locale/en-US/composer.dtd
index ffaf377..b799b11 100644
--- a/chrome/locale/en-US/composer.dtd
+++ b/chrome/locale/en-US/composer.dtd
@@ -35,4 +35,5 @@
 <!ENTITY nodes-tree.class.label   "class">
 <!ENTITY attributes.label         "Require attributes">
 <!ENTITY attributes.tagname.label "Tag name:">
+<!ENTITY attributes.firstchild.label  "First child">
 <!ENTITY attributes.custom.label  "Custom CSS:">

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