| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 if (!listenerFilters) | 125 if (!listenerFilters) |
| 126 { | 126 { |
| 127 listenerFilters = Object.create(null); | 127 listenerFilters = Object.create(null); |
| 128 changeListeners.set(sender.page, listenerFilters); | 128 changeListeners.set(sender.page, listenerFilters); |
| 129 } | 129 } |
| 130 break; | 130 break; |
| 131 } | 131 } |
| 132 | 132 |
| 133 switch (message.type) | 133 switch (message.type) |
| 134 { | 134 { |
| 135 case "add-subscription": | |
| 136 ext.showOptions(function() | |
| 137 { | |
| 138 var subscription = Subscription.fromURL(message.url); | |
| 139 subscription.title = message.title; | |
| 140 onFilterChange("addSubscription", subscription); | |
| 141 }); | |
| 142 break; | |
| 143 case "app.get": | 135 case "app.get": |
| 144 if (message.what == "issues") | 136 if (message.what == "issues") |
| 145 { | 137 { |
| 146 var subscriptionInit; | 138 var subscriptionInit; |
| 147 try | 139 try |
| 148 { | 140 { |
| 149 subscriptionInit = require("subscriptionInit"); | 141 subscriptionInit = require("subscriptionInit"); |
| 150 } | 142 } |
| 151 catch (e) | 143 catch (e) |
| 152 { | 144 { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 284 |
| 293 if (!subscription) | 285 if (!subscription) |
| 294 FilterStorage.removeFilter(filter); | 286 FilterStorage.removeFilter(filter); |
| 295 else | 287 else |
| 296 FilterStorage.removeFilter(filter, subscription, message.index); | 288 FilterStorage.removeFilter(filter, subscription, message.index); |
| 297 break; | 289 break; |
| 298 case "prefs.get": | 290 case "prefs.get": |
| 299 callback(Prefs[message.key]); | 291 callback(Prefs[message.key]); |
| 300 break; | 292 break; |
| 301 case "subscriptions.add": | 293 case "subscriptions.add": |
| 302 if (message.url in FilterStorage.knownSubscriptions) | |
| 303 return; | |
| 304 | |
| 305 var subscription = Subscription.fromURL(message.url); | 294 var subscription = Subscription.fromURL(message.url); |
| 306 if (!subscription) | |
| 307 return; | |
| 308 | |
| 309 subscription.disabled = false; | |
| 310 if ("title" in message) | 295 if ("title" in message) |
| 311 subscription.title = message.title; | 296 subscription.title = message.title; |
| 312 if ("homepage" in message) | 297 if ("homepage" in message) |
| 313 subscription.homepage = message.homepage; | 298 subscription.homepage = message.homepage; |
| 314 FilterStorage.addSubscription(subscription); | |
| 315 | 299 |
| 316 if (subscription instanceof DownloadableSubscription && !subscription.la
stDownload) | 300 if (message.confirm) |
| 317 Synchronizer.execute(subscription); | 301 { |
| 302 ext.showOptions(function() |
| 303 { |
| 304 onFilterChange("addSubscription", subscription); |
| 305 }); |
| 306 } |
| 307 else |
| 308 { |
| 309 subscription.disabled = false; |
| 310 FilterStorage.addSubscription(subscription); |
| 311 |
| 312 if (subscription instanceof DownloadableSubscription && !subscription.
lastDownload) |
| 313 Synchronizer.execute(subscription); |
| 314 } |
| 318 break; | 315 break; |
| 319 case "subscriptions.get": | 316 case "subscriptions.get": |
| 320 var subscriptions = FilterStorage.subscriptions.filter(function(s) | 317 var subscriptions = FilterStorage.subscriptions.filter(function(s) |
| 321 { | 318 { |
| 322 if (message.ignoreDisabled && s.disabled) | 319 if (message.ignoreDisabled && s.disabled) |
| 323 return false; | 320 return false; |
| 324 if (s instanceof DownloadableSubscription && message.downloadable) | 321 if (s instanceof DownloadableSubscription && message.downloadable) |
| 325 return true; | 322 return true; |
| 326 if (s instanceof SpecialSubscription && message.special) | 323 if (s instanceof SpecialSubscription && message.special) |
| 327 return true; | 324 return true; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 if (subscription instanceof DownloadableSubscription) | 369 if (subscription instanceof DownloadableSubscription) |
| 373 Synchronizer.execute(subscription, true); | 370 Synchronizer.execute(subscription, true); |
| 374 } | 371 } |
| 375 break; | 372 break; |
| 376 case "subscriptions.isDownloading": | 373 case "subscriptions.isDownloading": |
| 377 callback(Synchronizer.isExecuting(message.url)); | 374 callback(Synchronizer.isExecuting(message.url)); |
| 378 break; | 375 break; |
| 379 } | 376 } |
| 380 }); | 377 }); |
| 381 })(this); | 378 })(this); |
| OLD | NEW |