Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This Source Code is subject to the terms of the Mozilla Public License | 2 * This Source Code is subject to the terms of the Mozilla Public License |
3 * version 2.0 (the "License"). You can obtain a copy of the License at | 3 * version 2.0 (the "License"). You can obtain a copy of the License at |
4 * http://mozilla.org/MPL/2.0/. | 4 * http://mozilla.org/MPL/2.0/. |
5 */ | 5 */ |
6 | 6 |
7 Cu.import("resource://gre/modules/Services.jsm"); | 7 Cu.import("resource://gre/modules/Services.jsm"); |
8 | 8 |
9 let {Prefs} = require("prefs"); | 9 let {Prefs} = require("prefs"); |
10 let {WindowObserver} = require("windowObserver"); | 10 let {WindowObserver} = require("windowObserver"); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 __proto__: StylesheetFeature, | 124 __proto__: StylesheetFeature, |
125 stylesheet: "chrome://abpcustomization/content/oneLineSubscriptions.css" | 125 stylesheet: "chrome://abpcustomization/content/oneLineSubscriptions.css" |
126 }; | 126 }; |
127 | 127 |
128 var RemoveActionsButton = | 128 var RemoveActionsButton = |
129 { | 129 { |
130 __proto__: StylesheetFeature, | 130 __proto__: StylesheetFeature, |
131 stylesheet: "chrome://abpcustomization/content/noActionButton.css" | 131 stylesheet: "chrome://abpcustomization/content/noActionButton.css" |
132 }; | 132 }; |
133 | 133 |
134 var RemoveToolbarIconDisplayOption = | 134 var AddonPageAustralisStyles = |
135 { | 135 { |
136 __proto__: StylesheetFeature, | 136 __proto__: StylesheetFeature, |
137 stylesheet: "chrome://abpcustomization/content/noToolbarIconDisplay.css" | 137 stylesheet: "chrome://abpcustomization/content/addonPageAustralisStyles.css" |
138 }; | 138 }; |
139 | 139 |
140 var ToolbarIconDisplay = | 140 var ToolbarIconDisplay = |
141 { | 141 { |
142 __proto__: StylesheetFeature, | 142 __proto__: StylesheetFeature, |
143 get template() | 143 get template() |
144 { | 144 { |
145 let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(C i.nsIXMLHttpRequest); | 145 let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(C i.nsIXMLHttpRequest); |
146 request.open("GET", "chrome://abpcustomization/content/toolbarIconDisplay.cs s", false); | 146 request.open("GET", "chrome://abpcustomization/content/toolbarIconDisplay.cs s", false); |
147 request.overrideMimeType("text/plain"); | 147 request.overrideMimeType("text/plain"); |
(...skipping 30 matching lines...) Expand all Loading... | |
178 stylesheet: "chrome://abpcustomization/content/hideMenus.css" | 178 stylesheet: "chrome://abpcustomization/content/hideMenus.css" |
179 }; | 179 }; |
180 | 180 |
181 let features = | 181 let features = |
182 { | 182 { |
183 "addon-page-styles": AddonPageStyles, | 183 "addon-page-styles": AddonPageStyles, |
184 "vertical-preferences-layout": VerticalPreferencesLayout, | 184 "vertical-preferences-layout": VerticalPreferencesLayout, |
185 "preferences-one-line-subscriptions": OneLineSubscriptions, | 185 "preferences-one-line-subscriptions": OneLineSubscriptions, |
186 "preferences-remove-actions-button": RemoveActionsButton, | 186 "preferences-remove-actions-button": RemoveActionsButton, |
187 "toolbar-icon-display": ToolbarIconDisplay, | 187 "toolbar-icon-display": ToolbarIconDisplay, |
188 "remove-toolbar-icon-display-option": RemoveToolbarIconDisplayOption, | 188 "addon-page-australis-styles": AddonPageAustralisStyles, |
saroyanm
2014/07/30 10:56:23
Have little doubt regarding the naming, hope we wi
Wladimir Palant
2014/07/30 11:34:08
It's probably better to name it AddonPageAustralis
saroyanm
2014/07/30 12:50:35
Done.
| |
189 "green-icon": GreenIcon, | 189 "green-icon": GreenIcon, |
190 "remove-menus": RemoveMenus | 190 "remove-menus": RemoveMenus |
191 }; | 191 }; |
192 | 192 |
193 function updateFeature(name) | 193 function updateFeature(name) |
194 { | 194 { |
195 if (name in features) | 195 if (name in features) |
196 { | 196 { |
197 let enabled; | 197 let enabled; |
198 if (name == "addon-page-styles") | 198 if (name == "addon-page-styles") |
199 enabled = true; | 199 enabled = true; |
200 else if (name == "toolbar-icon-display") | 200 else if (name == "toolbar-icon-display" && isAustralis) |
201 enabled = !isAustralis; | 201 enabled = false; |
Wladimir Palant
2014/07/30 11:34:08
I don't think we want to have |enabled = true| for
saroyanm
2014/07/30 12:50:35
Make, sense. Thanks.
| |
202 else if (name == "remove-toolbar-icon-display-option") | 202 else if (name == "addon-page-australis-styles") |
203 enabled = isAustralis; | 203 enabled = isAustralis; |
204 else | 204 else |
205 enabled = Prefs[name]; | 205 enabled = Prefs[name]; |
206 | 206 |
207 if (enabled) | 207 if (enabled) |
208 features[name].init(); | 208 features[name].init(); |
209 else | 209 else |
210 features[name].shutdown(); | 210 features[name].shutdown(); |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 // Initialize features and make sure to update them on changes | 214 // Initialize features and make sure to update them on changes |
215 for (let feature in features) | 215 for (let feature in features) |
216 updateFeature(feature); | 216 updateFeature(feature); |
217 | 217 |
218 Prefs.addListener(updateFeature); | 218 Prefs.addListener(updateFeature); |
LEFT | RIGHT |