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-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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 let disabledFilters = 0; | 106 let disabledFilters = 0; |
107 for (let i = 0, l = subscription.filters.length; i < l; i++) | 107 for (let i = 0, l = subscription.filters.length; i < l; i++) |
108 if (subscription.filters[i] instanceof ActiveFilter && subscription.filter
s[i].disabled) | 108 if (subscription.filters[i] instanceof ActiveFilter && subscription.filter
s[i].disabled) |
109 disabledFilters++; | 109 disabledFilters++; |
110 | 110 |
111 let node = Templater.process(this._template, { | 111 let node = Templater.process(this._template, { |
112 __proto__: null, | 112 __proto__: null, |
113 subscription: subscription, | 113 subscription: subscription, |
114 isExternal: subscription instanceof ExternalSubscription, | 114 isExternal: subscription instanceof ExternalSubscription, |
115 downloading: Synchronizer.isExecuting(subscription.url), | 115 downloading: Synchronizer.isExecuting(subscription.url), |
116 disabledFilters: disabledFilters | 116 disabledFilters: disabledFilters, |
| 117 upgradeRequired: ListManager.isUpgradeRequired(subscription) |
117 }); | 118 }); |
118 if (insertBefore) | 119 if (insertBefore) |
119 this._list.insertBefore(node, insertBefore); | 120 this._list.insertBefore(node, insertBefore); |
120 else | 121 else |
121 this._list.appendChild(node); | 122 this._list.appendChild(node); |
122 return node; | 123 return node; |
123 }, | 124 }, |
124 | 125 |
125 /** | 126 /** |
126 * Map indicating subscriptions that need their "disabledFilters" property to | 127 * Map indicating subscriptions that need their "disabledFilters" property to |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 246 } |
246 case "subscription.title": | 247 case "subscription.title": |
247 case "subscription.disabled": | 248 case "subscription.disabled": |
248 case "subscription.homepage": | 249 case "subscription.homepage": |
249 case "subscription.lastDownload": | 250 case "subscription.lastDownload": |
250 case "subscription.downloadStatus": | 251 case "subscription.downloadStatus": |
251 { | 252 { |
252 let subscriptionNode = Templater.getNodeForData(this._list, "subscriptio
n", item); | 253 let subscriptionNode = Templater.getNodeForData(this._list, "subscriptio
n", item); |
253 if (subscriptionNode) | 254 if (subscriptionNode) |
254 { | 255 { |
255 Templater.getDataForNode(subscriptionNode).downloading = Synchronizer.
isExecuting(item.url); | 256 let data = Templater.getDataForNode(subscriptionNode); |
| 257 data.downloading = Synchronizer.isExecuting(item.url); |
| 258 data.upgradeRequired = ListManager.isUpgradeRequired(item); |
256 Templater.update(this._template, subscriptionNode); | 259 Templater.update(this._template, subscriptionNode); |
257 | 260 |
258 if (!document.commandDispatcher.focusedElement) | 261 if (!document.commandDispatcher.focusedElement) |
259 this._list.focus(); | 262 this._list.focus(); |
260 this._listener(); | 263 this._listener(); |
261 } | 264 } |
262 break; | 265 break; |
263 } | 266 } |
264 case "subscription.fixedTitle": | 267 case "subscription.fixedTitle": |
265 { | 268 { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 if (allow) | 320 if (allow) |
318 { | 321 { |
319 FilterStorage.addSubscription(subscription); | 322 FilterStorage.addSubscription(subscription); |
320 if (subscription instanceof DownloadableSubscription && !subscription.lastDo
wnload) | 323 if (subscription instanceof DownloadableSubscription && !subscription.lastDo
wnload) |
321 Synchronizer.execute(subscription); | 324 Synchronizer.execute(subscription); |
322 } | 325 } |
323 else | 326 else |
324 FilterStorage.removeSubscription(subscription); | 327 FilterStorage.removeSubscription(subscription); |
325 }; | 328 }; |
326 | 329 |
| 330 /** |
| 331 * Checks whether Adblock Plus needs to be upgraded in order to support filters |
| 332 * in a particular subscription. |
| 333 */ |
| 334 ListManager.isUpgradeRequired = function(/**Subscription*/ subscription) |
| 335 { |
| 336 if (subscription instanceof DownloadableSubscription && subscription.requiredV
ersion) |
| 337 { |
| 338 let {addonVersion} = require("info"); |
| 339 if (Services.vc.compare(subscription.requiredVersion, addonVersion) > 0) |
| 340 return true; |
| 341 } |
| 342 return false; |
| 343 }; |
| 344 |
327 window.addEventListener("load", ListManager.init, false); | 345 window.addEventListener("load", ListManager.init, false); |
OLD | NEW |