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