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 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (canUseChromeNotifications) | 193 if (canUseChromeNotifications) |
194 { | 194 { |
195 activeButtons = getNotificationButtons(activeNotification.type, texts.mess
age); | 195 activeButtons = getNotificationButtons(activeNotification.type, texts.mess
age); |
196 chrome.notifications.create("", { | 196 chrome.notifications.create("", { |
197 type: "basic", | 197 type: "basic", |
198 title: title, | 198 title: title, |
199 iconUrl: iconUrl, | 199 iconUrl: iconUrl, |
200 message: message, | 200 message: message, |
201 buttons: activeButtons.map(button => ({title: button.title})), | 201 buttons: activeButtons.map(button => ({title: button.title})), |
202 priority: 2 // We use the highest priority to prevent the notification f
rom closing automatically | 202 priority: 2 // We use the highest priority to prevent the notification f
rom closing automatically |
203 }, function() {}); | 203 }); |
204 } | 204 } |
205 else if ("Notification" in window && activeNotification.type != "question") | 205 else if ("Notification" in window && activeNotification.type != "question") |
206 { | 206 { |
207 if (linkCount > 0) | 207 if (linkCount > 0) |
208 message += " " + ext.i18n.getMessage("notification_without_buttons"); | 208 message += " " + ext.i18n.getMessage("notification_without_buttons"); |
209 | 209 |
210 let notification = new Notification( | 210 let notification = new Notification( |
211 title, | 211 title, |
212 { | 212 { |
213 lang: Utils.appLocale, | 213 lang: Utils.appLocale, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 * @param {string} notificationType | 275 * @param {string} notificationType |
276 * @return {boolean} | 276 * @return {boolean} |
277 */ | 277 */ |
278 exports.shouldDisplay = function(method, notificationType) | 278 exports.shouldDisplay = function(method, notificationType) |
279 { | 279 { |
280 let methods = displayMethods[notificationType] || defaultDisplayMethods; | 280 let methods = displayMethods[notificationType] || defaultDisplayMethods; |
281 return methods.indexOf(method) > -1; | 281 return methods.indexOf(method) > -1; |
282 }; | 282 }; |
283 | 283 |
284 NotificationStorage.addShowListener(showNotification); | 284 NotificationStorage.addShowListener(showNotification); |
LEFT | RIGHT |