2012-02-05 20:17:23 +00:00
|
|
|
|
/* Click on row, show details */
|
2012-02-26 08:36:47 +00:00
|
|
|
|
$(document).on('click', '.seriesTable a, .dataTable a', function (event) {
|
2012-02-26 18:53:00 +00:00
|
|
|
|
if ($(this).attr('data-ajax') === "true" || $(this).attr('onclick'))
|
2012-02-07 06:47:02 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2012-02-06 07:47:10 +00:00
|
|
|
|
event.preventDefault();
|
2012-02-05 20:17:23 +00:00
|
|
|
|
var link = $(this).attr('href');
|
2012-05-02 22:42:21 +00:00
|
|
|
|
|
|
|
|
|
if ($(this).attr('target') === '_blank')
|
|
|
|
|
window.open(link);
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
window.location = link;
|
|
|
|
|
|
2012-02-06 07:47:10 +00:00
|
|
|
|
event.stopPropegation();
|
2012-02-05 20:17:23 +00:00
|
|
|
|
});
|
|
|
|
|
|
2012-02-06 22:13:33 +00:00
|
|
|
|
$('.seriesTable .data-row td:not(:last-child)').live('click', function () {
|
2012-02-10 05:26:30 +00:00
|
|
|
|
if ($(this).closest('table').hasClass('no-details'))
|
|
|
|
|
return;
|
2012-02-06 22:13:33 +00:00
|
|
|
|
$(this).parent('tr').next('.detail-row').toggle();
|
2012-02-05 20:17:23 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function grid_onError(e) {
|
2012-01-30 01:38:44 +00:00
|
|
|
|
//Suppress the alert
|
|
|
|
|
e.preventDefault();
|
2012-01-30 06:14:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-02-08 08:17:40 +00:00
|
|
|
|
//Perform the details opening
|
|
|
|
|
var oTable;
|
2012-01-30 06:14:46 +00:00
|
|
|
|
|
2012-02-08 08:17:40 +00:00
|
|
|
|
$('.dataTable td:not(:last-child)').live('click', function () {
|
2012-02-10 05:26:30 +00:00
|
|
|
|
if ($(this).closest('table').hasClass('no-details'))
|
|
|
|
|
return;
|
|
|
|
|
|
2012-02-08 08:17:40 +00:00
|
|
|
|
var nTr = this.parentNode;
|
2012-01-30 06:14:46 +00:00
|
|
|
|
|
2012-02-08 08:17:40 +00:00
|
|
|
|
if ($(nTr).hasClass('details-opened')) {
|
|
|
|
|
oTable.fnClose(nTr);
|
|
|
|
|
$(nTr).removeClass('details-opened');
|
2012-01-30 06:14:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-02-08 08:17:40 +00:00
|
|
|
|
else {
|
2012-02-09 00:26:34 +00:00
|
|
|
|
oTable.fnOpen(nTr, fnFormatDetails(nTr), 'Details');
|
2012-02-08 08:17:40 +00:00
|
|
|
|
$(nTr).addClass('details-opened');
|
2012-01-30 06:14:46 +00:00
|
|
|
|
}
|
2012-02-08 08:17:40 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//Datatables format display details
|
2012-02-09 00:26:34 +00:00
|
|
|
|
function fnFormatDetails(nTr) {
|
2012-02-08 08:17:40 +00:00
|
|
|
|
var aData = oTable.fnGetData(nTr);
|
2012-02-09 00:26:34 +00:00
|
|
|
|
return aData["Details"];
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-11 05:00:22 +00:00
|
|
|
|
//Reload/Redraw the grid from the server (bServerSide == true)
|
|
|
|
|
function redrawGrid() {
|
|
|
|
|
oTable.fnDraw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Force reload using Ajax Binding (bServerSide == false)
|
|
|
|
|
function reloadGrid() {
|
|
|
|
|
oTable.fnReloadAjax();
|
2012-02-12 09:52:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//SignalR
|
|
|
|
|
$(function () {
|
|
|
|
|
// Proxy created on the fly
|
|
|
|
|
var signalRProvider = $.connection.signalRProvider;
|
|
|
|
|
|
|
|
|
|
// Declare a function on the chat hub so the server can invoke it
|
2012-02-28 05:52:03 +00:00
|
|
|
|
signalRProvider.updatedStatus = function (data) {
|
|
|
|
|
var imageSrc = '../../Content/Images/' + data.EpisodeStatus + '.png';
|
2012-09-30 22:39:08 +00:00
|
|
|
|
var row = $('[data-episode-id="' + data.EpisodeId + '"]');
|
2012-02-12 09:52:51 +00:00
|
|
|
|
|
|
|
|
|
if (row.length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var statusImage = $(row).find('img.statusImage');
|
|
|
|
|
|
|
|
|
|
if (statusImage.length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2012-02-28 05:52:03 +00:00
|
|
|
|
statusImage.attr('alt', data.EpisodeStatus);
|
|
|
|
|
statusImage.attr('title', data.EpisodeStatus);
|
2012-02-12 09:52:51 +00:00
|
|
|
|
statusImage.attr('src', imageSrc);
|
|
|
|
|
|
2012-02-28 05:52:03 +00:00
|
|
|
|
if (data.EpisodeStatus != "Missing") {
|
2012-02-12 09:52:51 +00:00
|
|
|
|
statusImage.parent('td').removeClass('episodeMissing');
|
|
|
|
|
}
|
2012-02-28 05:52:03 +00:00
|
|
|
|
|
|
|
|
|
if (data.Quality != null) {
|
|
|
|
|
var qualityColumn = $(row).find('.episodeQuality');
|
|
|
|
|
|
|
|
|
|
if (qualityColumn)
|
|
|
|
|
qualityColumn.text(data.Quality);
|
|
|
|
|
}
|
2012-02-12 09:52:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Start the connection
|
2012-04-22 18:53:00 +00:00
|
|
|
|
$.connection.hub.start({ transport: 'longPolling' });
|
2012-02-12 09:52:51 +00:00
|
|
|
|
});
|