| LEFT | RIGHT |
| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 }); | 336 }); |
| 337 | 337 |
| 338 port.on("prefs.toggle", (message, sender) => | 338 port.on("prefs.toggle", (message, sender) => |
| 339 { | 339 { |
| 340 if (message.key == "notifications_ignoredcategories") | 340 if (message.key == "notifications_ignoredcategories") |
| 341 return NotificationStorage.toggleIgnoreCategory("*"); | 341 return NotificationStorage.toggleIgnoreCategory("*"); |
| 342 | 342 |
| 343 return Prefs[message.key] = !Prefs[message.key]; | 343 return Prefs[message.key] = !Prefs[message.key]; |
| 344 }); | 344 }); |
| 345 | 345 |
| 346 port.on( | 346 port.on("notifications.get", (message, sender) => |
| 347 "notifications.getActive", | 347 { |
| 348 (message, sender) => getActiveNotification() | 348 let notification = getActiveNotification(); |
| 349 ); | 349 |
| 350 | 350 if (!notification || |
| 351 port.on( | 351 "displayMethod" in message && |
| 352 "notifications.shouldDisplay", | 352 !shouldDisplay(message.displayMethod, notification.type)) |
| 353 (message, sender) => shouldDisplay(message.method, message.notificationType) | 353 return; |
| 354 ); | 354 |
| 355 | 355 let texts = NotificationStorage.getLocalizedTexts(notification, |
| 356 port.on( | 356 message.locale); |
| 357 "notifications.getLocalizedTexts", | 357 return Object.assign({texts}, notification); |
| 358 (message, sender) => | 358 }); |
| 359 NotificationStorage.getLocalizedTexts( | |
| 360 message.notification, message.locale | |
| 361 ) | |
| 362 ); | |
| 363 | 359 |
| 364 port.on("subscriptions.add", (message, sender) => | 360 port.on("subscriptions.add", (message, sender) => |
| 365 { | 361 { |
| 366 let subscription = Subscription.fromURL(message.url); | 362 let subscription = Subscription.fromURL(message.url); |
| 367 if (message.confirm) | 363 if (message.confirm) |
| 368 { | 364 { |
| 369 if ("title" in message) | 365 if ("title" in message) |
| 370 subscription.title = message.title; | 366 subscription.title = message.title; |
| 371 if ("homepage" in message) | 367 if ("homepage" in message) |
| 372 subscription.homepage = message.homepage; | 368 subscription.homepage = message.homepage; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 if (message.url) | 429 if (message.url) |
| 434 subscriptions = [Subscription.fromURL(message.url)]; | 430 subscriptions = [Subscription.fromURL(message.url)]; |
| 435 | 431 |
| 436 for (let subscription of subscriptions) | 432 for (let subscription of subscriptions) |
| 437 { | 433 { |
| 438 if (subscription instanceof DownloadableSubscription) | 434 if (subscription instanceof DownloadableSubscription) |
| 439 Synchronizer.execute(subscription, true); | 435 Synchronizer.execute(subscription, true); |
| 440 } | 436 } |
| 441 }); | 437 }); |
| 442 })(this); | 438 })(this); |
| LEFT | RIGHT |