1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

support notifications in firefox

This commit is contained in:
Luke Pulverenti 2013-05-31 11:03:40 -04:00
parent 1ac0f71d1e
commit d4ba64d07a
2 changed files with 20 additions and 13 deletions

View file

@ -69,18 +69,24 @@ var WebNotifications = {
}
}
else if (window.Notification) {
if (Notification.permissionLevel() === "granted") {
var notif = new Notification(data.title, data);
notif.show();
if (data.timeout) {
var level = Notification.permissionLevel ? Notification.permissionLevel() : Notification.permission;
if (level === "granted") {
var notif = new Notification(data.title, data);
if (notif.show) {
notif.show();
}
if (data.timeout && notif.cancel) {
setTimeout(function () {
notif.cancel();
}, data.timeout);
}
return notif;
} else if (Notification.permissionLevel() === "default") {
} else if (level === "default") {
Notification.requestPermission(function () {
return WebNotifications.show(data);
});
@ -97,8 +103,10 @@ var WebNotifications = {
}
}
else if (window.Notification) {
if (Notification.permissionLevel() === "granted") {
} else if (Notification.permissionLevel() === "default") {
var level = Notification.permissionLevel ? Notification.permissionLevel() : Notification.permission;
if (level === "default") {
Notification.requestPermission(function () {
});
}