[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 10/483: Adding button to switch between advanced and basic mode
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 2066b71ae66e7e7bf36b968f649d67a5894e20b1
Author: Wladimir Palant <trev at gtchat.de>
Date: Mon Jan 8 17:28:35 2007 +0000
Adding button to switch between advanced and basic mode
--HG--
extra : convert_revision : svn%3Ad8bf93c1-8190-44a8-bb31-1ea94378a4df/trunk%40607
---
chrome/content/composer.js | 18 +++++++++++++++---
chrome/content/composer.xul | 10 +++++++---
chrome/locale/en-US/composer.dtd | 2 ++
chrome/skin/classic/composer.css | 10 +++++++++-
4 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/chrome/content/composer.js b/chrome/content/composer.js
index 8bc254f..422f58c 100644
--- a/chrome/content/composer.js
+++ b/chrome/content/composer.js
@@ -25,6 +25,7 @@
var domainData;
var nodeData;
var selectedNode = null;
+var advancedMode = false;
function NodeData(node, parentNode) {
this.tagName = {value: node.tagName, checked: false};
@@ -90,11 +91,10 @@ function init() {
domainData = {value: domain, selected: selectedDomain};
fillNodes(nodeData);
-
updateExpression();
+ setAdvancedMode(document.documentElement.getAttribute("advancedMode") == "true");
setTimeout(function() {
- fillAttributes(nodeData);
fillDomains(domainData);
document.getElementById("domainGroup").selectedItem.focus();
}, 0);
@@ -289,7 +289,7 @@ function fillNodes(nodeData) {
}
var tree = document.getElementById("nodes-tree");
- var body = tree.treeBoxObject.treeBody;
+ var body = document.getElementById("nodes-tree-children");
while (curContainer.firstChild)
body.appendChild(curContainer.firstChild);
@@ -355,6 +355,18 @@ function toggleAttr(node) {
updateExpression();
}
+function setAdvancedMode(mode) {
+ advancedMode = mode;
+
+ var dialog = document.documentElement;
+ dialog.setAttribute("advancedMode", advancedMode);
+
+ var button = dialog.getButton("disclosure");
+ button.setAttribute("label", dialog.getAttribute(advancedMode ? "buttonlabeldisclosure_off" : "buttonlabeldisclosure_on"));
+
+ fillAttributes(nodeData);
+}
+
function updateNodeSelection() {
var tree = document.getElementById("nodes-tree");
var selection = tree.view.selection;
diff --git a/chrome/content/composer.xul b/chrome/content/composer.xul
index 86ee05e..6f7cdf5 100644
--- a/chrome/content/composer.xul
+++ b/chrome/content/composer.xul
@@ -34,12 +34,16 @@
title="&dialog.title;"
onload="init()"
ondialogaccept="addExpression()"
- buttons="accept,cancel"
+ ondialogdisclosure="setAdvancedMode(!advancedMode)"
+ buttons="accept,cancel,disclosure"
width="600px"
height="400px"
persist="screenX screenY width height sizemode advancedMode"
advancedMode="false"
buttonlabelaccept="&accept.label;"
+ buttonlabeldisclosure="&advanced.label;"
+ buttonlabeldisclosure_on="&advanced.label;"
+ buttonlabeldisclosure_off="&basic.label;"
windowtype="ehh:composer">
<script type="application/x-javascript" src="composer.js"/>
@@ -67,9 +71,9 @@
<splitter class="tree-splitter"/>
<treecol id="nodes-tree-class" label="&nodes-tree.class.label;" flex="1" persist="width ordinal hidden"/>
</treecols>
- <treechildren/>
+ <treechildren id="nodes-tree-children"/>
</tree>
- <splitter/>
+ <splitter id="nodes-tree-splitter"/>
<scrollbox flex="1" orient="vertical">
<checkbox id="attribute-template" label="&attributes.tagname.label;" hidden="true" oncommand="toggleAttr(this)"/>
</scrollbox>
diff --git a/chrome/locale/en-US/composer.dtd b/chrome/locale/en-US/composer.dtd
index 5084f99..5dbe919 100644
--- a/chrome/locale/en-US/composer.dtd
+++ b/chrome/locale/en-US/composer.dtd
@@ -24,6 +24,8 @@
<!ENTITY dialog.title "Compose element hiding rule">
<!ENTITY accept.label "Add filter rule">
+<!ENTITY advanced.label "Advanced view">
+<!ENTITY basic.label "Basic view">
<!ENTITY expression.label "Filter rule">
<!ENTITY domain.label "Bind to domain">
<!ENTITY domain.none.label "Any domain (not recommended)">
diff --git a/chrome/skin/classic/composer.css b/chrome/skin/classic/composer.css
index 503a4b4..a576b21 100644
--- a/chrome/skin/classic/composer.css
+++ b/chrome/skin/classic/composer.css
@@ -24,6 +24,14 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
-scrollbox {
+scrollbox
+{
overflow: auto;
}
+
+dialog:not([advancedMode=true]) #nodes-tree,
+dialog:not([advancedMode=true]) #nodes-tree-splitter
+{
+ 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