SickGear/gui/slick/js/manageEpisodeStatuses.js
JackDandy 22ce0203cf Add quality tag to archived items, improve displayShow/"Change selected episodes to".
Use to prevent "Update to" on those select episodes while preserving the downloaded quality.
Change group "Downloaded" status qualities into one section.
Add "Downloaded/with archived quality" to set shows as downloaded using quality of archived status.
Add "Archived with/downloaded quality" to set shows as archived using quality of downloaded status.
Add "Archived with/default (min. initial quality of show here)".
Change when settings/Post Processing/File Handling/Status of removed episodes/Set Archived is enabled, set status and quality accordingly.
Add downloaded and archived statuses to Manage/Episode Status.
Add quality pills to Manage/Episode Status.
Change Manage/Episode Status season output format to be more readable.
Change add SNATCHED_ANY and ARCHIVED, refactor accordingly.
2017-12-04 19:27:50 +00:00

95 lines
3.3 KiB
JavaScript

$(document).ready(function() {
function make_row(indexer_id, season, episode, name, checked, airdate_never, qualityCss, qualityStr, sxe) {
var checkedbox = (checked ? ' checked' : ''),
row_class = $('#row_class').val(),
ep_id = season + 'x' + episode;
return ' <tr id="ep-' + indexer_id + '-' + ep_id + '" class="' + (airdate_never ? 'airdate-never' : row_class) + '">'
+ ' <td class="tableleft" align="center">'
+ '<input type="checkbox"'
+ ' class="' + indexer_id + '-epcheck"'
+ ' name="' + indexer_id + '-' + ep_id + '"'
+ checkedbox+'></td>'
+ ' <td class="text-nowrap">' + sxe + '</td>'
+ ' <td class="tableright" style="width: 100%">'
+ ' <span class="quality show-quality ' + qualityCss + ' text-nowrap">' + qualityStr + '</span>'
+ name + (airdate_never ? ' (<strong><em>airdate is never, this should change in time</em></strong>)' : '') + '</td>'
+ ' </tr>';
}
$('.go').click(function() {
if ($('input[class*="-epcheck"]:checked').length === 0 && $('input[id*="allCheck-"]:checked').length === 0) {
alert('Please select at least one Show or Episode');
return false
}
});
$('.allCheck').click(function(){
var indexer_id = $(this).attr('id').split('-')[1];
$('.' + indexer_id + '-epcheck').prop('checked', $(this).prop('checked'));
});
$('.get_more_eps').show();
function show_episodes(btn_element) {
var match = btn_element.attr('id').match(/(.*)[-](.*)/);
if (null == match)
return false;
var cur_indexer_id = match[1], action = match[2], checked = $('#allCheck-' + cur_indexer_id).prop('checked'),
show_header = $('tr#' + cur_indexer_id), episode_rows = $('tr[id*="ep-' + cur_indexer_id + '"]'),
void_var = 'more' == action && episode_rows.show() || episode_rows.hide();
$('input#' + match[0]).val('more' == action ? 'Expanding...' : 'Collapsing...');
if (0 == episode_rows.length) {
$.getJSON(sbRoot + '/manage/showEpisodeStatuses',
{
indexer_id: cur_indexer_id,
whichStatus: $('#oldStatus').val()
},
function (data) {
$.each(data, function(season, eps){
$.each(eps, function(episode, meta) {
show_header.after(make_row(cur_indexer_id, season, episode, meta.name, checked, meta.airdate_never, meta.qualityCss, meta.qualityStr, meta.sxe));
});
});
$('input#' + match[0]).val('more' == action ? 'Expand' : 'Collapse');
btn_element.hide();
$('input[id="' + cur_indexer_id + '-' + ('more' == action ? 'less' : 'more') + '"]').show();
});
} else {
$('input#' + match[0]).val('more' == action ? 'Expand' : 'Collapse');
btn_element.hide();
$('input[id="' + cur_indexer_id + '-' + ('more' == action ? 'less' : 'more') + '"]').show();
}
}
$('.get_more_eps,.get_less_eps').click(function(){
show_episodes($(this));
($('.get_more_eps:visible').length == 0 ? $('.expandAll').hide() : '');
});
$('.expandAll').click(function() {
$(this).hide();
$('.get_more_eps').each(function() {
show_episodes($(this));
});
});
// selects all visible episode checkboxes.
$('.selectAllShows').click(function(){
$('.sickbeardTable input').each(function() {
this.checked = true;
});
});
// clears all visible episode checkboxes and the season selectors
$('.unselectAllShows').click(function(){
$('.sickbeardTable input').each(function() {
this.checked = false;
});
});
});