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 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 (function(global) | 22 (function(global) |
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 | 32 |
32 const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses"); | 33 const {Filter, BlockingFilter, RegExpFilter} = require("filterClasses"); |
33 const {Synchronizer} = require("synchronizer"); | 34 const {Synchronizer} = require("synchronizer"); |
34 | 35 |
35 const info = require("info"); | 36 const info = require("info"); |
36 const { | 37 const { |
37 Subscription, | 38 Subscription, |
38 DownloadableSubscription, | 39 DownloadableSubscription, |
39 SpecialSubscription | 40 SpecialSubscription |
40 } = require("subscriptionClasses"); | 41 } = require("subscriptionClasses"); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 }); | 336 }); |
336 | 337 |
337 port.on("prefs.toggle", (message, sender) => | 338 port.on("prefs.toggle", (message, sender) => |
338 { | 339 { |
339 if (message.key == "notifications_ignoredcategories") | 340 if (message.key == "notifications_ignoredcategories") |
340 return NotificationStorage.toggleIgnoreCategory("*"); | 341 return NotificationStorage.toggleIgnoreCategory("*"); |
341 | 342 |
342 return Prefs[message.key] = !Prefs[message.key]; | 343 return Prefs[message.key] = !Prefs[message.key]; |
343 }); | 344 }); |
344 | 345 |
346 port.on("notifications.get", (message, sender) => | |
347 { | |
348 let notification = getActiveNotification(); | |
349 | |
350 if (!notification || | |
351 "displayMethod" in message && | |
352 !shouldDisplay(message.displayMethod, notification.type)) | |
353 return; | |
354 | |
355 let texts = NotificationStorage.getLocalizedTexts(notification, | |
356 message.locale); | |
357 return Object.assign({}, notification, {texts}); | |
Thomas Greiner
2017/10/09 10:52:59
Detail: The third argument is redundant because yo
kzar
2017/10/09 11:13:51
Good point, Done.
| |
358 }); | |
359 | |
345 port.on("subscriptions.add", (message, sender) => | 360 port.on("subscriptions.add", (message, sender) => |
346 { | 361 { |
347 let subscription = Subscription.fromURL(message.url); | 362 let subscription = Subscription.fromURL(message.url); |
348 if (message.confirm) | 363 if (message.confirm) |
349 { | 364 { |
350 if ("title" in message) | 365 if ("title" in message) |
351 subscription.title = message.title; | 366 subscription.title = message.title; |
352 if ("homepage" in message) | 367 if ("homepage" in message) |
353 subscription.homepage = message.homepage; | 368 subscription.homepage = message.homepage; |
354 | 369 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 if (message.url) | 429 if (message.url) |
415 subscriptions = [Subscription.fromURL(message.url)]; | 430 subscriptions = [Subscription.fromURL(message.url)]; |
416 | 431 |
417 for (let subscription of subscriptions) | 432 for (let subscription of subscriptions) |
418 { | 433 { |
419 if (subscription instanceof DownloadableSubscription) | 434 if (subscription instanceof DownloadableSubscription) |
420 Synchronizer.execute(subscription, true); | 435 Synchronizer.execute(subscription, true); |
421 } | 436 } |
422 }); | 437 }); |
423 })(this); | 438 })(this); |
OLD | NEW |