mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Add browser notifications
This commit is contained in:
parent
ff532a5c6c
commit
d09c7b13b3
8 changed files with 236 additions and 22 deletions
|
@ -407,4 +407,43 @@ window.onerror = function (message, file, line) {
|
|||
|
||||
$.post("log_js_errors", e, function (data) {
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
PNotify.prototype.options.addclass = "stack-bottomright";
|
||||
PNotify.prototype.options.buttons.closer_hover = false;
|
||||
PNotify.prototype.options.desktop = { desktop: true, icon: 'images/favicon.png' }
|
||||
PNotify.prototype.options.history = false;
|
||||
PNotify.prototype.options.shadow = false;
|
||||
PNotify.prototype.options.stack = { dir1: 'up', dir2: 'left', firstpos1: 25, firstpos2: 25 };
|
||||
PNotify.prototype.options.styling = 'fontawesome';
|
||||
PNotify.prototype.options.type = 'notice';
|
||||
PNotify.prototype.options.width = '340px';
|
||||
|
||||
function displayPNotify(title, message) {
|
||||
var notification = new PNotify({
|
||||
title: title,
|
||||
text: message
|
||||
});
|
||||
}
|
||||
|
||||
function check_notifications() {
|
||||
$.getJSON('get_browser_notifications', function (data) {
|
||||
$.each(data, function (i, notification) {
|
||||
if (notification.delay == 0) {
|
||||
PNotify.prototype.options.hide = false;
|
||||
} else {
|
||||
PNotify.prototype.options.hide = true;
|
||||
PNotify.prototype.options.delay = notification.delay * 1000;
|
||||
}
|
||||
displayPNotify(notification.subject_text, notification.body_text);
|
||||
});
|
||||
});
|
||||
setTimeout(function () {
|
||||
"use strict";
|
||||
check_notifications();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
check_notifications();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue