2011-08-03 07:26:39 +00:00
|
|
|
|
var notIgnoredImage = '../../Content/Images/notIgnored.png';
|
|
|
|
|
var ignoredImage = '../../Content/Images/ignored.png';
|
2011-08-23 03:52:08 +00:00
|
|
|
|
var notAiredImage = '../../Content/Images/NotAired.png';
|
|
|
|
|
var readyImage = '../../Content/Images/Ready.png';
|
|
|
|
|
var downloadingImage = '../../Content/Images/Downloading.png';
|
|
|
|
|
|
2011-08-04 01:45:45 +00:00
|
|
|
|
var seriesId = 0;
|
|
|
|
|
var saveSeasonIgnoreUrl = '../Series/SaveSeasonIgnore';
|
|
|
|
|
var saveEpisodeIgnoreUrl = '../Series/SaveEpisodeIgnore';
|
2011-08-03 07:26:39 +00:00
|
|
|
|
|
2011-08-22 00:48:37 +00:00
|
|
|
|
//Episode Ignore Functions
|
2011-08-03 07:26:39 +00:00
|
|
|
|
$(".ignoreEpisode").live("click", function () {
|
|
|
|
|
var toggle = $(this);
|
|
|
|
|
var ignored = toggle.hasClass('ignored');
|
|
|
|
|
|
|
|
|
|
if (ignored) {
|
|
|
|
|
toggle.removeClass('ignored');
|
|
|
|
|
toggle.attr('src', notIgnoredImage);
|
2012-02-04 07:36:52 +00:00
|
|
|
|
toggleCellColour(toggle, false);
|
2011-08-03 07:26:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
toggle.addClass('ignored');
|
|
|
|
|
toggle.attr('src', ignoredImage);
|
2012-02-04 07:36:52 +00:00
|
|
|
|
toggleCellColour(toggle, true);
|
2011-08-03 07:26:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-04 01:45:45 +00:00
|
|
|
|
var seasonNumber = 0;
|
2011-08-20 03:02:47 +00:00
|
|
|
|
|
2011-08-04 01:45:45 +00:00
|
|
|
|
//Flip the ignored to the new state (We want the new value moving forward)
|
|
|
|
|
ignored = !ignored;
|
|
|
|
|
|
2011-08-03 07:26:39 +00:00
|
|
|
|
if (toggle.hasClass('ignoredEpisodesMaster')) {
|
2011-08-20 03:02:47 +00:00
|
|
|
|
seasonNumber = toggle.attr('class').split(/\s+/)[2].replace('ignoreSeason_', '');
|
2011-08-03 07:26:39 +00:00
|
|
|
|
|
|
|
|
|
toggleChildren(seasonNumber, ignored);
|
2011-08-20 03:02:47 +00:00
|
|
|
|
toggleMasters(seasonNumber, ignored);
|
2011-08-04 01:45:45 +00:00
|
|
|
|
saveSeasonIgnore(seasonNumber, ignored);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
//Check to see if this is the last one ignored or the first not ignored
|
|
|
|
|
seasonNumber = toggle.attr('class').split(/\s+/)[1].replace('ignoreEpisode_', '');
|
|
|
|
|
var episodeId = toggle.attr('id');
|
|
|
|
|
toggleMaster(seasonNumber, ignored);
|
|
|
|
|
saveEpisodeIgnore(episodeId, ignored);
|
2011-08-03 07:26:39 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function toggleChildren(seasonNumber, ignored) {
|
|
|
|
|
var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber);
|
|
|
|
|
|
2011-08-04 01:45:45 +00:00
|
|
|
|
if (ignored) {
|
2011-08-03 07:26:39 +00:00
|
|
|
|
ignoreEpisodes.each(function (index) {
|
|
|
|
|
$(this).addClass('ignored');
|
|
|
|
|
$(this).attr('src', ignoredImage);
|
2012-02-04 07:36:52 +00:00
|
|
|
|
toggleCellColour($(this), true);
|
2011-08-03 07:26:39 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
ignoreEpisodes.each(function (index) {
|
|
|
|
|
$(this).removeClass('ignored');
|
|
|
|
|
$(this).attr('src', notIgnoredImage);
|
2012-02-04 07:36:52 +00:00
|
|
|
|
|
|
|
|
|
toggleCellColour($(this), false);
|
2011-08-03 07:26:39 +00:00
|
|
|
|
});
|
2011-08-04 01:45:45 +00:00
|
|
|
|
}
|
2011-08-03 07:26:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-04 01:45:45 +00:00
|
|
|
|
function toggleMaster(seasonNumber) {
|
2012-02-04 07:36:52 +00:00
|
|
|
|
//Toggles all master toggles when the childen changes
|
2011-08-23 03:52:08 +00:00
|
|
|
|
|
2011-08-04 01:45:45 +00:00
|
|
|
|
var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber);
|
|
|
|
|
var ignoredCount = ignoreEpisodes.filter('.ignored').length;
|
2011-08-20 03:02:47 +00:00
|
|
|
|
var masters = $('.ignoreSeason_' + seasonNumber);
|
|
|
|
|
|
|
|
|
|
masters.each(function (index) {
|
|
|
|
|
if (ignoreEpisodes.length == ignoredCount) {
|
|
|
|
|
$(this).attr('src', ignoredImage);
|
|
|
|
|
$(this).addClass('ignored');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
$(this).attr('src', notIgnoredImage);
|
|
|
|
|
$(this).removeClass('ignored');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function toggleMasters(seasonNumber, ignored) {
|
2011-08-23 03:52:08 +00:00
|
|
|
|
//Toggles the other master(s) to match the one that was just changed
|
2011-08-20 03:02:47 +00:00
|
|
|
|
var masters = $('.ignoreSeason_' + seasonNumber);
|
|
|
|
|
|
|
|
|
|
if (ignored) {
|
|
|
|
|
masters.each(function (index) {
|
|
|
|
|
$(this).addClass('ignored');
|
|
|
|
|
$(this).attr('src', ignoredImage);
|
|
|
|
|
});
|
2011-08-04 01:45:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
2011-08-20 03:02:47 +00:00
|
|
|
|
masters.each(function (index) {
|
|
|
|
|
$(this).removeClass('ignored');
|
|
|
|
|
$(this).attr('src', notIgnoredImage);
|
|
|
|
|
});
|
2011-08-04 01:45:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-04 07:36:52 +00:00
|
|
|
|
function toggleCellColour(toggle, ignored) {
|
2011-08-03 07:26:39 +00:00
|
|
|
|
if (ignored) {
|
2012-02-04 07:36:52 +00:00
|
|
|
|
toggle.parent('td').addClass('episodeIgnored');
|
|
|
|
|
toggle.parent('td').removeClass('episodeMissing');
|
2011-08-03 07:26:39 +00:00
|
|
|
|
}
|
2012-02-04 07:36:52 +00:00
|
|
|
|
|
2011-08-03 07:26:39 +00:00
|
|
|
|
else {
|
2012-02-04 07:36:52 +00:00
|
|
|
|
toggle.parent('td').removeClass('episodeIgnored');
|
2011-08-20 03:02:47 +00:00
|
|
|
|
|
2012-02-04 07:36:52 +00:00
|
|
|
|
//check to see if episode is missing
|
|
|
|
|
if (toggle.parent('td').children('.statusImage').hasClass('status-Missing'))
|
|
|
|
|
toggle.parent('td').addClass('episodeMissing');
|
|
|
|
|
}
|
2011-08-04 01:45:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-22 00:48:37 +00:00
|
|
|
|
//Episode Ignore Saving
|
2011-08-04 01:45:45 +00:00
|
|
|
|
function saveSeasonIgnore(seasonNumber, ignored) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: saveSeasonIgnoreUrl,
|
|
|
|
|
data: jQuery.param({ seriesId: seriesId, seasonNumber: seasonNumber, ignored: ignored }),
|
|
|
|
|
error: function (req, status, error) {
|
|
|
|
|
alert("Sorry! We could save the ignore settings for Series: " + seriesId + ", Season: " + seasonNumber + " at this time. " + error);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function saveEpisodeIgnore(episodeId, ignored) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: saveEpisodeIgnoreUrl,
|
|
|
|
|
data: jQuery.param({ episodeId: episodeId, ignored: ignored }),
|
|
|
|
|
error: function (req, status, error) {
|
|
|
|
|
alert("Sorry! We could save the ignore settings for Episode: " + episodeId + " at this time. " + error);
|
|
|
|
|
}
|
|
|
|
|
});
|
2012-02-04 20:08:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Click on row, show details */
|
|
|
|
|
$('.seriesTable tr').live('click', function() {
|
|
|
|
|
$(this).next('.detail-view').toggle();
|
|
|
|
|
});
|