| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 iconAnimation.update(activeNotification.severity); | 292 iconAnimation.update(activeNotification.severity); |
| 293 } | 293 } |
| 294 | 294 |
| 295 function showNotification(notification) | 295 function showNotification(notification) |
| 296 { | 296 { |
| 297 activeNotification = notification; | 297 activeNotification = notification; |
| 298 | 298 |
| 299 if (activeNotification.severity === "critical" | 299 if (activeNotification.severity === "critical" |
| 300 && typeof webkitNotifications !== "undefined") | 300 && typeof webkitNotifications !== "undefined") |
| 301 { | 301 { |
| 302 var notification = webkitNotifications.createHTMLNotification("notification.
html"); | 302 if ("createHTMLNotification" in webkitNotifications) |
| 303 notification = webkitNotifications.createHTMLNotification("notification.ht
ml"); |
| 304 else if ("createNotification" in webkitNotifications) |
| 305 { |
| 306 var texts = Notification.getLocalizedTexts(notification); |
| 307 var title = texts.title ? texts.title : ""; |
| 308 var message = texts.message ? texts.message : ""; |
| 309 notification = webkitNotifications.createNotification("icons/abp-32.png",
title, message); |
| 310 } |
| 303 notification.show(); | 311 notification.show(); |
| 304 notification.addEventListener("close", prepareNotificationIconAndPopup); | 312 notification.addEventListener("close", prepareNotificationIconAndPopup); |
| 305 } | 313 } |
| 306 else | 314 else |
| 307 prepareNotificationIconAndPopup(); | 315 prepareNotificationIconAndPopup(); |
| 308 } | 316 } |
| 309 | 317 |
| 310 ext.onMessage.addListener(function (msg, sender, sendResponse) | 318 ext.onMessage.addListener(function (msg, sender, sendResponse) |
| 311 { | 319 { |
| 312 switch (msg.type) | 320 switch (msg.type) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 tab.sendMessage({type: "clickhide-deactivate"}); | 427 tab.sendMessage({type: "clickhide-deactivate"}); |
| 420 refreshIconAndContextMenu(tab); | 428 refreshIconAndContextMenu(tab); |
| 421 }); | 429 }); |
| 422 | 430 |
| 423 setTimeout(function() | 431 setTimeout(function() |
| 424 { | 432 { |
| 425 var notificationToShow = Notification.getNextToShow(); | 433 var notificationToShow = Notification.getNextToShow(); |
| 426 if (notificationToShow) | 434 if (notificationToShow) |
| 427 showNotification(notificationToShow); | 435 showNotification(notificationToShow); |
| 428 }, 3 * 60 * 1000); | 436 }, 3 * 60 * 1000); |
| OLD | NEW |