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 |
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} = require("notification"); |
25 const {stringifyURL} = require("url"); | 25 const {stringifyURL} = require("url"); |
26 const {initAntiAdblockNotification} = require("antiadblockInit"); | 26 const {initAntiAdblockNotification} = require("antiadblockInit"); |
27 const {Prefs} = require("prefs"); | 27 const {Prefs} = require("prefs"); |
28 const {showOptions} = require("options"); | |
28 | 29 |
29 let activeNotification = null; | 30 let activeNotification = null; |
30 let activeButtons = null; | 31 let activeButtons = null; |
31 let defaultDisplayMethods = ["popup"]; | 32 let defaultDisplayMethods = ["popup"]; |
32 let displayMethods = Object.create(null); | 33 let displayMethods = Object.create(null); |
33 displayMethods.critical = ["icon", "notification", "popup"]; | 34 displayMethods.critical = ["icon", "notification", "popup"]; |
34 displayMethods.question = ["notification"]; | 35 displayMethods.question = ["notification"]; |
35 displayMethods.normal = ["notification"]; | 36 displayMethods.normal = ["notification"]; |
36 displayMethods.relentless = ["notification"]; | 37 displayMethods.relentless = ["notification"]; |
37 displayMethods.information = ["icon", "popup"]; | 38 displayMethods.information = ["icon", "popup"]; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 switch (activeButtons[buttonIndex].type) | 117 switch (activeButtons[buttonIndex].type) |
117 { | 118 { |
118 case "link": | 119 case "link": |
119 ext.pages.open(Utils.getDocLink(activeNotification.links[buttonIndex])); | 120 ext.pages.open(Utils.getDocLink(activeNotification.links[buttonIndex])); |
120 break; | 121 break; |
121 case "open-all": | 122 case "open-all": |
122 openNotificationLinks(); | 123 openNotificationLinks(); |
123 break; | 124 break; |
124 case "configure": | 125 case "configure": |
125 Prefs.notifications_showui = true; | 126 Prefs.notifications_showui = true; |
126 ext.showOptions(page => | 127 showOptions(page => |
Sebastian Noack
2017/09/27 01:38:35
I didn't go through the code, but assuming all ins
Manish Jethani
2017/09/27 11:20:55
In messageResponder.js we have this:
ext.showOp
Sebastian Noack
2017/09/30 02:38:43
The callback there seems to be dead code to me. I
Manish Jethani
2017/09/30 13:49:52
This callback is required for the abp:subscribe li
Sebastian Noack
2017/10/02 01:47:04
abp:subscribe links are not handled through the ap
Manish Jethani
2017/10/02 08:03:12
Sorry, I referred to the wrong code.
Here's the p
| |
127 { | 128 { |
128 page.sendMessage({ | 129 page.sendMessage({ |
129 type: "app.respond", | 130 type: "app.respond", |
130 action: "focusSection", | 131 action: "focusSection", |
131 args: ["notifications"] | 132 args: ["notifications"] |
132 }); | 133 }); |
133 }); | 134 }); |
134 break; | 135 break; |
135 case "question": | 136 case "question": |
136 NotificationStorage.triggerQuestionListeners(activeNotification.id, | 137 NotificationStorage.triggerQuestionListeners(activeNotification.id, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 let methods = displayMethods[notificationType] || defaultDisplayMethods; | 273 let methods = displayMethods[notificationType] || defaultDisplayMethods; |
273 return methods.includes(method); | 274 return methods.includes(method); |
274 }; | 275 }; |
275 | 276 |
276 ext.pages.onLoading.addListener(page => | 277 ext.pages.onLoading.addListener(page => |
277 { | 278 { |
278 NotificationStorage.showNext(stringifyURL(page.url)); | 279 NotificationStorage.showNext(stringifyURL(page.url)); |
279 }); | 280 }); |
280 | 281 |
281 NotificationStorage.addShowListener(showNotification); | 282 NotificationStorage.addShowListener(showNotification); |
OLD | NEW |