@@ -72,6 +72,9 @@ ApplicableList.prototype = {
7272 HTTPSEverywhere . instance . https_rules . rewrittenURI ( this , this . doc . baseURIObject ) ;
7373 this . log ( DBUG , "populating using alist #" + this . serial ) ;
7474 this . document = document ;
75+
76+ var https_everywhere = CC [ "@eff.org/https-everywhere;1" ] . getService ( Components . interfaces . nsISupports ) . wrappedJSObject ;
77+ var o_httpsprefs = https_everywhere . get_prefs ( ) ;
7578
7679 // get the menu popup
7780 this . menupopup = menupopup ;
@@ -82,10 +85,17 @@ ApplicableList.prototype = {
8285 }
8386
8487 // add global enable/disable toggle button
88+ var strings = document . getElementById ( "HttpsEverywhereStrings" ) ;
89+
8590 var enableLabel = document . createElement ( 'menuitem' ) ;
86- enableLabel . setAttribute ( 'label' , 'Enable / Disable HTTPS Everywhere' ) ;
87- enableLabel . setAttribute ( 'command' , 'https-everywhere-menuitem-globalEnableToggle' ) ;
91+ var text = strings . getString ( "https-everywhere.menu.globalDisable" ) ;
92+ if ( ! o_httpsprefs . getBoolPref ( "globalEnabled" ) )
93+ text = strings . getString ( "https-everywhere.menu.globalEnable" ) ;
8894
95+ enableLabel . setAttribute ( 'label' , text ) ;
96+ enableLabel . setAttribute ( 'command' , 'https-everywhere-menuitem-globalEnableToggle' ) ;
97+ this . prepend_child ( enableLabel ) ;
98+
8999 // add the label at the top
90100 var any_rules = false
91101 for ( var x in this . all ) {
@@ -135,9 +145,6 @@ ApplicableList.prototype = {
135145
136146 //Search for applicable rulesets for the host listed in the location bar
137147 var alist = HTTPSRules . potentiallyApplicableRulesets ( fromHost ) ;
138-
139- https_everywhere = CC [ "@eff.org/https-everywhere;1" ] . getService ( Components . interfaces . nsISupports ) . wrappedJSObject ;
140- o_httpsprefs = https_everywhere . get_prefs ( ) ;
141148
142149 for ( var i = 0 ; i < alist . length ; i ++ ) {
143150 //For each applicable rulset, determine active/inactive, and append to proper list.
@@ -158,22 +165,24 @@ ApplicableList.prototype = {
158165 for ( var x in this . inactive )
159166 this . add_command ( this . inactive [ x ] ) ;
160167
161- // add all the menu items
162- for ( var x in this . inactive )
163- this . add_menuitem ( this . inactive [ x ] , 'inactive' ) ;
164- // rules that are active for some uris are not really moot
165- for ( var x in this . moot )
166- if ( ! ( x in this . active ) )
167- this . add_menuitem ( this . moot [ x ] , 'moot' ) ;
168- // break once break everywhere
169- for ( var x in this . active )
170- if ( ! ( x in this . breaking ) )
171- this . add_menuitem ( this . active [ x ] , 'active' ) ;
172- for ( var x in this . breaking )
173- this . add_menuitem ( this . breaking [ x ] , 'breaking' ) ;
174-
175- this . prepend_child ( label ) ;
176- this . prepend_child ( enableLabel ) ;
168+ if ( o_httpsprefs . getBoolPref ( "globalEnabled" ) ) {
169+ // add all the menu items
170+ for ( var x in this . inactive )
171+ this . add_menuitem ( this . inactive [ x ] , 'inactive' ) ;
172+ // rules that are active for some uris are not really moot
173+ for ( var x in this . moot )
174+ if ( ! ( x in this . active ) )
175+ this . add_menuitem ( this . moot [ x ] , 'moot' ) ;
176+ // break once break everywhere
177+ for ( var x in this . active )
178+ if ( ! ( x in this . breaking ) )
179+ this . add_menuitem ( this . active [ x ] , 'active' ) ;
180+ for ( var x in this . breaking )
181+ this . add_menuitem ( this . breaking [ x ] , 'breaking' ) ;
182+
183+ this . prepend_child ( label ) ;
184+ }
185+
177186 } ,
178187
179188 prepend_child : function ( node ) {
0 commit comments