mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
updated notification ui
This commit is contained in:
parent
273de41d23
commit
9c7500d4ae
11 changed files with 93 additions and 77 deletions
|
@ -1,66 +1,47 @@
|
|||
(function ($) {
|
||||
/// <reference path="jquery-1.4.1-vsdoc.js" />
|
||||
|
||||
$(document).ready(function () {
|
||||
$(function () {
|
||||
var speed = 0;
|
||||
refreshNotifications();
|
||||
|
||||
var popups = [];
|
||||
|
||||
$.jGrowl.defaults.closer = false;
|
||||
$.jGrowl.defaults.closeTemplate = '';
|
||||
|
||||
|
||||
if (!$.browser.safari) {
|
||||
$.jGrowl.defaults.animateOpen = {
|
||||
width: 'show'
|
||||
};
|
||||
|
||||
$.jGrowl.defaults.animateClose = {
|
||||
width: 'hide'
|
||||
};
|
||||
}
|
||||
var timer = window.setInterval(function () {
|
||||
speed = 1800;
|
||||
refreshNotifications();
|
||||
var timer = window.setInterval(refreshNotifications, 2000);
|
||||
}, 2000);
|
||||
|
||||
function refreshNotifications() {
|
||||
$.ajax({
|
||||
url: '/Notification',
|
||||
success: notificationCallback
|
||||
});
|
||||
function refreshNotifications() {
|
||||
$.ajax({
|
||||
url: '/Notification',
|
||||
success: notificationCallback
|
||||
});
|
||||
}
|
||||
|
||||
function notificationCallback(data) {
|
||||
|
||||
if (data === "") {
|
||||
CloseMsg();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
DisplayMsg(data);
|
||||
}
|
||||
}
|
||||
|
||||
//SetupNotifications();
|
||||
//DisplayMsg("Scanning Series Folder.");
|
||||
|
||||
function DisplayMsg(sMsg) {
|
||||
//set the message text
|
||||
$("#msgText").text(sMsg);
|
||||
//show the message
|
||||
$('#msgBox').slideUp(speed, null);
|
||||
}
|
||||
|
||||
function CloseMsg() {
|
||||
//hide the message
|
||||
$('#msgBox').slideUp(speed, null);
|
||||
//clear msg text
|
||||
$("#msgtText").val("");
|
||||
}
|
||||
});
|
||||
|
||||
function MakeDiv(id, body) {
|
||||
return "<div id ='" + id + "'>" + body + "</div>";
|
||||
}
|
||||
|
||||
});
|
||||
})(jQuery);
|
||||
|
|
|
@ -182,9 +182,11 @@
|
|||
var self = this;
|
||||
var message = notification.message;
|
||||
var o = notification.options;
|
||||
|
||||
|
||||
var notification = $(
|
||||
'<div class="jGrowl-notification ui-state-highlight ui-corner-all' +
|
||||
'<div id=' +
|
||||
notification.options.guid +' class="jGrowl-notification ui-state-highlight ui-corner-all' +
|
||||
((o.group != undefined && o.group != '') ? ' ' + o.group : '') + '">' +
|
||||
'<div class="close">' + o.closeTemplate + '</div>' +
|
||||
'<div class="header">' + o.header + '</div>' +
|
||||
|
@ -211,7 +213,7 @@
|
|||
$('div.jGrowl-notification:first', self.element).before(notification);
|
||||
}
|
||||
|
||||
$(this).animate(o.animateOpen, o.speed, o.easing, function () {
|
||||
$(this).animate(o.animateOpen, 0, o.easing, function () {
|
||||
// Fixes some anti-aliasing issues with IE filters.
|
||||
if ($.browser.msie && (parseInt($(this).css('opacity'), 10) === 1 || parseInt($(this).css('opacity'), 10) === 0))
|
||||
this.style.removeAttribute('filter');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue