LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 /** | 107 /** |
108 * Initializes filter listener on startup, registers the necessary hooks. | 108 * Initializes filter listener on startup, registers the necessary hooks. |
109 */ | 109 */ |
110 function init() | 110 function init() |
111 { | 111 { |
112 FilterNotifier.on("filter.hitCount", onFilterHitCount); | 112 FilterNotifier.on("filter.hitCount", onFilterHitCount); |
113 FilterNotifier.on("filter.lastHit", onFilterLastHit); | 113 FilterNotifier.on("filter.lastHit", onFilterLastHit); |
114 FilterNotifier.on("filter.added", onFilterAdded); | 114 FilterNotifier.on("filter.added", onFilterAdded); |
115 FilterNotifier.on("filter.removed", onFilterRemoved); | 115 FilterNotifier.on("filter.removed", onFilterRemoved); |
116 FilterNotifier.on("filter.disabled", onFilterDisabled); | 116 FilterNotifier.on("filter.disabled", onFilterDisabled); |
| 117 FilterNotifier.on("filter.moved", onGenericChange); |
117 | 118 |
118 FilterNotifier.on("subscription.added", onSubscriptionAdded); | 119 FilterNotifier.on("subscription.added", onSubscriptionAdded); |
119 FilterNotifier.on("subscription.removed", onSubscriptionRemoved); | 120 FilterNotifier.on("subscription.removed", onSubscriptionRemoved); |
120 FilterNotifier.on("subscription.disabled", onSubscriptionDisabled); | 121 FilterNotifier.on("subscription.disabled", onSubscriptionDisabled); |
121 FilterNotifier.on("subscription.updated", onSubscriptionUpdated); | 122 FilterNotifier.on("subscription.updated", onSubscriptionUpdated); |
| 123 FilterNotifier.on("subscription.moved", onGenericChange); |
| 124 FilterNotifier.on("subscription.title", onGenericChange); |
| 125 FilterNotifier.on("subscription.fixedTitle", onGenericChange); |
| 126 FilterNotifier.on("subscription.homepage", onGenericChange); |
| 127 FilterNotifier.on("subscription.downloadStatus", onGenericChange); |
| 128 FilterNotifier.on("subscription.lastCheck", onGenericChange); |
| 129 FilterNotifier.on("subscription.errors", onGenericChange); |
122 | 130 |
123 FilterNotifier.on("load", onLoad); | 131 FilterNotifier.on("load", onLoad); |
124 FilterNotifier.on("save", onSave); | 132 FilterNotifier.on("save", onSave); |
125 | 133 |
126 | 134 |
127 if ("nsIStyleSheetService" in Ci) | 135 if ("nsIStyleSheetService" in Ci) |
128 ElemHide.init(); | 136 ElemHide.init(); |
129 else | 137 else |
130 flushElemHide = function() {}; // No global stylesheet in Chrome & Co. | 138 flushElemHide = function() {}; // No global stylesheet in Chrome & Co. |
131 FilterStorage.loadFromDisk(); | 139 FilterStorage.loadFromDisk(); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 300 |
293 function onFilterDisabled(filter, newValue) | 301 function onFilterDisabled(filter, newValue) |
294 { | 302 { |
295 FilterListener.setDirty(1); | 303 FilterListener.setDirty(1); |
296 | 304 |
297 if (newValue == false) | 305 if (newValue == false) |
298 addFilter(filter); | 306 addFilter(filter); |
299 else | 307 else |
300 removeFilter(filter); | 308 removeFilter(filter); |
301 flushElemHide(); | 309 flushElemHide(); |
| 310 } |
| 311 |
| 312 function onGenericChange() |
| 313 { |
| 314 FilterListener.setDirty(1); |
302 } | 315 } |
303 | 316 |
304 function onLoad() | 317 function onLoad() |
305 { | 318 { |
306 isDirty = 0; | 319 isDirty = 0; |
307 | 320 |
308 defaultMatcher.clear(); | 321 defaultMatcher.clear(); |
309 ElemHide.clear(); | 322 ElemHide.clear(); |
310 CSSRules.clear(); | 323 CSSRules.clear(); |
311 for (let subscription of FilterStorage.subscriptions) | 324 for (let subscription of FilterStorage.subscriptions) |
312 if (!subscription.disabled) | 325 if (!subscription.disabled) |
313 subscription.filters.forEach(addFilter); | 326 subscription.filters.forEach(addFilter); |
314 flushElemHide(); | 327 flushElemHide(); |
315 } | 328 } |
316 | 329 |
317 function onSave() | 330 function onSave() |
318 { | 331 { |
319 isDirty = 0; | 332 isDirty = 0; |
320 } | 333 } |
LEFT | RIGHT |