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-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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 /** @module notificationHelper */ | 18 /** @module notificationHelper */ |
19 | 19 |
20 "use strict"; | 20 "use strict"; |
21 | 21 |
22 let {startIconAnimation, stopIconAnimation} = require("icon"); | 22 const {startIconAnimation, stopIconAnimation} = require("icon"); |
23 let {Utils} = require("utils"); | 23 const {Utils} = require("utils"); |
24 let {Notification: NotificationStorage} = require("notification"); | 24 const {Notification: NotificationStorage} = require("notification"); |
25 let {stringifyURL} = require("url"); | 25 const {stringifyURL} = require("url"); |
26 let {initAntiAdblockNotification} = require("antiadblockInit"); | 26 const {initAntiAdblockNotification} = require("antiadblockInit"); |
27 let {Prefs} = require("prefs"); | 27 const {Prefs} = require("prefs"); |
28 | 28 |
29 let activeNotification = null; | 29 let activeNotification = null; |
30 let activeButtons = null; | 30 let activeButtons = null; |
31 let defaultDisplayMethods = ["popup"]; | 31 let defaultDisplayMethods = ["popup"]; |
32 let displayMethods = Object.create(null); | 32 let displayMethods = Object.create(null); |
33 displayMethods.critical = ["icon", "notification", "popup"]; | 33 displayMethods.critical = ["icon", "notification", "popup"]; |
34 displayMethods.question = ["notification"]; | 34 displayMethods.question = ["notification"]; |
35 displayMethods.normal = ["notification"]; | 35 displayMethods.normal = ["notification"]; |
36 displayMethods.information = ["icon", "popup"]; | 36 displayMethods.information = ["icon", "popup"]; |
37 | 37 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 let methods = displayMethods[notificationType] || defaultDisplayMethods; | 259 let methods = displayMethods[notificationType] || defaultDisplayMethods; |
260 return methods.indexOf(method) > -1; | 260 return methods.indexOf(method) > -1; |
261 }; | 261 }; |
262 | 262 |
263 ext.pages.onLoading.addListener(page => | 263 ext.pages.onLoading.addListener(page => |
264 { | 264 { |
265 NotificationStorage.showNext(stringifyURL(page.url)); | 265 NotificationStorage.showNext(stringifyURL(page.url)); |
266 }); | 266 }); |
267 | 267 |
268 NotificationStorage.addShowListener(showNotification); | 268 NotificationStorage.addShowListener(showNotification); |
LEFT | RIGHT |