sonarr-repo-only/NzbDrone.Web/Scripts/Notification.js

47 lines
963 B
JavaScript
Raw Normal View History

/// <reference path="jquery-1.5.2-vsdoc.js" />
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',
2010-10-18 06:06:16 +00:00
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