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-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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 * Initializes the notification system. | 240 * Initializes the notification system. |
241 */ | 241 */ |
242 exports.initNotifications = function() | 242 exports.initNotifications = function() |
243 { | 243 { |
244 if (canUseChromeNotifications) | 244 if (canUseChromeNotifications) |
245 initChromeNotifications(); | 245 initChromeNotifications(); |
246 initAntiAdblockNotification(); | 246 initAntiAdblockNotification(); |
247 }; | 247 }; |
248 | 248 |
249 /** | 249 /** |
250 * Shows the next notification (if any) for the supplied URL. | |
251 * | |
252 * @param {URL} url URL to match notifications to | |
253 */ | |
254 exports.showNextNotificationForUrl = function(url) | |
255 { | |
256 NotificationStorage.showNext(stringifyURL(url)); | |
257 }; | |
258 | |
259 /** | |
260 * Gets the active notification to be shown if any. | 250 * Gets the active notification to be shown if any. |
261 * | 251 * |
262 * @return {?object} | 252 * @return {?object} |
263 */ | 253 */ |
264 exports.getActiveNotification = function() | 254 exports.getActiveNotification = function() |
265 { | 255 { |
266 return activeNotification; | 256 return activeNotification; |
267 }; | 257 }; |
268 | 258 |
269 let shouldDisplay = | 259 let shouldDisplay = |
270 /** | 260 /** |
271 * Determines whether a given display method should be used for a | 261 * Determines whether a given display method should be used for a |
272 * specified notification type. | 262 * specified notification type. |
273 * | 263 * |
274 * @param {string} method Display method: icon, notification or popup | 264 * @param {string} method Display method: icon, notification or popup |
275 * @param {string} notificationType | 265 * @param {string} notificationType |
276 * @return {boolean} | 266 * @return {boolean} |
277 */ | 267 */ |
278 exports.shouldDisplay = function(method, notificationType) | 268 exports.shouldDisplay = function(method, notificationType) |
279 { | 269 { |
280 let methods = displayMethods[notificationType] || defaultDisplayMethods; | 270 let methods = displayMethods[notificationType] || defaultDisplayMethods; |
281 return methods.indexOf(method) > -1; | 271 return methods.indexOf(method) > -1; |
282 }; | 272 }; |
283 | 273 |
| 274 ext.pages.onLoading.addListener(page => |
| 275 { |
| 276 NotificationStorage.showNext(stringifyURL(page.url)); |
| 277 }); |
| 278 |
284 NotificationStorage.addShowListener(showNotification); | 279 NotificationStorage.addShowListener(showNotification); |
OLD | NEW |