This commit is contained in:
Trevor Squillario 2012-07-20 16:39:18 -04:00
parent d8331b7a2c
commit e16f840e56
11 changed files with 187 additions and 82 deletions

View file

@ -161,10 +161,15 @@ function hasNotificationPermission() {
return !!(window.webkitNotifications) && (window.webkitNotifications.checkPermission() == 0);
}
var notifications = new Array();
function showNotification(pic, title, text) {
function showNotification(pic, title, text, type) {
if (hasNotificationPermission()) {
closeAllNotifications()
var popup = window.webkitNotifications.createNotification(pic, title, text);
//closeAllNotifications()
var popup;
if (type == 'text') {
popup = window.webkitNotifications.createNotification(pic, title, text);
} else if (type == 'html') {
popup = window.webkitNotifications.createHTMLNotification(text);
}
notifications.push(popup);
setTimeout(function (notWin) {
notWin.cancel();