2017-08-27 16:33:32 +00:00
|
|
|
/** @namespace config.sortArticle */
|
|
|
|
/** @namespace config.resultsSortby */
|
2014-03-10 05:18:05 +00:00
|
|
|
$(document).ready(function () {
|
|
|
|
|
2015-02-16 03:17:56 +00:00
|
|
|
function populateLangSelect() {
|
2014-11-20 22:25:33 +00:00
|
|
|
if (!$('#nameToSearch').length)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (1 >= $('#indexerLangSelect').find('option').length) {
|
|
|
|
|
|
|
|
$.getJSON(sbRoot + '/home/addShows/getIndexerLanguages', {}, function (data) {
|
|
|
|
|
|
|
|
var resultStr = '',
|
|
|
|
selected = ' selected="selected"',
|
|
|
|
elIndexerLang = $('#indexerLangSelect');
|
|
|
|
|
|
|
|
if (0 === data.results.length) {
|
|
|
|
resultStr = '<option value="en"' + selected + '>en</option>';
|
|
|
|
} else {
|
|
|
|
$.each(data.results, function (index, obj) {
|
|
|
|
resultStr += '<option value="' + obj + '"'
|
|
|
|
+ ('' == resultStr ? selected : '')
|
|
|
|
+ '>' + obj + '</option>';
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
elIndexerLang.html(resultStr);
|
|
|
|
elIndexerLang.change(function () {
|
|
|
|
searchIndexers();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-16 03:17:56 +00:00
|
|
|
function cleanseText(text, toDisplay) {
|
|
|
|
return (!0 == toDisplay
|
|
|
|
? text
|
|
|
|
.replace(/["]/g, '"')
|
|
|
|
: text
|
|
|
|
.replace(/(?:["]|")/g, '')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-11-20 22:25:33 +00:00
|
|
|
var searchRequestXhr = null;
|
|
|
|
|
|
|
|
function searchIndexers() {
|
|
|
|
var elNameToSearch = $('#nameToSearch');
|
|
|
|
|
|
|
|
if (!elNameToSearch.val().length)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (searchRequestXhr)
|
|
|
|
searchRequestXhr.abort();
|
|
|
|
|
|
|
|
var elTvDatabase = $('#providedIndexer'),
|
2017-08-16 19:15:19 +00:00
|
|
|
elIndexerLang = $('#indexerLangSelect'),
|
|
|
|
tvsrcName = elTvDatabase.find('option:selected').text(),
|
|
|
|
tvSearchSrc = 0 < tvsrcName.length ? ' on ' + tvsrcName : '';
|
2014-11-20 22:25:33 +00:00
|
|
|
|
2015-02-16 03:17:56 +00:00
|
|
|
$('#searchResults').empty().html('<img id="searchingAnim" src="' + sbRoot + '/images/loading32' + themeSpinner + '.gif" height="32" width="32" />'
|
|
|
|
+ ' searching <span class="boldest">' + cleanseText(elNameToSearch.val(), !0) + '</span>'
|
2017-08-16 19:15:19 +00:00
|
|
|
+ tvSearchSrc + ' in ' + elIndexerLang.val()
|
2015-02-16 03:17:56 +00:00
|
|
|
+ '...');
|
2014-11-20 22:25:33 +00:00
|
|
|
|
|
|
|
searchRequestXhr = $.ajax({
|
|
|
|
url: sbRoot + '/home/addShows/searchIndexersForShowName',
|
|
|
|
data: {
|
2015-02-16 03:17:56 +00:00
|
|
|
'search_term': cleanseText(elNameToSearch.val(), !1),
|
2014-11-20 22:25:33 +00:00
|
|
|
'lang': elIndexerLang.val(),
|
|
|
|
'indexer': elTvDatabase.val()
|
|
|
|
},
|
2016-11-01 15:34:18 +00:00
|
|
|
timeout: parseInt($('#indexer_timeout').val(), 10) * parseInt($('#indexer_count').val(), 2) * 1000 + 15000,
|
2014-11-20 22:25:33 +00:00
|
|
|
dataType: 'json',
|
|
|
|
error: function () {
|
|
|
|
$('#searchResults').empty().html('search timed out, try again or try another database');
|
|
|
|
},
|
|
|
|
success: function (data) {
|
2017-08-27 16:33:32 +00:00
|
|
|
var resultStr = '', attrs = '', checked = !1, rowType, row = 0, srcState = '';
|
2014-11-20 22:25:33 +00:00
|
|
|
|
|
|
|
if (0 === data.results.length) {
|
|
|
|
resultStr += '<span class="boldest">Sorry, no results found. Try a different search.</span>';
|
|
|
|
} else {
|
2017-08-27 16:33:32 +00:00
|
|
|
var result = {
|
|
|
|
SrcName: 0, isInDB: 1, SrcId: 2, SrcDBId: 3, SrcUrl: 4, ShowID: 5, Title: 6, TitleHtml: 7,
|
|
|
|
Aired: 8, Network: 9, Genre: 10, Overview: 11, RelSort: 12, DateSort: 13, AzSort: 14, ImgUrl: 15
|
|
|
|
};
|
|
|
|
$.each(data.results, function (index, item) {
|
|
|
|
attrs = (!0 === item[result.isInDB] ? ' disabled="disabled"' : (!0 === checked ? '' : ' checked'));
|
|
|
|
checked = (' checked' === attrs) ? !0 : checked;
|
|
|
|
rowType = (0 == row % 2 ? '' : ' alt');
|
2014-11-20 22:25:33 +00:00
|
|
|
row++;
|
|
|
|
|
2017-08-27 16:33:32 +00:00
|
|
|
var displayShowName = cleanseText(item[result.Title], !0), showstartdate = '';
|
2014-11-20 22:25:33 +00:00
|
|
|
|
2017-08-27 16:33:32 +00:00
|
|
|
if (null !== item[result.Aired]) {
|
|
|
|
var startDate = new Date(item[result.Aired]);
|
2014-11-20 22:25:33 +00:00
|
|
|
var today = new Date();
|
|
|
|
showstartdate = ' <span class="stepone-result-date">('
|
|
|
|
+ (startDate > today ? 'will debut' : 'started')
|
2017-08-27 16:33:32 +00:00
|
|
|
+ ': ' + item[result.Aired] + ')</span>';
|
2014-11-20 22:25:33 +00:00
|
|
|
}
|
2017-08-27 16:33:32 +00:00
|
|
|
|
|
|
|
srcState = [
|
|
|
|
null === item[result.SrcName] ? '' : item[result.SrcName],
|
|
|
|
!1 === item[result.isInDB] ? '' : '<span class="exists-db">exists in db</span>']
|
|
|
|
.join(' - ').replace(/(^[\s-]+|[\s-]+$)/, '');
|
|
|
|
resultStr += '<div class="results-item' + rowType + '" data-indb="' + (!1 === item[result.isInDB] ? '' : '1') + '" data-sort-rel="' + item[result.RelSort] + '" data-sort-date="' + item[result.DateSort] + '" data-sort-az="' + item[result.AzSort] + '">'
|
2014-11-20 22:25:33 +00:00
|
|
|
+ '<input id="whichSeries" type="radio"'
|
|
|
|
+ ' class="stepone-result-radio"'
|
2017-08-27 16:33:32 +00:00
|
|
|
+ (!1 === item[result.isInDB]
|
|
|
|
? ' title="Add show <span style=\'color: rgb(66, 139, 202)\'>' + displayShowName + '</span>"'
|
|
|
|
: ' title="Show exists in DB,<br><span style=\'font-weight:700\'>selection not possible</span>"')
|
2014-11-20 22:25:33 +00:00
|
|
|
+ ' name="whichSeries"'
|
2017-08-27 16:33:32 +00:00
|
|
|
+ ' value="' + cleanseText([item[result.SrcDBId], item[result.SrcName], item[result.ShowID], item[result.Title]].join('|'), !0) + '"'
|
|
|
|
+ attrs
|
2014-11-20 22:25:33 +00:00
|
|
|
+ ' />'
|
|
|
|
+ '<a'
|
|
|
|
+ ' class="stepone-result-title"'
|
2017-08-27 16:33:32 +00:00
|
|
|
+ ' title="<div style=\'color: rgb(66, 139, 202)\'>' + cleanseText(item[result.TitleHtml], !0) + '</div>'
|
|
|
|
+ (0 < item[result.Genre].length ? '<div style=\'font-weight:bold\'>(<em>' + item[result.Genre] + '</em>)</div>' : '')
|
|
|
|
+ (0 < item[result.Network].length ? '<div style=\'font-weight:bold;font-size:0.9em;color:#888\'><em>' + item[result.Network] + '</em></div>' : '')
|
|
|
|
+ '<img style=\'max-height:150px;float:right;margin-left:3px\' src=\'/' + item[result.ImgUrl] + '\'>'
|
|
|
|
+ (0 < item[result.Overview].length ? '<p style=\'margin:0 0 2px\'>' + item[result.Overview] + '</p>' : '')
|
|
|
|
+ '<span style=\'float:right;clear:both\'>Click for more</span>'
|
2016-06-30 19:15:09 +00:00
|
|
|
+ '"'
|
2017-08-27 16:33:32 +00:00
|
|
|
+ ' href="' + anonURL + item[result.SrcUrl] + item[result.ShowID] + ((data.langid && '' != data.langid) ? '&lid=' + data.langid : '') + '"'
|
2017-08-16 19:15:19 +00:00
|
|
|
+ ' onclick="window.open(this.href, \'_blank\'); return !1;"'
|
2017-08-27 16:33:32 +00:00
|
|
|
+ '>' + (config.sortArticle ? displayShowName : displayShowName.replace(/^((?:A(?!\s+to)n?)|The)(\s)+(.*)/i, '$3$2<span class="article">($1)</span>')) + '</a>'
|
2014-11-20 22:25:33 +00:00
|
|
|
+ showstartdate
|
2017-08-27 16:33:32 +00:00
|
|
|
+ ('' === srcState ? ''
|
|
|
|
: ' <span class="stepone-result-db grey-text">' + '[' + srcState + ']' + '</span>')
|
2014-11-20 22:25:33 +00:00
|
|
|
+ '</div>' + "\n";
|
2017-08-27 16:33:32 +00:00
|
|
|
|
2014-11-20 22:25:33 +00:00
|
|
|
});
|
|
|
|
}
|
2017-08-27 16:33:32 +00:00
|
|
|
var selAttr = 'selected="selected" ',
|
|
|
|
selClass = 'selected-text',
|
|
|
|
classAttrSel = 'class="' + selClass + '" ',
|
|
|
|
defSortby = /^az/.test(config.resultsSortby) || /^date/.test(config.resultsSortby) ? '': classAttrSel + selAttr;
|
|
|
|
|
2014-11-20 22:25:33 +00:00
|
|
|
$('#searchResults').html(
|
|
|
|
'<fieldset>' + "\n" + '<legend class="legendStep" style="margin-bottom: 15px">'
|
|
|
|
+ (0 < row ? row : 'No')
|
2017-08-27 16:33:32 +00:00
|
|
|
+ ' search result' + (1 == row ? '' : 's') + '...'
|
|
|
|
+ '<span style="float:right;height:32px;line-height:1">'
|
|
|
|
+ '<select id="results-sortby" class="form-control form-control-inline input-sm">'
|
|
|
|
+ '<optgroup label="Sort by">'
|
|
|
|
+ '<option ' + (/^az/.test(config.resultsSortby) ? classAttrSel + selAttr : '') + 'value="az">A to Z</option>'
|
|
|
|
+ '<option ' + (/^date/.test(config.resultsSortby) ? classAttrSel + selAttr : '') + 'value="date">First aired</option>'
|
|
|
|
+ '<option ' + defSortby + 'value="rel">Relevancy</option>'
|
|
|
|
+ '</optgroup><optgroup label="With...">'
|
|
|
|
+ '<option ' + (!/notop$/.test(config.resultsSortby) ? classAttrSel : '') + 'value="ontop">Exists on top</option>'
|
|
|
|
+ '<option ' + (/notop$/.test(config.resultsSortby) ? classAttrSel : '') + 'value="notop">Exists in mix</option>'
|
|
|
|
+ '</optgroup></select></span>'
|
|
|
|
+ '</legend>' + "\n"
|
|
|
|
+ '<div id="holder">'
|
2014-11-20 22:25:33 +00:00
|
|
|
+ resultStr
|
2017-08-27 16:33:32 +00:00
|
|
|
+ '</div>'
|
2014-11-20 22:25:33 +00:00
|
|
|
+ '</fieldset>'
|
|
|
|
);
|
2017-08-27 16:33:32 +00:00
|
|
|
|
|
|
|
var container$ = $('#holder'),
|
|
|
|
sortbySelect$ = $('#results-sortby'),
|
|
|
|
reOrder = (function(value){
|
|
|
|
return ($('#results-sortby').find('option[value$="notop"]').hasClass(selClass)
|
|
|
|
? (1000 > value ? value + 1000 : value)
|
|
|
|
: (1000 > value ? value : value - 1000))}),
|
|
|
|
getData = (function(itemElem, sortby){
|
|
|
|
var position = parseInt($(itemElem).attr('data-sort-' + sortby));
|
|
|
|
return (!$(itemElem).attr('data-indb')) ? position : reOrder(position);
|
|
|
|
});
|
|
|
|
|
|
|
|
sortbySelect$.find('.' + selClass).each(function(){
|
|
|
|
$(this).html('> ' + $(this).html());
|
|
|
|
});
|
|
|
|
|
|
|
|
container$.isotope({
|
|
|
|
itemSelector: '.results-item',
|
|
|
|
sortBy: sortbySelect$.find('option:not([value$="top"]).' + selClass).val(),
|
|
|
|
layoutMode: 'masonry',
|
|
|
|
getSortData: {
|
|
|
|
az: function(itemElem){ return getData(itemElem, 'az'); },
|
|
|
|
date: function(itemElem){ return getData(itemElem, 'date'); },
|
|
|
|
rel: function(itemElem){ return getData(itemElem, 'rel'); }
|
|
|
|
}
|
|
|
|
}).on('arrangeComplete', function(event, items){
|
|
|
|
$(items).each(function(i, item){
|
|
|
|
if (1 === i % 2){
|
|
|
|
$(item.element).addClass('alt');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
sortbySelect$.on('change', function(){
|
|
|
|
var selectedSort = String($(this).val()), sortby = selectedSort, curSortby$, curSel$, newSel$;
|
|
|
|
|
|
|
|
curSortby$ = $(this).find('option:not([value$="top"])');
|
|
|
|
if (/top$/.test(selectedSort)){
|
|
|
|
sortby = curSortby$.filter('.' + selClass).val();
|
|
|
|
curSortby$ = $(this).find('option[value$="top"]');
|
|
|
|
}
|
|
|
|
curSel$ = curSortby$.filter('.' + selClass);
|
|
|
|
curSel$.html(curSel$.html().replace(/(?:>|>)\s/ , '')).removeClass(selClass);
|
|
|
|
|
|
|
|
newSel$ = $(this).find('option[value$="' + selectedSort + '"]');
|
|
|
|
newSel$.html('> ' + newSel$.html()).addClass(selClass);
|
|
|
|
|
|
|
|
$('.results-item[data-indb="1"]').each(function(){
|
|
|
|
$(this).attr(sortby, reOrder(parseInt($(this).attr(sortby), 10)));
|
|
|
|
});
|
|
|
|
$('.results-item').removeClass('alt');
|
|
|
|
container$.isotope('updateSortData').isotope({sortBy: sortby});
|
|
|
|
|
|
|
|
config.resultsSortby = sortby + ($(this).find('option[value$="notop"]').hasClass(selClass) ? ' notop' : '');
|
|
|
|
$.get(sbRoot + '/config/general/saveResultPrefs', {ui_results_sortby: selectedSort});
|
|
|
|
});
|
|
|
|
|
2014-11-20 22:25:33 +00:00
|
|
|
updateSampleText();
|
|
|
|
myform.loadsection(0);
|
|
|
|
$('.stepone-result-radio, .stepone-result-title').each(addQTip);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
var elNameToSearch = $('#nameToSearch'),
|
|
|
|
elSearchName = $('#searchName');
|
|
|
|
|
|
|
|
elSearchName.click(function () { searchIndexers(); });
|
|
|
|
|
|
|
|
if (elNameToSearch.length && elNameToSearch.val().length) {
|
|
|
|
elSearchName.click();
|
|
|
|
}
|
|
|
|
|
2017-08-16 19:15:19 +00:00
|
|
|
$('#addShowButton, #cancelShowButton').click(function () {
|
|
|
|
if (/cancel/.test(this.id)){
|
|
|
|
$('input[name=cancel_form]').val('1');
|
|
|
|
} else {
|
|
|
|
// if they haven't picked a show don't let them submit
|
|
|
|
if (!$('input:radio[name="whichSeries"]:checked').val()
|
|
|
|
&& !$('input:hidden[name="whichSeries"]').val().length) {
|
|
|
|
alert('You must choose a show to continue');
|
|
|
|
return !1;
|
|
|
|
}
|
|
|
|
generate_bwlist();
|
2014-11-20 22:25:33 +00:00
|
|
|
}
|
|
|
|
$('#addShowForm').submit();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#skipShowButton').click(function () {
|
|
|
|
$('#skipShow').val('1');
|
|
|
|
$('#addShowForm').submit();
|
|
|
|
});
|
|
|
|
|
2018-01-29 02:26:23 +00:00
|
|
|
$('#quality-preset').change(function () {
|
2014-11-20 22:25:33 +00:00
|
|
|
myform.loadsection(2);
|
|
|
|
});
|
|
|
|
|
|
|
|
/***********************************************
|
|
|
|
* jQuery Form to Form Wizard- (c) Dynamic Drive (www.dynamicdrive.com)
|
|
|
|
* This notice MUST stay intact for legal use
|
|
|
|
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
|
|
|
|
***********************************************/
|
|
|
|
|
|
|
|
var myform = new FormToWizard({
|
|
|
|
fieldsetborderwidth: 0,
|
|
|
|
formid: 'addShowForm',
|
|
|
|
revealfx: ['slide', 500],
|
|
|
|
oninit: function () {
|
2015-02-16 03:17:56 +00:00
|
|
|
populateLangSelect();
|
2014-11-20 22:25:33 +00:00
|
|
|
updateSampleText();
|
|
|
|
if ($('input:hidden[name="whichSeries"]').length && $('#fullShowPath').length) {
|
|
|
|
goToStep(3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
function goToStep(num) {
|
|
|
|
$('.step').each(function () {
|
|
|
|
if ($.data(this, 'section') + 1 == num) {
|
|
|
|
$(this).click();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
elNameToSearch.focus();
|
|
|
|
|
|
|
|
function updateSampleText() {
|
2017-08-16 19:15:19 +00:00
|
|
|
if (0 === $('#displayText').length) {
|
|
|
|
$('#cancelShowButton').attr('disabled', !1);
|
|
|
|
$('#addShowButton').attr('disabled', 0 === $('#holder').find('.results-item').length);
|
|
|
|
return;
|
|
|
|
}
|
2014-11-20 22:25:33 +00:00
|
|
|
// if something's selected then we have some behavior to figure out
|
|
|
|
|
2015-08-14 23:02:05 +00:00
|
|
|
var show_name = '',
|
2014-11-20 22:25:33 +00:00
|
|
|
sep_char,
|
|
|
|
elRadio = $('input:radio[name="whichSeries"]:checked'),
|
|
|
|
elInput = $('input:hidden[name="whichSeries"]'),
|
2015-08-14 23:02:05 +00:00
|
|
|
elScene = $('#scene'),
|
2014-11-20 22:25:33 +00:00
|
|
|
elRootDirs = $('#rootDirs'),
|
2015-09-24 18:19:44 +00:00
|
|
|
elFullShowPath = $('#fullShowPath'),
|
|
|
|
idxWhichShowID = 2, idxWhichTitle = 3;
|
2014-11-20 22:25:33 +00:00
|
|
|
|
|
|
|
// if they've picked a radio button then use that
|
|
|
|
if (elRadio.length) {
|
2015-09-24 18:19:44 +00:00
|
|
|
show_name = elRadio.val().split('|')[idxWhichTitle];
|
|
|
|
elScene[0].checked = 0 <= show_scene_maps.indexOf(parseInt(elRadio.val().split('|')[idxWhichShowID], 10));
|
2015-08-14 23:02:05 +00:00
|
|
|
$('#scene-maps-found').css('display', elScene.is(':checked') ? 'inline' : 'None');
|
2014-11-20 22:25:33 +00:00
|
|
|
}
|
|
|
|
// if we provided a show in the hidden field, use that
|
|
|
|
else if (elInput.length && elInput.val().length) {
|
|
|
|
show_name = $('#providedName').val();
|
|
|
|
}
|
2015-02-16 03:17:56 +00:00
|
|
|
update_bwlist(show_name);
|
|
|
|
var sample_text = '<p>Adding show <span class="show-name">' + cleanseText(show_name, !0) + '</span>'
|
2014-11-20 22:25:33 +00:00
|
|
|
+ ('' == show_name ? 'into<br />' : '<br />into')
|
|
|
|
+ ' <span class="show-dest">';
|
|
|
|
|
|
|
|
// if we have a root dir selected, figure out the path
|
|
|
|
if (elRootDirs.find('option:selected').length) {
|
|
|
|
var root_dir_text = elRootDirs.find('option:selected').val();
|
|
|
|
if (root_dir_text.indexOf('/') >= 0) {
|
|
|
|
sep_char = '/';
|
|
|
|
} else if (root_dir_text.indexOf('\\') >= 0) {
|
|
|
|
sep_char = '\\';
|
|
|
|
} else {
|
|
|
|
sep_char = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (root_dir_text.substr(sample_text.length - 1) != sep_char) {
|
|
|
|
root_dir_text += sep_char;
|
|
|
|
}
|
|
|
|
root_dir_text += '<i>||</i>' + sep_char;
|
|
|
|
|
|
|
|
sample_text += root_dir_text;
|
|
|
|
} else if (elFullShowPath.length && elFullShowPath.val().length) {
|
|
|
|
sample_text += elFullShowPath.val();
|
|
|
|
} else {
|
|
|
|
sample_text += 'unknown dir.';
|
|
|
|
}
|
|
|
|
|
|
|
|
sample_text += '</span></p>';
|
|
|
|
|
|
|
|
// if we have a show name then sanitize and use it for the dir name
|
|
|
|
if (show_name.length) {
|
2015-02-16 03:17:56 +00:00
|
|
|
$.get(sbRoot + '/home/addShows/sanitizeFileName', {name: cleanseText(show_name, !1)}, function (data) {
|
2014-11-20 22:25:33 +00:00
|
|
|
$('#displayText').html(sample_text.replace('||', data));
|
|
|
|
});
|
|
|
|
// if not then it's unknown
|
|
|
|
} else {
|
|
|
|
$('#displayText').html(sample_text.replace('||', '??'));
|
|
|
|
}
|
|
|
|
|
|
|
|
// also toggle the add show button
|
|
|
|
if ((elRootDirs.find('option:selected').length || (elFullShowPath.length && elFullShowPath.val().length)) &&
|
|
|
|
(elRadio.length) || (elInput.length && elInput.val().length)) {
|
2017-08-16 19:15:19 +00:00
|
|
|
$('#addShowButton').attr('disabled', !1);
|
2014-11-20 22:25:33 +00:00
|
|
|
} else {
|
2017-08-16 19:15:19 +00:00
|
|
|
$('#addShowButton').attr('disabled', !0);
|
2014-11-20 22:25:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#rootDirText').change(updateSampleText);
|
|
|
|
|
|
|
|
$('#searchResults').on('click', '.stepone-result-radio', updateSampleText);
|
|
|
|
|
|
|
|
elNameToSearch.keyup(function (event) {
|
|
|
|
if (event.keyCode == 13) {
|
|
|
|
elSearchName.click();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var addQTip = (function() {
|
|
|
|
$(this).css('cursor', 'help');
|
|
|
|
$(this).qtip({
|
|
|
|
show: {
|
2017-08-16 19:15:19 +00:00
|
|
|
solo: !0
|
2014-11-20 22:25:33 +00:00
|
|
|
},
|
|
|
|
position: {
|
|
|
|
viewport: $(window),
|
|
|
|
my: 'left center',
|
|
|
|
adjust: {
|
|
|
|
y: -10,
|
|
|
|
x: 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
style: {
|
|
|
|
tip: {
|
2017-08-16 19:15:19 +00:00
|
|
|
corner: !0,
|
2014-11-20 22:25:33 +00:00
|
|
|
method: 'polygon'
|
|
|
|
},
|
|
|
|
classes: 'qtip-rounded qtip-bootstrap qtip-shadow ui-tooltip-sb'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2015-01-25 11:58:49 +00:00
|
|
|
$('#anime').change (function () {
|
|
|
|
updateSampleText();
|
|
|
|
myform.loadsection(2);
|
|
|
|
});
|
|
|
|
|
2015-02-16 03:17:56 +00:00
|
|
|
function add_option_to_pool (text) {
|
|
|
|
var groupvalue = '', groupview = text,
|
|
|
|
option = $('<option>'),
|
|
|
|
match = /^(.*?)#<3SG#(.*)$/m.exec(text);
|
|
|
|
|
|
|
|
if (match != null) {
|
|
|
|
groupvalue = match[1];
|
|
|
|
groupview = groupvalue + match[2];
|
|
|
|
}
|
2017-01-30 00:49:58 +00:00
|
|
|
option.val(groupvalue);
|
2015-02-16 03:17:56 +00:00
|
|
|
option.html(groupview);
|
|
|
|
option.appendTo('#pool');
|
|
|
|
}
|
|
|
|
|
2015-01-25 11:58:49 +00:00
|
|
|
function update_bwlist (show_name) {
|
|
|
|
|
2015-02-16 03:17:56 +00:00
|
|
|
$('#black, #white, #pool').children().remove();
|
2015-01-25 11:58:49 +00:00
|
|
|
|
|
|
|
if ($('#anime').prop('checked')) {
|
|
|
|
$('#blackwhitelist').show();
|
|
|
|
if (show_name) {
|
2015-02-16 03:17:56 +00:00
|
|
|
$.getJSON(sbRoot + '/home/fetch_releasegroups', {'show_name': cleanseText(show_name, !1)}, function (data) {
|
|
|
|
if ('success' == data['result']) {
|
|
|
|
var groups = [];
|
|
|
|
$.each(data.groups, function (i, group) {
|
|
|
|
if ('' != group.name) {
|
|
|
|
groups.push(group.name + '#<3SG#' + ' (' + group.rating + ') ' + group.range)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (0 < groups.length) {
|
|
|
|
groups.sort();
|
|
|
|
$.each(groups, function (i, text) {
|
|
|
|
add_option_to_pool(text);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
add_option_to_pool('No groups returned from AniDB');
|
|
|
|
}
|
|
|
|
} else if ('fail' == data['result']) {
|
|
|
|
if ('connect' == data['resp']) {
|
|
|
|
add_option_to_pool('Fail:AniDB connect. Restart sg else check debug log');
|
|
|
|
} else if ('init' == data['resp']) {
|
|
|
|
add_option_to_pool('Did not initialise AniDB. Check debug log if reqd.');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2015-01-25 11:58:49 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$('#blackwhitelist').hide();
|
|
|
|
}
|
2015-02-16 03:17:56 +00:00
|
|
|
}
|
2014-03-10 05:18:05 +00:00
|
|
|
});
|