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 |
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 const {startIconAnimation, stopIconAnimation} = require("icon"); | 22 const {startIconAnimation, stopIconAnimation} = require("./icon"); |
23 const {Utils} = require("utils"); | 23 const {Utils} = require("./utils"); |
24 const {Notification: NotificationStorage} = require("notification"); | 24 const {Notification: NotificationStorage} = |
25 const {stringifyURL} = require("url"); | 25 require("../adblockpluscore/lib/notification"); |
26 const {initAntiAdblockNotification} = require("antiadblockInit"); | 26 const {stringifyURL} = require("./url"); |
27 const {Prefs} = require("prefs"); | 27 const {initAntiAdblockNotification} = |
28 const {showOptions} = require("options"); | 28 require("../adblockplusui/lib/antiadblockInit"); |
| 29 const {Prefs} = require("./prefs"); |
| 30 const {showOptions} = require("./options"); |
29 | 31 |
30 let activeNotification = null; | 32 let activeNotification = null; |
31 let activeButtons = null; | 33 let activeButtons = null; |
32 let defaultDisplayMethods = ["popup"]; | 34 let defaultDisplayMethods = ["popup"]; |
33 let displayMethods = Object.create(null); | 35 let displayMethods = Object.create(null); |
34 displayMethods.critical = ["icon", "notification", "popup"]; | 36 displayMethods.critical = ["icon", "notification", "popup"]; |
35 displayMethods.question = ["notification"]; | 37 displayMethods.question = ["notification"]; |
36 displayMethods.normal = ["notification"]; | 38 displayMethods.normal = ["notification"]; |
37 displayMethods.relentless = ["notification"]; | 39 displayMethods.relentless = ["notification"]; |
38 displayMethods.information = ["icon", "popup"]; | 40 displayMethods.information = ["icon", "popup"]; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 let methods = displayMethods[notificationType] || defaultDisplayMethods; | 302 let methods = displayMethods[notificationType] || defaultDisplayMethods; |
301 return methods.includes(method); | 303 return methods.includes(method); |
302 }; | 304 }; |
303 | 305 |
304 ext.pages.onLoading.addListener(page => | 306 ext.pages.onLoading.addListener(page => |
305 { | 307 { |
306 NotificationStorage.showNext(stringifyURL(page.url)); | 308 NotificationStorage.showNext(stringifyURL(page.url)); |
307 }); | 309 }); |
308 | 310 |
309 NotificationStorage.addShowListener(showNotification); | 311 NotificationStorage.addShowListener(showNotification); |
OLD | NEW |