OLD | NEW |
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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 }, | 164 }, |
165 | 165 |
166 /** | 166 /** |
167 * Subscriptions change processing. | 167 * Subscriptions change processing. |
168 * @see FilterNotifier.addListener() | 168 * @see FilterNotifier.addListener() |
169 */ | 169 */ |
170 _onChange: function(action, item, param1, param2) | 170 _onChange: function(action, item, param1, param2) |
171 { | 171 { |
172 if ((action == "subscription.added" || action == "subscription.removed") &&
item.url == Prefs.subscriptions_exceptionsurl) | 172 if ((action == "subscription.added" || action == "subscription.removed") &&
item.url == Prefs.subscriptions_exceptionsurl) |
173 E("acceptableAds").checked = FilterStorage.subscriptions.some(function(s)
s.url == Prefs.subscriptions_exceptionsurl); | 173 E("acceptableAds").checked = FilterStorage.subscriptions.some(s => s.url =
= Prefs.subscriptions_exceptionsurl); |
174 | 174 |
175 if (action == "filter.disabled") | 175 if (action == "filter.disabled") |
176 { | 176 { |
177 if (this._scheduledUpdateDisabled == null) | 177 if (this._scheduledUpdateDisabled == null) |
178 { | 178 { |
179 this._scheduledUpdateDisabled = Object.create(null); | 179 this._scheduledUpdateDisabled = Object.create(null); |
180 Utils.runAsync(this.updateDisabled, this); | 180 Utils.runAsync(this.updateDisabled, this); |
181 } | 181 } |
182 for (let i = 0; i < item.subscriptions.length; i++) | 182 for (let i = 0; i < item.subscriptions.length; i++) |
183 this._scheduledUpdateDisabled[item.subscriptions[i].url] = true; | 183 this._scheduledUpdateDisabled[item.subscriptions[i].url] = true; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 } | 283 } |
284 }; | 284 }; |
285 | 285 |
286 /** | 286 /** |
287 * Attaches list managers to the lists. | 287 * Attaches list managers to the lists. |
288 */ | 288 */ |
289 ListManager.init = function() | 289 ListManager.init = function() |
290 { | 290 { |
291 new ListManager(E("subscriptions"), | 291 new ListManager(E("subscriptions"), |
292 E("subscriptionTemplate"), | 292 E("subscriptionTemplate"), |
293 function(s) s instanceof RegularSubscription && !(ListManager.
acceptableAdsCheckbox && s.url == Prefs.subscriptions_exceptionsurl), | 293 s => s instanceof RegularSubscription && !(ListManager.accepta
bleAdsCheckbox && s.url == Prefs.subscriptions_exceptionsurl), |
294 SubscriptionActions.updateCommands); | 294 SubscriptionActions.updateCommands); |
295 new ListManager(E("groups"), | 295 new ListManager(E("groups"), |
296 E("groupTemplate"), | 296 E("groupTemplate"), |
297 function(s) s instanceof SpecialSubscription, | 297 s => s instanceof SpecialSubscription, |
298 SubscriptionActions.updateCommands); | 298 SubscriptionActions.updateCommands); |
299 E("acceptableAds").checked = FilterStorage.subscriptions.some(function(s) s.ur
l == Prefs.subscriptions_exceptionsurl); | 299 E("acceptableAds").checked = FilterStorage.subscriptions.some(s => s.url == Pr
efs.subscriptions_exceptionsurl); |
300 E("acceptableAds").parentNode.hidden = !ListManager.acceptableAdsCheckbox; | 300 E("acceptableAds").parentNode.hidden = !ListManager.acceptableAdsCheckbox; |
301 }; | 301 }; |
302 | 302 |
303 /** | 303 /** |
304 * Defines whether the "acceptable ads" subscription needs special treatment. | 304 * Defines whether the "acceptable ads" subscription needs special treatment. |
305 * @type Boolean | 305 * @type Boolean |
306 */ | 306 */ |
307 ListManager.acceptableAdsCheckbox = Prefs.subscriptions_exceptionscheckbox; | 307 ListManager.acceptableAdsCheckbox = Prefs.subscriptions_exceptionscheckbox; |
308 | 308 |
309 /** | 309 /** |
(...skipping 11 matching lines...) Expand all Loading... |
321 { | 321 { |
322 FilterStorage.addSubscription(subscription); | 322 FilterStorage.addSubscription(subscription); |
323 if (subscription instanceof DownloadableSubscription && !subscription.lastDo
wnload) | 323 if (subscription instanceof DownloadableSubscription && !subscription.lastDo
wnload) |
324 Synchronizer.execute(subscription); | 324 Synchronizer.execute(subscription); |
325 } | 325 } |
326 else | 326 else |
327 FilterStorage.removeSubscription(subscription); | 327 FilterStorage.removeSubscription(subscription); |
328 }; | 328 }; |
329 | 329 |
330 window.addEventListener("load", ListManager.init, false); | 330 window.addEventListener("load", ListManager.init, false); |
OLD | NEW |