Radarr/NzbDrone.Web/Scripts/Notification.js

48 lines
964 B
JavaScript
Raw Normal View History

2010-10-18 06:06:16 +00:00
/// <reference path="jquery-1.4.1-vsdoc.js" />
2010-10-12 02:49:27 +00:00
2010-10-18 06:06:16 +00:00
$(function () {
var speed = 0;
refreshNotifications();
2010-10-12 02:49:27 +00:00
2010-10-18 06:06:16 +00:00
var timer = window.setInterval(function () {
speed = 1000;
2010-10-18 06:06:16 +00:00
refreshNotifications();
}, 2000);
2010-10-12 02:49:27 +00:00
2010-10-18 06:06:16 +00:00
function refreshNotifications() {
$.ajax({
url: '/Notification',
success: notificationCallback
});
}
2010-10-12 02:49:27 +00:00
2010-10-18 06:06:16 +00:00
function notificationCallback(data) {
2010-10-12 02:49:27 +00:00
2010-10-18 06:06:16 +00:00
if (data === "") {
CloseMsg();
2010-10-12 02:49:27 +00:00
}
2010-10-18 06:06:16 +00:00
else {
DisplayMsg(data);
2010-10-12 02:49:27 +00:00
}
2010-10-18 06:06:16 +00:00
}
2010-10-12 02:49:27 +00:00
2010-10-18 06:06:16 +00:00
//SetupNotifications();
//DisplayMsg("Scanning Series Folder.");
2010-10-12 02:49:27 +00:00
2010-10-18 06:06:16 +00:00
function DisplayMsg(sMsg) {
//set the message text
$("#msgText").text(sMsg);
//show the message
$('#msgBox').slideDown(speed, null);
2010-10-18 06:06:16 +00:00
}
2010-10-12 02:49:27 +00:00
2010-10-18 06:06:16 +00:00
function CloseMsg() {
//hide the message
$('#msgBox').slideUp(speed, null);
//clear msg text
$("#msgtText").val("");
}
});
2010-10-12 02:49:27 +00:00