mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update notifications
This commit is contained in:
parent
e9151896b2
commit
3b16c9d466
4 changed files with 29 additions and 8 deletions
|
@ -12,6 +12,8 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
document.addEventListener('click', onOneDocumentClick);
|
||||
document.addEventListener('keydown', onOneDocumentClick);
|
||||
|
||||
var serviceWorkerRegistration;
|
||||
|
||||
function closeAfter(notification, timeoutMs) {
|
||||
|
||||
setTimeout(function () {
|
||||
|
@ -25,8 +27,23 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
}, timeoutMs);
|
||||
}
|
||||
|
||||
function resetRegistration() {
|
||||
navigator.serviceWorker.ready.then(function (registration) {
|
||||
serviceWorkerRegistration = registration;
|
||||
});
|
||||
}
|
||||
|
||||
resetRegistration();
|
||||
|
||||
function show(title, options, timeoutMs) {
|
||||
|
||||
resetRegistration();
|
||||
|
||||
if (serviceWorkerRegistration && !timeoutMs) {
|
||||
serviceWorkerRegistration.showNotification(title, options);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
var notif = new Notification(title, options);
|
||||
|
||||
|
@ -140,10 +157,10 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
else if (status == 'progress') {
|
||||
notification.title = globalize.translate('LabelInstallingPackage').replace('{0}', installation.Name + ' ' + installation.Version);
|
||||
|
||||
notification.actions =
|
||||
[
|
||||
{ action: 'cancel', title: globalize.translate('ButtonCancel')/*, icon: 'https://example/like.png'*/ }
|
||||
];
|
||||
//notification.actions =
|
||||
//[
|
||||
// { action: 'cancel', title: globalize.translate('ButtonCancel')/*, icon: 'https://example/like.png'*/ }
|
||||
//];
|
||||
}
|
||||
|
||||
if (status == 'progress') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue