Update PNotify to latest master (2014-12-25) and add desktop notifications.

This commit is contained in:
tehspede 2015-02-14 20:25:38 +02:00
parent 3704e9a295
commit 65d30ddb47
3 changed files with 24 additions and 58 deletions

View file

@ -52,6 +52,8 @@
* Change IPT urls to reduce 301 redirection * Change IPT urls to reduce 301 redirection
* Add detection of file-system having no support for link creation (e.g. Unraid shares) * Add detection of file-system having no support for link creation (e.g. Unraid shares)
* Add catch exceptions when unable to cache a requests response * Add catch exceptions when unable to cache a requests response
* Update PNotify to latest master (2014-12-25) for desktop notifications
* Add desktop notifications
[develop changelog] [develop changelog]
* Change uT params from unicode to str.format as magnet URLs worked but sending files in POST bodies failed * Change uT params from unicode to str.format as magnet URLs worked but sending files in POST bodies failed

View file

@ -7,25 +7,30 @@ PNotify.prototype.options.width = '340px';
PNotify.prototype.options.shadow = false; PNotify.prototype.options.shadow = false;
PNotify.prototype.options.addclass = 'stack-bottomright'; PNotify.prototype.options.addclass = 'stack-bottomright';
PNotify.prototype.options.stack = {'dir1': 'up', 'dir2': 'left', 'firstpos1': 25, 'firstpos2': 25}; PNotify.prototype.options.stack = {'dir1': 'up', 'dir2': 'left', 'firstpos1': 25, 'firstpos2': 25};
PNotify.desktop.permission();
function check_notifications() { function check_notifications() {
if(document.visibilityState == 'visible') { if(document.visibilityState == 'visible') {
$.getJSON(message_url, function(data){ $.getJSON(message_url, function(data){
$.each(data, function(name,data){ $.each(data, function(name,data){
new PNotify({ new PNotify({
type: data.type, type: data.type,
hide: data.type == 'notice', hide: data.type == 'notice',
title: data.title, title: data.title,
text: data.message, text: data.message.replace(/<\/?i>/ig, '*'),
history: false history: false,
}); desktop: {
}); desktop: true,
}); icon: '../images/ico/apple-touch-icon-180x180.png'
} }
});
setTimeout(check_notifications, 3000) });
});
}
setTimeout(check_notifications, 3000)
} }
$(document).ready(function(){ $(document).ready(function(){
check_notifications(); check_notifications();
}); });

File diff suppressed because one or more lines are too long