| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 function convertObject(keys, obj) | 59 function convertObject(keys, obj) |
| 60 { | 60 { |
| 61 var result = {}; | 61 var result = {}; |
| 62 for (var i = 0; i < keys.length; i++) | 62 for (var i = 0; i < keys.length; i++) |
| 63 result[keys[i]] = obj[keys[i]]; | 63 result[keys[i]] = obj[keys[i]]; |
| 64 return result; | 64 return result; |
| 65 } | 65 } |
| 66 | 66 |
| 67 var convertSubscription = convertObject.bind(null, ["disabled", | 67 function convertSubscription(subscription) |
| 68 "downloadStatus", "homepage", "lastDownload", "title", "url"]); | 68 { |
| 69 var obj = convertObject(["disabled", "downloadStatus", "homepage", |
| 70 "lastDownload", "title", "url"], subscription); |
| 71 obj.isDownloading = Synchronizer.isExecuting(subscription); |
| 72 return obj; |
| 73 } |
| 74 |
| 69 var convertFilter = convertObject.bind(null, ["text"]); | 75 var convertFilter = convertObject.bind(null, ["text"]); |
| 70 | 76 |
| 71 var changeListeners = new global.ext.PageMap(); | 77 var changeListeners = new global.ext.PageMap(); |
| 72 var listenedPreferences = Object.create(null); | 78 var listenedPreferences = Object.create(null); |
| 73 var listenedFilterChanges = Object.create(null); | 79 var listenedFilterChanges = Object.create(null); |
| 74 var messageTypes = { | 80 var messageTypes = { |
| 75 "app": "app.respond", | 81 "app": "app.respond", |
| 76 "filter": "filters.respond", | 82 "filter": "filters.respond", |
| 77 "pref": "prefs.respond", | 83 "pref": "prefs.respond", |
| 78 "subscription": "subscriptions.respond" | 84 "subscription": "subscriptions.respond" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 case "subscriptions.update": | 395 case "subscriptions.update": |
| 390 var subscriptions = message.url ? [Subscription.fromURL(message.url)] : | 396 var subscriptions = message.url ? [Subscription.fromURL(message.url)] : |
| 391 FilterStorage.subscriptions; | 397 FilterStorage.subscriptions; |
| 392 for (var i = 0; i < subscriptions.length; i++) | 398 for (var i = 0; i < subscriptions.length; i++) |
| 393 { | 399 { |
| 394 var subscription = subscriptions[i]; | 400 var subscription = subscriptions[i]; |
| 395 if (subscription instanceof DownloadableSubscription) | 401 if (subscription instanceof DownloadableSubscription) |
| 396 Synchronizer.execute(subscription, true); | 402 Synchronizer.execute(subscription, true); |
| 397 } | 403 } |
| 398 break; | 404 break; |
| 399 case "subscriptions.isDownloading": | |
| 400 callback(Synchronizer.isExecuting(message.url)); | |
| 401 break; | |
| 402 } | 405 } |
| 403 }); | 406 }); |
| 404 })(this); | 407 })(this); |
| OLD | NEW |