| Left: | ||
| Right: |
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 12 matching lines...) Expand all Loading... | |
| 23 { | 23 { |
| 24 const {port} = require("messaging"); | 24 const {port} = require("messaging"); |
| 25 const {Prefs} = require("prefs"); | 25 const {Prefs} = require("prefs"); |
| 26 const {Utils} = require("utils"); | 26 const {Utils} = require("utils"); |
| 27 const {FilterStorage} = require("filterStorage"); | 27 const {FilterStorage} = require("filterStorage"); |
| 28 const {FilterNotifier} = require("filterNotifier"); | 28 const {FilterNotifier} = require("filterNotifier"); |
| 29 const {defaultMatcher} = require("matcher"); | 29 const {defaultMatcher} = require("matcher"); |
| 30 const {Notification: NotificationStorage} = require("notification"); | 30 const {Notification: NotificationStorage} = require("notification"); |
| 31 const {getActiveNotification, shouldDisplay} = require("notificationHelper"); | 31 const {getActiveNotification, shouldDisplay} = require("notificationHelper"); |
| 32 | 32 |
| 33 const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses"); | 33 const { |
| 34 Filter, ActiveFilter, BlockingFilter, RegExpFilter | |
| 35 } = require("filterClasses"); | |
| 34 const {Synchronizer} = require("synchronizer"); | 36 const {Synchronizer} = require("synchronizer"); |
| 35 | 37 |
| 36 const info = require("info"); | 38 const info = require("info"); |
| 37 const { | 39 const { |
| 38 Subscription, | 40 Subscription, |
| 39 DownloadableSubscription, | 41 DownloadableSubscription, |
| 40 SpecialSubscription | 42 SpecialSubscription |
| 41 } = require("subscriptionClasses"); | 43 } = require("subscriptionClasses"); |
| 42 | 44 |
| 43 const {showOptions} = require("options"); | 45 const {showOptions} = require("options"); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 56 { | 58 { |
| 57 if (key in obj) | 59 if (key in obj) |
| 58 result[key] = obj[key]; | 60 result[key] = obj[key]; |
| 59 } | 61 } |
| 60 return result; | 62 return result; |
| 61 } | 63 } |
| 62 | 64 |
| 63 function convertSubscription(subscription) | 65 function convertSubscription(subscription) |
| 64 { | 66 { |
| 65 let obj = convertObject(["disabled", "downloadStatus", "homepage", | 67 let obj = convertObject(["disabled", "downloadStatus", "homepage", |
| 66 "lastDownload", "title", "url"], subscription); | 68 "version", "lastDownload", "lastSuccess", |
| 69 "softExpiration", "expires", "title", | |
| 70 "url"], subscription); | |
| 67 if (subscription instanceof SpecialSubscription) | 71 if (subscription instanceof SpecialSubscription) |
| 68 obj.filters = subscription.filters.map(convertFilter); | 72 obj.filters = subscription.filters.map(convertFilter); |
| 69 obj.isDownloading = Synchronizer.isExecuting(subscription.url); | 73 obj.isDownloading = Synchronizer.isExecuting(subscription.url); |
| 70 return obj; | 74 return obj; |
| 71 } | 75 } |
| 72 | 76 |
| 73 let convertFilter = convertObject.bind(null, ["text"]); | 77 let convertFilter = convertObject.bind(null, ["text"]); |
| 74 | 78 |
| 75 let changeListeners = new ext.PageMap(); | 79 let changeListeners = new ext.PageMap(); |
| 76 let listenedPreferences = Object.create(null); | 80 let listenedPreferences = Object.create(null); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 { | 398 { |
| 395 if (message.ignoreDisabled && s.disabled) | 399 if (message.ignoreDisabled && s.disabled) |
| 396 return false; | 400 return false; |
| 397 if (s instanceof DownloadableSubscription && message.downloadable) | 401 if (s instanceof DownloadableSubscription && message.downloadable) |
| 398 return true; | 402 return true; |
| 399 if (s instanceof SpecialSubscription && message.special) | 403 if (s instanceof SpecialSubscription && message.special) |
| 400 return true; | 404 return true; |
| 401 return false; | 405 return false; |
| 402 }); | 406 }); |
| 403 | 407 |
| 404 return subscriptions.map(convertSubscription); | 408 return subscriptions.map((s) => |
| 409 { | |
| 410 let result = convertSubscription(s); | |
| 411 if (message.disabledFilters) | |
| 412 { | |
| 413 result.disabledFilters = s.filters | |
|
kzar
2017/10/24 14:14:18
Does this pass linting? The indentation seems a li
Wladimir Palant
2017/10/24 14:18:59
Yes, it passes linting. I'd normally align the dot
kzar
2017/10/24 14:20:24
Fair enough, it's Thomas' module after all.
Manish Jethani
2017/10/24 14:38:25
How about moving s.filter to the next line with a
Wladimir Palant
2017/10/25 11:05:01
Not convinced that this would be better, so I bett
| |
| 414 .filter((f) => f instanceof ActiveFilter && f.disabled) | |
| 415 .map((f) => f.text); | |
| 416 } | |
| 417 return result; | |
| 418 }); | |
| 405 }); | 419 }); |
| 406 | 420 |
| 407 port.on("subscriptions.listen", (message, sender) => | 421 port.on("subscriptions.listen", (message, sender) => |
| 408 { | 422 { |
| 409 getListenerFilters(sender.page).subscription = message.filter; | 423 getListenerFilters(sender.page).subscription = message.filter; |
| 410 addFilterListeners("subscription", message.filter); | 424 addFilterListeners("subscription", message.filter); |
| 411 }); | 425 }); |
| 412 | 426 |
| 413 port.on("subscriptions.remove", (message, sender) => | 427 port.on("subscriptions.remove", (message, sender) => |
| 414 { | 428 { |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 439 if (message.url) | 453 if (message.url) |
| 440 subscriptions = [Subscription.fromURL(message.url)]; | 454 subscriptions = [Subscription.fromURL(message.url)]; |
| 441 | 455 |
| 442 for (let subscription of subscriptions) | 456 for (let subscription of subscriptions) |
| 443 { | 457 { |
| 444 if (subscription instanceof DownloadableSubscription) | 458 if (subscription instanceof DownloadableSubscription) |
| 445 Synchronizer.execute(subscription, true); | 459 Synchronizer.execute(subscription, true); |
| 446 } | 460 } |
| 447 }); | 461 }); |
| 448 })(this); | 462 })(this); |
| OLD | NEW |