[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 12/483: Highlight nodes used in the expression
David Prévot
taffit at moszumanska.debian.org
Thu Jan 22 21:41:22 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 5bdd7c89ffe0bcfe46ffb7a4025a5b93950701c4
Author: Wladimir Palant <trev at gtchat.de>
Date: Mon Jan 8 21:54:42 2007 +0000
Highlight nodes used in the expression
--HG--
extra : convert_revision : svn%3Ad8bf93c1-8190-44a8-bb31-1ea94378a4df/trunk%40609
---
chrome/content/composer.js | 38 +++++++++++++++++++++++++++++++++++++-
chrome/skin/classic/composer.css | 6 ++++++
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/chrome/content/composer.js b/chrome/content/composer.js
index e94deb1..22ae484 100644
--- a/chrome/content/composer.js
+++ b/chrome/content/composer.js
@@ -91,8 +91,8 @@ function init() {
domainData = {value: domain, selected: selectedDomain};
fillNodes(nodeData);
- updateExpression();
setAdvancedMode(document.documentElement.getAttribute("advancedMode") == "true");
+ updateExpression();
setTimeout(function() {
fillDomains(domainData);
@@ -136,6 +136,15 @@ function updateExpression() {
curNode.expressionSimple = expressionSimple;
curNode.expressionRaw = expressionRaw;
+ var cells = curNode.treeCells;
+ var row = curNode.treeRow;
+ var properties = (expressionRaw != "*" || curNode == nodeData ? "anchor" : "");
+ if (properties != "" && curNode != selectedNode)
+ properties += " selected-false";
+ for (var i = 0; i < cells.length; i++)
+ cells[i].setAttribute("properties", properties);
+ row.setAttribute("properties", properties);
+
if (expressionSimple == null || (expressionRaw != "*" && curNode != nodeData))
simpleMode = false;
@@ -244,23 +253,29 @@ function fillNodes(nodeData) {
if (nodeData.attributes.length > i && nodeData.attributes[i].name == "class")
className = nodeData.attributes[i++].value;
+ nodeData.treeCells = [];
+
var item = document.createElement("treeitem");
var row = document.createElement("treerow");
var cell = document.createElement("treecell");
cell.setAttribute("label", nodeData.tagName.value);
row.appendChild(cell);
+ nodeData.treeCells.push(cell);
var cell = document.createElement("treecell");
cell.setAttribute("label", id);
row.appendChild(cell);
+ nodeData.treeCells.push(cell);
var cell = document.createElement("treecell");
cell.setAttribute("label", className);
row.appendChild(cell);
+ nodeData.treeCells.push(cell);
item.appendChild(row);
item.nodeData = nodeData;
+ nodeData.treeRow = row;
nodeData.treeItem = item;
if (curChildren) {
@@ -403,7 +418,28 @@ function updateNodeSelection() {
if (!item || !item.nodeData)
return;
+ if (selectedNode != null) {
+ // HACKHACK: Adjust selected-false property
+ var cells = selectedNode.treeCells;
+ for (var i = 0; i < cells.length; i++)
+ if (cells[i].getAttribute("properties"))
+ cells[i].setAttribute("properties", cells[i].getAttribute("properties") + " selected-false");
+
+ var row = selectedNode.treeRow;
+ if (row.getAttribute("properties"))
+ row.setAttribute("properties", row.getAttribute("properties") + " selected-false");
+ }
+
fillAttributes(item.nodeData);
+
+ cells = selectedNode.treeCells;
+ for (i = 0; i < cells.length; i++)
+ if (cells[i].getAttribute("properties"))
+ cells[i].setAttribute("properties", cells[i].getAttribute("properties").replace(/ selected-false$/, ''));
+
+ row = selectedNode.treeRow;
+ if (row.getAttribute("properties"))
+ row.setAttribute("properties", row.getAttribute("properties").replace(/ selected-false$/, ''));
}
function addExpression() {
diff --git a/chrome/skin/classic/composer.css b/chrome/skin/classic/composer.css
index 85f44e7..ba6c1b5 100644
--- a/chrome/skin/classic/composer.css
+++ b/chrome/skin/classic/composer.css
@@ -36,3 +36,9 @@ dialog:not([advancedMode=true]) #attribute-custom
display: none;
}
+treechildren::-moz-tree-cell-text(anchor) {
+ font-weight: bold;
+}
+treechildren::-moz-tree-row(anchor, selected-false) {
+ background-color: #FFC0C0;
+}
--
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