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( |
| 347 "notifications.getActive", |
| 348 (message, sender) => getActiveNotification() |
| 349 ); |
| 350 |
| 351 port.on( |
| 352 "notifications.shouldDisplay", |
| 353 (message, sender) => shouldDisplay(message.method, message.notificationType) |
| 354 ); |
| 355 |
| 356 port.on( |
| 357 "notifications.getLocalizedTexts", |
| 358 (message, sender) => |
| 359 NotificationStorage.getLocalizedTexts( |
| 360 message.notification, message.locale |
| 361 ) |
| 362 ); |
| 363 |
345 port.on("subscriptions.add", (message, sender) => | 364 port.on("subscriptions.add", (message, sender) => |
346 { | 365 { |
347 let subscription = Subscription.fromURL(message.url); | 366 let subscription = Subscription.fromURL(message.url); |
348 if (message.confirm) | 367 if (message.confirm) |
349 { | 368 { |
350 if ("title" in message) | 369 if ("title" in message) |
351 subscription.title = message.title; | 370 subscription.title = message.title; |
352 if ("homepage" in message) | 371 if ("homepage" in message) |
353 subscription.homepage = message.homepage; | 372 subscription.homepage = message.homepage; |
354 | 373 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 if (message.url) | 433 if (message.url) |
415 subscriptions = [Subscription.fromURL(message.url)]; | 434 subscriptions = [Subscription.fromURL(message.url)]; |
416 | 435 |
417 for (let subscription of subscriptions) | 436 for (let subscription of subscriptions) |
418 { | 437 { |
419 if (subscription instanceof DownloadableSubscription) | 438 if (subscription instanceof DownloadableSubscription) |
420 Synchronizer.execute(subscription, true); | 439 Synchronizer.execute(subscription, true); |
421 } | 440 } |
422 }); | 441 }); |
423 })(this); | 442 })(this); |
OLD | NEW |