2014-09-30 18:20:37 -04:00
|
|
|
var message_url = sbRoot + '/ui/get_messages';
|
2014-11-06 23:13:54 -05:00
|
|
|
|
|
|
|
PNotify.prototype.options.styling = 'jqueryui';
|
|
|
|
PNotify.prototype.options.buttons.closer_hover = false;
|
|
|
|
PNotify.prototype.options.delay = 4000;
|
|
|
|
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};
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
function check_notifications() {
|
2014-11-06 23:13:54 -05:00
|
|
|
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
|
|
|
|
});
|
2014-03-10 01:18:05 -04:00
|
|
|
});
|
2014-09-30 18:20:37 -04:00
|
|
|
});
|
2014-11-06 23:13:54 -05:00
|
|
|
}
|
2014-09-30 18:20:37 -04:00
|
|
|
|
|
|
|
setTimeout(check_notifications, 3000)
|
2014-03-10 01:18:05 -04:00
|
|
|
}
|
|
|
|
|
2014-09-30 18:20:37 -04:00
|
|
|
$(document).ready(function(){
|
2014-03-10 01:18:05 -04:00
|
|
|
check_notifications();
|
|
|
|
});
|