[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 32/483: Move attribute markup into XBL
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 cf1bc6642567503f6a036b881fe890e7628cb60e
Author: Wladimir Palant <trev at gtchat.de>
Date: Mon Jan 15 22:34:33 2007 +0000
Move attribute markup into XBL
--HG--
extra : convert_revision : svn%3Ad8bf93c1-8190-44a8-bb31-1ea94378a4df/trunk%40632
---
chrome/content/attribute.xml | 74 ++++++++++++++++++++++++++++++++++++++++
chrome/content/composer.js | 69 ++++++++++++++++---------------------
chrome/content/composer.xul | 17 +--------
chrome/skin/classic/composer.css | 34 +++++++++++-------
4 files changed, 125 insertions(+), 69 deletions(-)
diff --git a/chrome/content/attribute.xml b/chrome/content/attribute.xml
new file mode 100644
index 0000000..496a799
--- /dev/null
+++ b/chrome/content/attribute.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+
+<!-- ***** BEGIN LICENSE BLOCK *****
+ - Version: MPL 1.1
+ -
+ - The contents of this file are subject to the Mozilla Public License Version
+ - 1.1 (the "License"); you may not use this file except in compliance with
+ - the License. You may obtain a copy of the License at
+ - http://www.mozilla.org/MPL/
+ -
+ - Software distributed under the License is distributed on an "AS IS" basis,
+ - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ - for the specific language governing rights and limitations under the
+ - License.
+ -
+ - The Original Code is Adblock Plus Element Hiding Helper.
+ -
+ - The Initial Developer of the Original Code is
+ - Wladimir Palant.
+ - Portions created by the Initial Developer are Copyright (C) 2006
+ - the Initial Developer. All Rights Reserved.
+ -
+ - Contributor(s):
+ -
+ - ***** END LICENSE BLOCK ***** -->
+
+<bindings id="attributeBindings"
+ xmlns="http://www.mozilla.org/xbl"
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:xbl="http://www.mozilla.org/xbl">
+
+ <binding id="attributeBasic">
+ <content>
+ <xul:checkbox anonid="checkbox" xbl:inherits="checked,label"/>
+ </content>
+ <implementation>
+ <property name="checked">
+ <getter>
+ return document.getAnonymousElementByAttribute(this, "anonid", "checkbox").checked;
+ </getter>
+ </property>
+ </implementation>
+ <handlers>
+ <handler event="command" phase="bubble" action="toggleAttr(event.currentTarget);"/>
+ <handler event="focus" phase="bubble" action="event.currentTarget.setAttribute('selected', 'true');"/>
+ <handler event="blur" phase="bubble" action="event.currentTarget.removeAttribute('selected');"/>
+ </handlers>
+ </binding>
+
+ <binding id="attributeAdvanced" extends="chrome://elemhidehelper/content/attribute.xml#attributeBasic">
+ <content>
+ <xul:checkbox anonid="checkbox" xbl:inherits="checked"/>
+ <xul:vbox flex="1">
+ <xul:label anonid="label" xbl:inherits="value=label" onclick="document.getAnonymousElementByAttribute(this.parentNode.parentNode, 'anonid', 'checkbox').click();"/>
+ <xul:textbox anonid="textbox" xbl:inherits="value"/>
+ </xul:vbox>
+ </content>
+ <implementation>
+ <constructor>
+ var randID = new String(Math.random()).replace(/\D/g, "");
+ document.getAnonymousElementByAttribute(this, "anonid", "checkbox").setAttribute("id", randID);
+ document.getAnonymousElementByAttribute(this, "anonid", "label").setAttribute("control", randID);
+ </constructor>
+ <property name="value">
+ <getter>
+ return document.getAnonymousElementByAttribute(this, "anonid", "textbox").value;
+ </getter>
+ </property>
+ </implementation>
+ <handlers>
+ <handler event="input" phase="bubble" action="setSelectedAttrValue(event.currentTarget);"/>
+ </handlers>
+ </binding>
+</bindings>
diff --git a/chrome/content/composer.js b/chrome/content/composer.js
index a560f6e..b115525 100644
--- a/chrome/content/composer.js
+++ b/chrome/content/composer.js
@@ -410,52 +410,41 @@ function fillNodes(nodeData) {
}
function fillAttributes(nodeData) {
- var template = document.getElementById("attribute-template");
- var customCSS = document.getElementById("attribute-custom");
- var customCSSCheck = document.getElementById("attribute-custom-check");
- var customCSSField = document.getElementById("attribute-custom-field");
selectedNode = nodeData;
- // Remove everything between our template and the custom CSS field
- var child = template.nextSibling;
- while (child) {
- var nextChild = child.nextSibling;
- if (child == customCSS)
- break;
+ var list = document.getElementById("attributes-list");
+ while(list.firstChild)
+ list.removeChild(list.firstChild);
- child.parentNode.removeChild(child);
- child = nextChild;
- }
-
- // Add tag name checkbox
- var node = template.cloneNode(true);
- node.hidden = false;
- node.removeAttribute("id");
+ // Add tag name entry
+ var node = document.createElement("attribute");
node.attr = nodeData.tagName;
- var description = node.getElementsByTagName("description")[0];
- description.setAttribute("value", description.getAttribute("value") + " " + nodeData.tagName.value);
- node.getElementsByTagName("checkbox")[0].setAttribute("checked", nodeData.tagName.checked);
- template.parentNode.insertBefore(node, customCSS);
+ node.setAttribute("notextbox", "true");
+ node.setAttribute("checked", nodeData.tagName.checked);
+ node.setAttribute("label", list.getAttribute("_labeltagname") + " " + nodeData.tagName.value);
+ list.appendChild(node);
- // Add attribute checkboxes
+ // Add attribute entries
for (var i = 0; i < nodeData.attributes.length; i++) {
var attr = nodeData.attributes[i];
- node = template.cloneNode(true);
- node.hidden = false;
- node.removeAttribute("id");
+ node = document.createElement("attribute");
node.attr = attr;
- node.getElementsByTagName("description")[0].setAttribute("value", attr.name + ": " + attr.value);
- node.getElementsByTagName("checkbox")[0].setAttribute("checked", attr.checked);
- node.getElementsByTagName("textbox")[0].setAttribute("value", attr.selected);
- node.getElementsByTagName("textbox")[0].hidden = false;
- template.parentNode.insertBefore(node, customCSS);
+ node.setAttribute("checked", attr.checked);
+ node.setAttribute("label", attr.name + ": " + attr.value);
+ node.setAttribute("value", attr.selected);
+ list.appendChild(node);
}
- // Initialize custom CSS field
- customCSS.attr = nodeData.customCSS;
- customCSSCheck.setAttribute("checked", nodeData.customCSS.checked);
- customCSSField.value = nodeData.customCSS.selected;
+ if (advancedMode) {
+ // Add custom CSS entry
+ node = document.createElement("attribute");
+ node.attr = nodeData.customCSS;
+ node.setAttribute("checked", nodeData.customCSS.checked);
+ node.setAttribute("label", list.getAttribute("_labelcustom"));
+ node.setAttribute("value", nodeData.customCSS.selected);
+ list.appendChild(node);
+ }
}
function togglePreview(preview) {
@@ -480,14 +469,14 @@ function changeDomain(node) {
updateExpression();
}
-function toggleAttr(editor, node) {
- editor.attr.checked = node.checked;
+function toggleAttr(node) {
+ node.attr.checked = node.checked;
updateExpression();
}
-function setSelectedAttrValue(editor, node) {
- editor.attr.selected = node.value;
- if (editor.attr.checked)
+function setSelectedAttrValue(node) {
+ node.attr.selected = node.value;
+ if (node.attr.checked)
updateExpression();
}
diff --git a/chrome/content/composer.xul b/chrome/content/composer.xul
index 293d23c..c6496e1 100644
--- a/chrome/content/composer.xul
+++ b/chrome/content/composer.xul
@@ -79,22 +79,7 @@
<treechildren id="nodes-tree-children"/>
</tree>
<splitter id="nodes-tree-splitter"/>
- <scrollbox flex="1" orient="vertical">
- <hbox id="attribute-template" class="attribute" hidden="true">
- <checkbox oncommand="toggleAttr(this.parentNode, this)"/>
- <vbox flex="1">
- <description value="&attributes.tagname.label;"/>
- <textbox oninput="setSelectedAttrValue(this.parentNode.parentNode, this)" hidden="true"/>
- </vbox>
- </hbox>
- <hbox id="attribute-custom" class="attribute">
- <checkbox id="attribute-custom-check" oncommand="toggleAttr(this.parentNode, this)"/>
- <vbox flex="1">
- <description value="&attributes.custom.label;"/>
- <textbox id="attribute-custom-field" oninput="setSelectedAttrValue(this.parentNode.parentNode, this)"/>
- </vbox>
- </hbox>
- </scrollbox>
+ <scrollbox id="attributes-list" orient="vertical" flex="1" _labeltagname="&attributes.tagname.label;" _labelcustom="&attributes.custom.label;"/>
</hbox>
</groupbox>
</hbox>
diff --git a/chrome/skin/classic/composer.css b/chrome/skin/classic/composer.css
index d57e4d0..31c2d72 100644
--- a/chrome/skin/classic/composer.css
+++ b/chrome/skin/classic/composer.css
@@ -30,30 +30,38 @@ scrollbox
}
dialog:not([advancedMode=true]) #nodes-tree,
-dialog:not([advancedMode=true]) #nodes-tree-splitter,
-dialog:not([advancedMode=true]) #attribute-custom,
-dialog:not([advancedMode=true]) #attributes textbox
+dialog:not([advancedMode=true]) #nodes-tree-splitter
{
display: none;
}
-treechildren::-moz-tree-cell-text(anchor) {
+treechildren::-moz-tree-cell-text(anchor)
+{
font-weight: bold;
}
-treechildren::-moz-tree-row(anchor, selected-false) {
+treechildren::-moz-tree-row(anchor, selected-false)
+{
background-color: #FFC0C0;
}
-#attributes .attribute {
- margin-bottom: 10px;
-}
-#attributes checkbox .checkbox-label-box {
- display: none;
+attribute
+{
+ -moz-binding: url(chrome://elemhidehelper/content/attribute.xml#attributeBasic);
+ padding: 5px;
}
-#attributes checkbox + vbox {
+attribute vbox
+{
border: 1px solid transparent;
}
-#attributes checkbox:focus + vbox {
+attribute[selected="true"] vbox
+{
border: 1px dotted ThreeDDarkShadow;
}
-
+dialog[advancedMode=true] attribute:not([notextbox])
+{
+ -moz-binding: url(chrome://elemhidehelper/content/attribute.xml#attributeAdvanced);
+}
+dialog[advancedMode=true] attribute:not([notextbox]) .checkbox-label-box
+{
+ display: none;
+}
--
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