Skip to content

Commit 91bb654

Browse files
committed
Added foundation for displaying a rulesets applied counter
1 parent 91231b2 commit 91bb654

File tree

3 files changed

+66
-4
lines changed

3 files changed

+66
-4
lines changed

src/chrome/content/toolbar_button.xul

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
oncontextmenu="this.open = true;"
3838
oncommand="this.open = true;"
3939
buttonstyle="pictures"
40-
type="menu">
40+
type="menu"
41+
rulesetsApplied="0">
4142

4243
<menupopup id="https-everywhere-context" onpopupshowing="show_applicable_list(this)">
4344
<!-- entries will be written here by ApplicableList.populate_menu() -->
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
Toolbar button needs to be extended to show a counter for the number of
4+
rulesets applied, and this can be done using XBL.
5+
6+
See: https://developer.mozilla.org/en-US/docs/XBL
7+
-->
8+
<bindings xmlns="http://www.mozilla.org/xbl"
9+
xmlns:xbl="http://www.mozilla.org/xbl"
10+
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
11+
12+
<binding id="https-everywhere-binding">
13+
<content>
14+
<!-- ruleset counter (rscounter) and rulesets applied (rsapplied) -->
15+
<xul:stack id="rscounter">
16+
<xul:label id="rsapplied" xbl:inherits="value=rulesetsApplied" />
17+
</xul:stack>
18+
19+
<!--
20+
Https everywhere toolbar button is already defined; just use its settings.
21+
TODO: Look into any issues with oncommand/oncontext.
22+
-->
23+
<xul:toolbarbutton
24+
class="https-everywhere-button toolbarbutton-1 chromeclass-toolbar-additional"
25+
flex="1"
26+
allowevents="true"
27+
xbl:inherits="type,crop,image,label,accesskey,command,align,dir,pack,orient">
28+
29+
<children includes="menupopup" />
30+
</xul:toolbarbutton>
31+
</content>
32+
</binding>
33+
</bindings>

src/chrome/skin/https-everywhere.css

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,50 @@
11
#https-everywhere-button {
2+
-moz-binding: url("chrome://https-everywhere/content/toolbar_button_binding.xml#https-everywhere-binding");
3+
-moz-box-orient: horizontal;
4+
}
5+
6+
#https-everywhere-button > .https-everywhere-button {
27
list-style-image: url("chrome://https-everywhere/skin/https-everywhere-24.png");
38
-moz-box-orient: horizontal;
49
}
510

6-
toolbar[iconsize="small"] #https-everywhere-button {
11+
toolbar[iconsize="small"] #https-everywhere-button > .https-everywhere-button {
712
list-style-image: url("chrome://https-everywhere/skin/https-everywhere-16.png");
813
-moz-box-orient: horizontal;
914
}
1015

1116
/* Use CSS attribute selector for changing icon */
12-
#https-everywhere-button[status="disabled"] {
17+
#https-everywhere-button[status="disabled"] > .https-everywhere-button {
1318
list-style-image: url("chrome://https-everywhere/skin/https-everywhere-24-gray.png");
1419
}
1520

16-
toolbar[iconsize="small"] #https-everywhere-button[status="disabled"] {
21+
toolbar[iconsize="small"] #https-everywhere-button[status="disabled"] > .https-everywhere-button {
1722
list-style-image: url("chrome://https-everywhere/skin/https-everywhere-16-gray.png");
1823
}
1924

25+
/* ruleset counter */
26+
#rscounter {
27+
margin: 3px -12px 0 -8px;
28+
display: block;
29+
-moz-box-sizing: border-box;
30+
}
31+
32+
/* rulesets applied label */
33+
#rsapplied {
34+
-moz-box-sizing: border-box;
35+
font-size: 12px;
36+
color: #000;
37+
background-color: #FFF;
38+
border-width: 1px;
39+
border-style: solid;
40+
padding: 1px 1px 1px 1px;
41+
visibility: hidden;
42+
}
43+
44+
#https-everywhere-button:not([rulesetsApplied="0"]) #rsapplied {
45+
visibility: visible;
46+
}
47+
2048
#https-everywhere-button menuitem.active-item label {
2149
color: #9AD100;
2250
font-weight: bold;

0 commit comments

Comments
 (0)