/** @namespace $.SickGear.Root */
/** @namespace config.showLang */
/** @namespace config.showIsAnime */
/*globals $, config, sbRoot, generate_bwlist*/
$(document).ready(function () {
$('#location').fileBrowser({title: 'Select Show Location'});
function htmlFlag(lang) {
return ' class="flag" style="background-image:url(' + $.SickGear.Root + '/images/flags/' + lang + '.png)"'
}
$.getJSON($.SickGear.Root + '/home/addShows/getIndexerLanguages', {}, function (data) {
var result = '', currentLangAdded = '', selected = ' selected="selected"';
if (!data.results.length) {
result = '';
} else {
currentLangAdded = !1;
$.each(data.results, function (index, strLang) {
var htmlSelected = '';
if (strLang === config.showLang) {
currentLangAdded = !0;
htmlSelected = selected;
}
result += '';
});
if (!currentLangAdded)
result += '';
}
$('#indexerLangSelectEdit').html(result);
});
function getExceptions() {
var allExceptions = [];
$('#exceptions_list').find('option').each(function () {
allExceptions.push($(this).val());
});
return allExceptions
}
$('#submit').on('click', function () {
$('#exceptions_list').val(getExceptions());
if (config.showIsAnime)
generate_bwlist();
});
$('#addSceneName').on('click', function () {
var elSceneName = $('#SceneName'), elSceneNameSeason = $('#SceneNameSeason'),
sceneEx = elSceneName.val(), sceneExSeason = elSceneNameSeason.val();
elSceneName.val('');
elSceneNameSeason.val('');
if (-1 < $.inArray(sceneExSeason + '|' + sceneEx, getExceptions()) || ('' === sceneEx))
return;
$('#SceneException').fadeIn('fast', 'linear');
var option = $('