added browser notifications
This commit is contained in:
parent
680dc5f0d0
commit
538bf77cbe
|
@ -95,6 +95,7 @@ function spawnWebsocket(pa) {
|
|||
if (data.part + 1 === data.total) {
|
||||
var blob = new Blob(a, {type: data.type});
|
||||
|
||||
notify('File downloaded', data.name);
|
||||
$('#please-wait').remove();
|
||||
$('#loading').remove();
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
function notify(title, body) {
|
||||
if (!Notification) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Notification.permission !== "granted") {
|
||||
Notification.requestPermission();
|
||||
} else {
|
||||
let options = {
|
||||
body: body,
|
||||
icon: '/img/lufi196.png'
|
||||
};
|
||||
let n = new Notification(title, options);
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
if (!Notification) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Notification.permission !== "granted")
|
||||
Notification.requestPermission();
|
||||
});
|
|
@ -477,6 +477,8 @@ function updateProgressBar(data) {
|
|||
console.log('Error on WebSocket connection but file has been fully send, so we don\'t care.');
|
||||
}
|
||||
|
||||
notify('File uploaded', data.name);
|
||||
|
||||
$('#parts-'+window.fc).remove();
|
||||
var n = $('#name-'+window.fc);
|
||||
var s = $('#size-'+window.fc);
|
||||
|
|
|
@ -165,5 +165,6 @@
|
|||
%= javascript '/js/moment-with-locales.min.js'
|
||||
%= javascript '/js/filesize.min.js'
|
||||
%= javascript '/js/jszip.min.js'
|
||||
%= javascript '/js/lufi-notifications.js'
|
||||
%= javascript '/js/lufi-up.js'
|
||||
% }
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
%= javascript '/js/filesize.min.js'
|
||||
%= javascript '/js/sjcl.js'
|
||||
%= javascript '/js/jszip.min.js'
|
||||
%= javascript '/js/lufi-notifications.js'
|
||||
%= javascript '/js/lufi-down.js'
|
||||
% }
|
||||
% }
|
||||
|
|
Loading…
Reference in New Issue