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
* 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
* Update PNotify to latest master (2014-12-25) for desktop notifications
* Add desktop notifications
[develop changelog]
* 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.addclass = 'stack-bottomright';
PNotify.prototype.options.stack = {'dir1': 'up', 'dir2': 'left', 'firstpos1': 25, 'firstpos2': 25};
PNotify.desktop.permission();
function check_notifications() {
if(document.visibilityState == 'visible') {
$.getJSON(message_url, function(data){
$.each(data, function(name,data){
new PNotify({
type: data.type,
hide: data.type == 'notice',
title: data.title,
text: data.message,
history: false
});
});
});
}
setTimeout(check_notifications, 3000)
if(document.visibilityState == 'visible') {
$.getJSON(message_url, function(data){
$.each(data, function(name,data){
new PNotify({
type: data.type,
hide: data.type == 'notice',
title: data.title,
text: data.message.replace(/<\/?i>/ig, '*'),
history: false,
desktop: {
desktop: true,
icon: '../images/ico/apple-touch-icon-180x180.png'
}
});
});
});
}
setTimeout(check_notifications, 3000)
}
$(document).ready(function(){
check_notifications();
check_notifications();
});

File diff suppressed because one or more lines are too long