From 3ce8ffe21f4cd98e919fe6402627df6a8532979d Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 11 Oct 2012 20:16:57 -0700 Subject: [PATCH] Signalr working with Font-Awesome --- NzbDrone.Web/Scripts/NzbDrone/AutoBind.js | 58 +++++++++++++++-------- NzbDrone.Web/Scripts/NzbDrone/grid.js | 11 ++--- 2 files changed, 41 insertions(+), 28 deletions(-) diff --git a/NzbDrone.Web/Scripts/NzbDrone/AutoBind.js b/NzbDrone.Web/Scripts/NzbDrone/AutoBind.js index 2d95f2d02..544e032bd 100644 --- a/NzbDrone.Web/Scripts/NzbDrone/AutoBind.js +++ b/NzbDrone.Web/Scripts/NzbDrone/AutoBind.js @@ -54,32 +54,48 @@ }); }); - $('[data-status]').livequery(function () { - var status = $(this).attr('data-status'); - + $('[data-status="Downloading"]').livequery(function () { $(this).removeClass(function (index, css) { return (css.match(/\bicon-\S+/g) || []).join(' '); }); - if (status == 'Downloading') { - $(this).addClass('icon-download-alt'); - } - - if (status == 'Ready') { - $(this).addClass('icon-play'); - } - - if (status == 'AirsToday') { - $(this).addClass('icon-time'); - } - - if (status == 'NotAired') { - $(this).addClass('icon-calendar'); - } + $(this).addClass('icon-download-alt'); + }); + + $('[data-status="Ready"]').livequery(function() { + $(this).removeClass(function (index, css) { + return (css.match(/\bicon-\S+/g) || []).join(' '); + }); + + $(this).addClass('icon-play'); + + }); + + $('[data-status="AirsToday"]').livequery(function () { + $(this).removeClass(function (index, css) { + return (css.match(/\bicon-\S+/g) || []).join(' '); + }); + + $(this).addClass('icon-time'); + + }); + + $('[data-status="NotAired"]').livequery(function () { + $(this).removeClass(function (index, css) { + return (css.match(/\bicon-\S+/g) || []).join(' '); + }); + + $(this).addClass('icon-calendar'); + + }); + + $('[data-status="Missing"]').livequery(function () { + $(this).removeClass(function (index, css) { + return (css.match(/\bicon-\S+/g) || []).join(' '); + }); + + $(this).addClass('icon-sign-blank'); - if (status == 'Missing') { - $(this).addClass('icon-sign-blank'); - } }); $('.infoBox, .successBox, .warningBox, .errorBox, .validationBox').livequery(function () { diff --git a/NzbDrone.Web/Scripts/NzbDrone/grid.js b/NzbDrone.Web/Scripts/NzbDrone/grid.js index c4974b190..e2611f486 100644 --- a/NzbDrone.Web/Scripts/NzbDrone/grid.js +++ b/NzbDrone.Web/Scripts/NzbDrone/grid.js @@ -70,23 +70,20 @@ $(function () { // Declare a function on the chat hub so the server can invoke it signalRProvider.updatedStatus = function (data) { - var imageSrc = '../../Content/Images/' + data.EpisodeStatus + '.png'; var row = $('[data-episode-id="' + data.EpisodeId + '"]'); if (row.length == 0) return; - var statusImage = $(row).find('img.statusImage'); + var statusElement = $(row).find('i.statusImage'); - if (statusImage.length == 0) + if (statusElement.length == 0) return; - statusImage.attr('alt', data.EpisodeStatus); - statusImage.attr('title', data.EpisodeStatus); - statusImage.attr('src', imageSrc); + statusElement.attr('data-status', data.EpisodeStatus); if (data.EpisodeStatus != "Missing") { - statusImage.parent('td').removeClass('episodeMissing'); + statusElement.parent('td').removeClass('episodeMissing'); } if (data.Quality != null) {