diff --git a/.jshintrc b/.jshintrc index 7ec9ec8b693393d2ca5bffb94bdcc5e030309f43..d7a56347f30eba25d219bd053a83c8a6ab37b85b 100644 --- a/.jshintrc +++ b/.jshintrc @@ -28,6 +28,7 @@ "_": true, "bootbox": true, "PNotify": true, - "anonURL": true + "anonURL": true, + "window": true } } diff --git a/gui/slick/js/ajaxEpSearch.js b/gui/slick/js/ajaxEpSearch.js index ff66ca7c7916d12251b395946108eccbc4ab0ec2..5d5eea0f51db3d123554ead875e0e8db60fc95bf 100644 --- a/gui/slick/js/ajaxEpSearch.js +++ b/gui/slick/js/ajaxEpSearch.js @@ -213,7 +213,7 @@ $(document).ready(function () { } // applying the quality class var rSearchTerm = /(\w+)\s\((.+?)\)/; - htmlContent = data.result.replace(rSearchTerm,"$1"+' <span class="quality '+data.quality+'">'+"$2"+'</span>'); + htmlContent = data.result.replace(rSearchTerm,"$1"+' <span class="quality '+data.quality+'">'+"$2"+'</span>'); // update the status column if it exists parent.siblings('.col-status').html(htmlContent); // Only if the queuing was successful, disable the onClick event of the loading image diff --git a/gui/slick/js/blackwhite.js b/gui/slick/js/blackwhite.js index e8618899c95ebd24c0d385f35375e579231eb83a..82c51368715a39d2a6db0e6c67f361bab4461c83 100644 --- a/gui/slick/js/blackwhite.js +++ b/gui/slick/js/blackwhite.js @@ -1,24 +1,24 @@ function generate_bwlist() { var realvalues = []; - $('#white option').each(function(i, selected) { - realvalues[i] = $(selected).val(); - }); - $("#whitelist").val(realvalues.join(",")); + $('#white option').each(function(i, selected) { + realvalues[i] = $(selected).val(); + }); + $("#whitelist").val(realvalues.join(",")); - realvalues = []; - $('#black option').each(function(i, selected) { - realvalues[i] = $(selected).val(); - }); - $("#blacklist").val(realvalues.join(",")); + realvalues = []; + $('#black option').each(function(i, selected) { + realvalues[i] = $(selected).val(); + }); + $("#blacklist").val(realvalues.join(",")); } function update_bwlist(show_name) { - $('#pool').children().remove(); + $('#pool').children().remove(); - $('#blackwhitelist').show(); - if (show_name) { - $.getJSON(srRoot + '/home/fetch_releasegroups', {'show_name': show_name}, function (data) { + $('#blackwhitelist').show(); + if (show_name) { + $.getJSON(srRoot + '/home/fetch_releasegroups', {'show_name': show_name}, function (data) { if (data.result == 'success') { $.each(data.groups, function(i, group) { var option = $("<option>"); @@ -27,9 +27,9 @@ function update_bwlist(show_name) { option.appendTo('#pool'); }); } - }); - } + }); } +} $('#removeW').click(function() { !$('#white option:selected').remove().appendTo('#pool'); diff --git a/gui/slick/js/configProviders.js b/gui/slick/js/configProviders.js index e2a7a49ed83ad5aaceb102bef6a3b250c4bac9e8..da490f82544288ca55eb870a4b24a1ac401c202a 100644 --- a/gui/slick/js/configProviders.js +++ b/gui/slick/js/configProviders.js @@ -354,7 +354,7 @@ $(document).ready(function(){ var selectedProvider = $('#editANewznabProvider :selected').val(); if (selectedProvider === "addNewznab"){ - return; + return; } var url = $('#newznab_url').val(); @@ -371,7 +371,7 @@ $(document).ready(function(){ var selectedProvider = $('#editATorrentRssProvider :selected').val(); if (selectedProvider === "addTorrentRss"){ - return; + return; } var url = $('#torrentrss_url').val(); diff --git a/gui/slick/js/core.js b/gui/slick/js/core.js index 1fcbeae568427ab310002eb23a6e9d9f37aab25b..00263506c81f131a76e13aa332a7ed4d1e2308cd 100644 --- a/gui/slick/js/core.js +++ b/gui/slick/js/core.js @@ -1794,7 +1794,7 @@ var SICKRAGE = { }, manage: { init: function() { - $.makeRow = function(indexerId, season, episode, name, checked) { + $.makeEpisodeRow = function(indexerId, season, episode, name, checked) { var row = ''; row += ' <tr class="' + $('#row_class').val() + ' show-' + indexerId + '">'; row += ' <td class="tableleft" align="center"><input type="checkbox" class="' + indexerId + '-epcheck" name="' + indexerId + '-' + season + 'x' + episode + '"' + (checked ? ' checked' : '') + '></td>'; @@ -1804,6 +1804,25 @@ var SICKRAGE = { return row; }; + + $.makeSubtitleRow = function(indexerId, season, episode, name, subtitles, checked) { + var row = ''; + row += '<tr class="good show-' + indexerId + '">'; + row += '<td align="center"><input type="checkbox" class="' + indexerId + '-epcheck" name="' + indexerId + '-' + season + 'x' + episode + '"' + (checked ? ' checked' : '') + '></td>'; + row += '<td style="width: 1%;">' + season + 'x' + episode + '</td>'; + row += '<td>' + name + '</td>'; + row += '<td style="float: right;">'; + subtitles = subtitles.split(','); + for (var i in subtitles) { + if (subtitles.hasOwnProperty(i)) { + row += '<img src="/images/subtitles/flags/' + subtitles[i] + '.png" width="16" height="11" alt="' + subtitles[i] + '" /> '; + } + } + row += '</td>'; + row += '</tr>'; + + return row; + } }, index: function() { $("#massUpdateTable:has(tbody tr)").tablesorter({ @@ -1830,14 +1849,14 @@ var SICKRAGE = { 7: { sorter: 'archive_firstmatch'}, 8: { sorter: 'paused'}, 9: { sorter: 'subtitle'}, - 10: { sorter: 'default_ep_status'}, - 11: { sorter: 'status'}, - 12: { sorter: false}, - 13: { sorter: false}, - 14: { sorter: false}, - 15: { sorter: false}, - 16: { sorter: false}, - 17: { sorter: false} + 10: { sorter: 'default_ep_status'}, + 11: { sorter: 'status'}, + 12: { sorter: false}, + 13: { sorter: false}, + 14: { sorter: false}, + 15: { sorter: false}, + 16: { sorter: false}, + 17: { sorter: false} } }); }, @@ -1883,7 +1902,7 @@ var SICKRAGE = { $.each(data, function(season,eps){ $.each(eps, function(episode, name) { //alert(season+'x'+episode+': '+name); - lastRow.after($.makeRow(curIndexerId, season, episode, name, checked)); + lastRow.after($.makeEpisodeRow(curIndexerId, season, episode, name, checked)); }); }); }); @@ -1903,20 +1922,20 @@ var SICKRAGE = { // selects all visible episode checkboxes. $('.selectAllShows').click(function(){ $('.allCheck').each(function(){ - this.checked = true; + this.checked = true; }); $('input[class*="-epcheck"]').each(function(){ - this.checked = true; + this.checked = true; }); }); // clears all visible episode checkboxes and the season selectors $('.unselectAllShows').click(function(){ $('.allCheck').each(function(){ - this.checked = false; + this.checked = false; }); $('input[class*="-epcheck"]').each(function(){ - this.checked = false; + this.checked = false; }); }); }, @@ -1940,7 +1959,7 @@ var SICKRAGE = { }, function(data) { $.each(data, function(season, eps) { $.each(eps, function(episode, data) { - lastRow.after($.makeRow(indexerId, season, episode, data.name, data.subtitles, checked)); + lastRow.after($.makeEpisodeRow(indexerId, season, episode, data.name, data.subtitles, checked)); }); }); }); @@ -1960,20 +1979,20 @@ var SICKRAGE = { // selects all visible episode checkboxes. $('.selectAllShows').click(function(){ $('.allCheck').each(function(){ - this.checked = true; + this.checked = true; }); $('input[class*="-epcheck"]').each(function(){ - this.checked = true; + this.checked = true; }); }); // clears all visible episode checkboxes and the season selectors $('.unselectAllShows').click(function(){ $('.allCheck').each(function(){ - this.checked = false; + this.checked = false; }); $('input[class*="-epcheck"]').each(function(){ - this.checked = false; + this.checked = false; }); }); } diff --git a/gui/slick/js/failedDownloads.js b/gui/slick/js/failedDownloads.js index f599e41295952278058651f016dc04ea31bad2eb..15be420a1861542d648243d4724378cc4d07819e 100644 --- a/gui/slick/js/failedDownloads.js +++ b/gui/slick/js/failedDownloads.js @@ -37,8 +37,7 @@ $(document).ready(function(){ $(name+':visible').each(function() { switch (found) { case 2: return false; - case 1: - this.checked = lastCheck.checked; + case 1: this.checked = lastCheck.checked; } if (this === check || this === lastCheck) { found++; } diff --git a/gui/slick/js/manageEpisodeStatuses.js b/gui/slick/js/manageEpisodeStatuses.js deleted file mode 100644 index 74b148338d32cf28fd0317b39e5b3fc9955e6953..0000000000000000000000000000000000000000 --- a/gui/slick/js/manageEpisodeStatuses.js +++ /dev/null @@ -1,4 +0,0 @@ -$(document).ready(function() { - - -}); diff --git a/gui/slick/js/manageSubtitleMissed.js b/gui/slick/js/manageSubtitleMissed.js deleted file mode 100644 index 2f6d65c2b74364ddb304ebfe3ac94c45c58c2b9c..0000000000000000000000000000000000000000 --- a/gui/slick/js/manageSubtitleMissed.js +++ /dev/null @@ -1,72 +0,0 @@ -$(document).ready(function() { - - function makeRow(indexerId, season, episode, name, subtitles, checked) { - checked = checked ? ' checked' : ''; - - var row = ''; - row += ' <tr class="good show-' + indexerId + '">'; - row += ' <td align="center"><input type="checkbox" class="'+indexerId+'-epcheck" name="'+indexerId+'-'+season+'x'+episode+'"'+checked+'></td>'; - row += ' <td style="width: 1%;">'+season+'x'+episode+'</td>'; - row += ' <td>'+name+'</td>'; - row += ' </tr>'; - - return row; - } - - $('.allCheck').click(function(){ - var indexerId = $(this).attr('id').split('-')[1]; - $('.'+indexerId+'-epcheck').prop('checked', $(this).prop('checked')); - }); - - $('.get_more_eps').click(function(){ - var indexerId = $(this).attr('id'); - var checked = $('#allCheck-'+indexerId).prop('checked'); - var lastRow = $('tr#'+indexerId); - var clicked = $(this).attr('data-clicked'); - var action = $(this).attr('value'); - - if (!clicked) { - $.getJSON(srRoot + '/manage/showSubtitleMissed', { - indexer_id: indexerId, // jshint ignore:line - whichSubs: $('#selectSubLang').val() - }, function(data) { - $.each(data, function(season, eps) { - $.each(eps, function(episode, data) { - //alert(season+'x'+episode+': '+name); - lastRow.after(makeRow(indexerId, season, episode, data.name, data.subtitles, checked)); - }); - }); - }); - $(this).attr('data-clicked', 1); - $(this).prop('value', 'Collapse'); - } else { - if (action === 'Collapse') { - $('table tr').filter('.show-' + indexerId).hide(); - $(this).prop('value', 'Expand'); - } else if (action === 'Expand') { - $('table tr').filter('.show-' + indexerId).show(); - $(this).prop('value', 'Collapse'); - } - } - }); - - // selects all visible episode checkboxes. - $('.selectAllShows').click(function(){ - $('.allCheck').each(function(){ - this.checked = true; - }); - $('input[class*="-epcheck"]').each(function(){ - this.checked = true; - }); - }); - - // clears all visible episode checkboxes and the season selectors - $('.unselectAllShows').click(function(){ - $('.allCheck').each(function(){ - this.checked = false; - }); - $('input[class*="-epcheck"]').each(function(){ - this.checked = false; - }); - }); -}); diff --git a/gui/slick/js/massUpdate.js b/gui/slick/js/massUpdate.js index b539e1ef6d66f65cc6d77b6359badf075e799269..032c9256f367d4121c8bf4a389b5333ed7040b9b 100644 --- a/gui/slick/js/massUpdate.js +++ b/gui/slick/js/massUpdate.js @@ -74,7 +74,7 @@ $(document).ready(function(){ }); }); - ['.editCheck', '.updateCheck', '.refreshCheck', '.renameCheck', '.deleteCheck', '.removeCheck'].forEach(function(name) { + ['.editCheck', '.updateCheck', '.refreshCheck', '.renameCheck', '.deleteCheck', '.removeCheck'].forEach(function(name) { var lastCheck = null; $(name).on('click', function(event) { @@ -89,8 +89,7 @@ $(document).ready(function(){ $(name).each(function() { switch (found) { case 2: return false; - case 1: - if(!this.disabled) { this.checked = lastCheck.checked; } + case 1: if(!this.disabled) { this.checked = lastCheck.checked; } } if(this === check || this === lastCheck) { found++; } }); diff --git a/gui/slick/js/qualityChooser.js b/gui/slick/js/qualityChooser.js index 7242113d7aa3fdd11db73b9799d63321c9c03571..fe2880be8956acdeea6fc6cd00c6882bfea26bd9 100644 --- a/gui/slick/js/qualityChooser.js +++ b/gui/slick/js/qualityChooser.js @@ -7,8 +7,8 @@ $(document).ready(function() { $('#customQuality').hide(); } - $('#anyQualities option').each(function(i) { - var result = preset & $(this).val(); // I have no clue what the & does here + $('#anyQualities option').each(function() { + var result = preset & $(this).val(); // @TODO Find out what this does if (result > 0) { $(this).attr('selected', 'selected'); } else { @@ -16,8 +16,8 @@ $(document).ready(function() { } }); - $('#bestQualities option').each(function(i) { - var result = preset & ($(this).val() << 16); // I have no clue what the & does here + $('#bestQualities option').each(function() { + var result = preset & ($(this).val() << 16); // @TODO Find out what this does if (result > 0) { $(this).attr('selected', 'selected'); } else { diff --git a/gui/slick/js/restart.js b/gui/slick/js/restart.js index f51c67b86a5d42a140cb015e800b9ba8c32d1df3..645e5019f2ede8b75b25b3bcc2c9e27e183e70d0 100644 --- a/gui/slick/js/restart.js +++ b/gui/slick/js/restart.js @@ -49,13 +49,13 @@ $(document).ready(function() { }); } - function ajaxError(x, e) { + function ajaxError(x) { if (console_debug) { // jshint ignore:line if (x.status === 0) { console.log(console_prefix + 'isAlive: Sickrage is not responding.'); - } else if (x.status == 404) { + } else if (x.status === 404) { console.log(console_prefix + 'isAlive: Requested URL not found.'); - } else if (x.status == 500) { + } else if (x.status === 500) { console.log(console_prefix + 'isAlive: Internel Server Error.'); } else { console.log(console_prefix + 'isAlive: Unknow Error.\n' + x.responseText);