Browse Source

Update desktop-notify to b5bc3b27f.

pull/106/head
Evan Theurer 11 years ago
parent
commit
9eca1b27dc
  1. 16
      static/js/libs/desktop-notify.js

16
static/js/libs/desktop-notify.js

@ -15,6 +15,7 @@
* *
* Author: Tsvetan Tsvetkov (tsekach@gmail.com) * Author: Tsvetan Tsvetkov (tsekach@gmail.com)
*/ */
//https://raw.githubusercontent.com/ttsvetko/HTML5-Desktop-Notifications/b5bc3b27fc042630d16ed55bae378a73d94d02ab/desktop-notify.js
(function (win) { (function (win) {
/* /*
Safari native methods required for Notifications do NOT run in strict mode. Safari native methods required for Notifications do NOT run in strict mode.
@ -39,7 +40,7 @@
* *
* Also, we canNOT detect if msIsSiteMode method exists, as it is * Also, we canNOT detect if msIsSiteMode method exists, as it is
* a method of host object. In IE check for existing method of host * a method of host object. In IE check for existing method of host
* object returns undefined. So, we try to run it - if it runs * object returns undefined. So, we try to run it - if it runs
* successfully - then it is IE9+, if not - an exceptions is thrown. * successfully - then it is IE9+, if not - an exceptions is thrown.
*/ */
try { try {
@ -104,6 +105,9 @@
if (notification.close) { if (notification.close) {
//http://code.google.com/p/ff-html5notifications/issues/detail?id=58 //http://code.google.com/p/ff-html5notifications/issues/detail?id=58
notification.close(); notification.close();
}
else if (notification.cancel) {
notification.cancel();
} else if (win.external && win.external.msIsSiteMode()) { } else if (win.external && win.external.msIsSiteMode()) {
if (notification.ieVerification === ieVerification) { if (notification.ieVerification === ieVerification) {
win.external.msSiteModeClearIconOverlay(); win.external.msSiteModeClearIconOverlay();
@ -119,7 +123,7 @@
if (win.webkitNotifications && win.webkitNotifications.checkPermission) { if (win.webkitNotifications && win.webkitNotifications.checkPermission) {
/* /*
* Chrome 23 supports win.Notification.requestPermission, but it * Chrome 23 supports win.Notification.requestPermission, but it
* breaks the browsers, so use the old-webkit-prefixed * breaks the browsers, so use the old-webkit-prefixed
* win.webkitNotifications.checkPermission instead. * win.webkitNotifications.checkPermission instead.
* *
* Firefox with html5notifications plugin supports this method * Firefox with html5notifications plugin supports this method
@ -139,12 +143,12 @@
} else if (win.webkitNotifications && win.webkitNotifications.checkPermission) { } else if (win.webkitNotifications && win.webkitNotifications.checkPermission) {
//Chrome & Firefox with html5-notifications plugin installed //Chrome & Firefox with html5-notifications plugin installed
permission = PERMISSION[win.webkitNotifications.checkPermission()]; permission = PERMISSION[win.webkitNotifications.checkPermission()];
} else if (navigator.mozNotification) {
//Firefox Mobile
permission = PERMISSION_GRANTED;
} else if (win.Notification && win.Notification.permission) { } else if (win.Notification && win.Notification.permission) {
// Firefox 23+ // Firefox 23+
permission = win.Notification.permission; permission = win.Notification.permission;
} else if (navigator.mozNotification) {
//Firefox Mobile
permission = PERMISSION_GRANTED;
} else if (win.external && (win.external.msIsSiteMode() !== undefined)) { /* keep last */ } else if (win.external && (win.external.msIsSiteMode() !== undefined)) { /* keep last */
//IE9+ //IE9+
permission = win.external.msIsSiteMode() ? PERMISSION_GRANTED : PERMISSION_DEFAULT; permission = win.external.msIsSiteMode() ? PERMISSION_GRANTED : PERMISSION_DEFAULT;
@ -152,7 +156,7 @@
return permission; return permission;
} }
/** /**
* *
*/ */
function config(params) { function config(params) {
if (params && isObject(params)) { if (params && isObject(params)) {

Loading…
Cancel
Save