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-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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 this._list.removeChild(this._list.firstChild); | 84 this._list.removeChild(this._list.firstChild); |
85 | 85 |
86 // Now add all subscriptions | 86 // Now add all subscriptions |
87 let subscriptions = FilterStorage.subscriptions.filter(this._filter, this); | 87 let subscriptions = FilterStorage.subscriptions.filter(this._filter, this); |
88 if (subscriptions.length) | 88 if (subscriptions.length) |
89 { | 89 { |
90 for (let subscription of subscriptions) | 90 for (let subscription of subscriptions) |
91 this.addSubscription(subscription, null); | 91 this.addSubscription(subscription, null); |
92 | 92 |
93 // Make sure first list item is selected after list initialization | 93 // Make sure first list item is selected after list initialization |
94 Utils.runAsync(function() | 94 Utils.runAsync(() => this._list.selectItem(this._list.getItemAtIndex(this.
_list.getIndexOfFirstVisibleRow()))); |
95 { | |
96 this._list.selectItem(this._list.getItemAtIndex(this._list.getIndexOfFir
stVisibleRow())); | |
97 }, this); | |
98 } | 95 } |
99 | 96 |
100 this._deck.selectedIndex = (subscriptions.length ? 1 : 0); | 97 this._deck.selectedIndex = (subscriptions.length ? 1 : 0); |
101 this._listener(); | 98 this._listener(); |
102 }, | 99 }, |
103 | 100 |
104 /** | 101 /** |
105 * Adds a filter subscription to the list. | 102 * Adds a filter subscription to the list. |
106 */ | 103 */ |
107 addSubscription: function(/**Subscription*/ subscription, /**Node*/ insertBefo
re) /**Node*/ | 104 addSubscription: function(/**Subscription*/ subscription, /**Node*/ insertBefo
re) /**Node*/ |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 _onChange: function(action, item, param1, param2) | 167 _onChange: function(action, item, param1, param2) |
171 { | 168 { |
172 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) |
173 E("acceptableAds").checked = FilterStorage.subscriptions.some(s => s.url =
= Prefs.subscriptions_exceptionsurl); | 170 E("acceptableAds").checked = FilterStorage.subscriptions.some(s => s.url =
= Prefs.subscriptions_exceptionsurl); |
174 | 171 |
175 if (action == "filter.disabled") | 172 if (action == "filter.disabled") |
176 { | 173 { |
177 if (this._scheduledUpdateDisabled == null) | 174 if (this._scheduledUpdateDisabled == null) |
178 { | 175 { |
179 this._scheduledUpdateDisabled = Object.create(null); | 176 this._scheduledUpdateDisabled = Object.create(null); |
180 Utils.runAsync(this.updateDisabled, this); | 177 Utils.runAsync(() => this.updateDisabled()); |
181 } | 178 } |
182 for (let i = 0; i < item.subscriptions.length; i++) | 179 for (let i = 0; i < item.subscriptions.length; i++) |
183 this._scheduledUpdateDisabled[item.subscriptions[i].url] = true; | 180 this._scheduledUpdateDisabled[item.subscriptions[i].url] = true; |
184 return; | 181 return; |
185 } | 182 } |
186 | 183 |
187 if (action != "load" && !this._filter(item)) | 184 if (action != "load" && !this._filter(item)) |
188 return; | 185 return; |
189 | 186 |
190 switch (action) | 187 switch (action) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 case "subscription.fixedTitle": | 264 case "subscription.fixedTitle": |
268 { | 265 { |
269 SubscriptionActions.updateCommands(); | 266 SubscriptionActions.updateCommands(); |
270 break; | 267 break; |
271 } | 268 } |
272 case "subscription.updated": | 269 case "subscription.updated": |
273 { | 270 { |
274 if (this._scheduledUpdateDisabled == null) | 271 if (this._scheduledUpdateDisabled == null) |
275 { | 272 { |
276 this._scheduledUpdateDisabled = Object.create(null); | 273 this._scheduledUpdateDisabled = Object.create(null); |
277 Utils.runAsync(this.updateDisabled, this); | 274 Utils.runAsync(() => this.updateDisabled()); |
278 } | 275 } |
279 this._scheduledUpdateDisabled[item.url] = true; | 276 this._scheduledUpdateDisabled[item.url] = true; |
280 break; | 277 break; |
281 } | 278 } |
282 } | 279 } |
283 } | 280 } |
284 }; | 281 }; |
285 | 282 |
286 /** | 283 /** |
287 * Attaches list managers to the lists. | 284 * Attaches list managers to the lists. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 { | 318 { |
322 FilterStorage.addSubscription(subscription); | 319 FilterStorage.addSubscription(subscription); |
323 if (subscription instanceof DownloadableSubscription && !subscription.lastDo
wnload) | 320 if (subscription instanceof DownloadableSubscription && !subscription.lastDo
wnload) |
324 Synchronizer.execute(subscription); | 321 Synchronizer.execute(subscription); |
325 } | 322 } |
326 else | 323 else |
327 FilterStorage.removeSubscription(subscription); | 324 FilterStorage.removeSubscription(subscription); |
328 }; | 325 }; |
329 | 326 |
330 window.addEventListener("load", ListManager.init, false); | 327 window.addEventListener("load", ListManager.init, false); |
LEFT | RIGHT |