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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 var backgroundPage = ext.backgroundPage.getWindow(); | 18 var backgroundPage = ext.backgroundPage.getWindow(); |
19 var require = backgroundPage.require; | 19 var require = backgroundPage.require; |
20 | 20 |
21 var Utils = require("utils").Utils; | 21 var Utils = require("utils").Utils; |
22 var Notification = require("notification").Notification; | 22 var Notification = require("notification").Notification; |
23 var getActiveNotification = require("notificationHelper").getActiveNotification; | 23 var notificationHelper = require("notificationHelper"); |
| 24 var getActiveNotification = notificationHelper.getActiveNotification; |
| 25 var shouldDisplayNotification = notificationHelper.shouldDisplay; |
24 | 26 |
25 function getDocLinks(notification) | 27 function getDocLinks(notification) |
26 { | 28 { |
27 if (!notification.links) | 29 if (!notification.links) |
28 return []; | 30 return []; |
29 | 31 |
30 var docLinks = []; | 32 var docLinks = []; |
31 notification.links.forEach(function(link) | 33 notification.links.forEach(function(link) |
32 { | 34 { |
33 docLinks.push(Utils.getDocLink(link)); | 35 docLinks.push(Utils.getDocLink(link)); |
(...skipping 22 matching lines...) Expand all Loading... |
56 newElement.href = links.shift(); | 58 newElement.href = links.shift(); |
57 insertMessage(newElement, value, links); | 59 insertMessage(newElement, value, links); |
58 element.appendChild(newElement); | 60 element.appendChild(newElement); |
59 | 61 |
60 insertMessage(element, after, links); | 62 insertMessage(element, after, links); |
61 } | 63 } |
62 | 64 |
63 window.addEventListener("load", function() | 65 window.addEventListener("load", function() |
64 { | 66 { |
65 var notification = getActiveNotification(); | 67 var notification = getActiveNotification(); |
66 if (!notification | 68 if (!notification || !shouldDisplayNotification("popup", notification.type)) |
67 || notification.type == "question" | |
68 || notification.type == "normal") | |
69 return; | 69 return; |
70 | 70 |
71 var texts = Notification.getLocalizedTexts(notification); | 71 var texts = Notification.getLocalizedTexts(notification); |
72 var titleElement = document.getElementById("notification-title"); | 72 var titleElement = document.getElementById("notification-title"); |
73 titleElement.textContent = texts.title; | 73 titleElement.textContent = texts.title; |
74 | 74 |
75 var docLinks = getDocLinks(notification); | 75 var docLinks = getDocLinks(notification); |
76 var messageElement = document.getElementById("notification-message"); | 76 var messageElement = document.getElementById("notification-message"); |
77 insertMessage(messageElement, texts.message, docLinks); | 77 insertMessage(messageElement, texts.message, docLinks); |
78 | 78 |
(...skipping 21 matching lines...) Expand all Loading... |
100 break; | 100 break; |
101 case "notification-optout": | 101 case "notification-optout": |
102 Notification.toggleIgnoreCategory("*", true); | 102 Notification.toggleIgnoreCategory("*", true); |
103 case "notification-hide": | 103 case "notification-hide": |
104 notificationElement.hidden = true; | 104 notificationElement.hidden = true; |
105 notification.onClicked(); | 105 notification.onClicked(); |
106 break; | 106 break; |
107 } | 107 } |
108 }, true); | 108 }, true); |
109 }, false); | 109 }, false); |
LEFT | RIGHT |