mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-30 11:48:26 -07:00
Added series update notification.
This commit is contained in:
parent
76dee4aff2
commit
76379341a7
28 changed files with 881 additions and 6587 deletions
71
NzbDrone.Web/Scripts/Notification.js
Normal file
71
NzbDrone.Web/Scripts/Notification.js
Normal file
|
@ -0,0 +1,71 @@
|
|||
(function ($) {
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var popups = [];
|
||||
|
||||
$.jGrowl.defaults.closer = false;
|
||||
$.jGrowl.defaults.closeTemplate = '';
|
||||
|
||||
|
||||
if (!$.browser.safari) {
|
||||
$.jGrowl.defaults.animateOpen = {
|
||||
width: 'show'
|
||||
};
|
||||
|
||||
$.jGrowl.defaults.animateClose = {
|
||||
width: 'hide'
|
||||
};
|
||||
}
|
||||
refreshNotifications();
|
||||
var timer = window.setInterval(refreshNotifications, 2000);
|
||||
|
||||
function refreshNotifications() {
|
||||
$.ajax({
|
||||
url: '/Notification',
|
||||
success: notificationCallback
|
||||
});
|
||||
}
|
||||
|
||||
var failAjaxCounter = 0;
|
||||
function notificationCallback(data) {
|
||||
|
||||
if (data === "") {
|
||||
failAjaxCounter = failAjaxCounter + 1;
|
||||
|
||||
if (failAjaxCounter === 3) {
|
||||
window.clearInterval(timer);
|
||||
}
|
||||
}
|
||||
else {
|
||||
failAjaxCounter = 0;
|
||||
for (var i in data) {
|
||||
|
||||
var titleId = data[i].Id + "_title";
|
||||
var bodyId = data[i].Id + "_body";
|
||||
|
||||
//New Notification
|
||||
if (popups[i] == undefined) {
|
||||
popups[i] = new Object();
|
||||
popups[i].Id = data;
|
||||
$.jGrowl(MakeDiv(bodyId, data[i].CurrentStatus), { sticky: true, header: MakeDiv(titleId, data[i].Title), id: data[i].Id });
|
||||
}
|
||||
//Update Existing Notification
|
||||
else {
|
||||
$('#' + bodyId).html(data[i].CurrentStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cleanUp(data) {
|
||||
$(
|
||||
|
||||
}
|
||||
|
||||
function MakeDiv(id, body) {
|
||||
return "<div id ='" + id + "'>" + body + "</div>";
|
||||
}
|
||||
|
||||
});
|
||||
})(jQuery);
|
Loading…
Add table
Add a link
Reference in a new issue