2014-03-10 01:18:05 -04:00
|
|
|
(function(){
|
|
|
|
$.fn.ajaxEpSubtitlesSearch = function(){
|
|
|
|
$('.epSubtitlesSearch').click(function(){
|
2014-11-10 02:29:24 -05:00
|
|
|
var subtitles_td = $(this).parent().siblings('.col-subtitles');
|
2014-03-10 01:18:05 -04:00
|
|
|
var subtitles_search_link = $(this);
|
|
|
|
// fill with the ajax loading gif
|
|
|
|
subtitles_search_link.empty();
|
2014-10-24 09:16:46 -04:00
|
|
|
subtitles_search_link.append($("<img/>").attr({"src": sbRoot+"/images/loading16.gif", "alt": "", "title": "loading"}));
|
2014-03-10 01:18:05 -04:00
|
|
|
$.getJSON($(this).attr('href'), function(data){
|
|
|
|
if (data.result != "failure" && data.result != "No subtitles downloaded") {
|
|
|
|
// clear and update the subtitles column with new informations
|
|
|
|
var subtitles = data.subtitles.split(',');
|
2014-03-20 14:03:22 -04:00
|
|
|
subtitles_td.empty()
|
2014-03-10 01:18:05 -04:00
|
|
|
$.each(subtitles,function(index, language){
|
|
|
|
if (language != "" && language != "und") {
|
|
|
|
if (index != subtitles.length - 1) {
|
2015-02-13 14:51:56 -05:00
|
|
|
subtitles_td.append($("<img/>").attr({"src": sbRoot+"/images/flags/"+language+".png", "alt": language, "width": 16, "height": 11}));
|
2014-03-10 01:18:05 -04:00
|
|
|
} else {
|
2015-02-13 14:51:56 -05:00
|
|
|
subtitles_td.append($("<img/>").attr({"src": sbRoot+"/images/flags/"+language+".png", "alt": language, "width": 16, "height": 11}));
|
2014-03-10 01:18:05 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// don't allow other searches
|
|
|
|
subtitles_search_link.remove();
|
|
|
|
} else {
|
|
|
|
subtitles_search_link.remove();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// don't follow the link
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
$.fn.ajaxEpMergeSubtitles = function(){
|
|
|
|
$('.epMergeSubtitles').click(function(){
|
|
|
|
var subtitles_merge_link = $(this);
|
|
|
|
// fill with the ajax loading gif
|
|
|
|
subtitles_merge_link.empty();
|
2014-10-24 09:16:46 -04:00
|
|
|
subtitles_merge_link.append($("<img/>").attr({"src": sbRoot+"/images/loading16.gif", "alt": "", "title": "loading"}));
|
2014-03-10 01:18:05 -04:00
|
|
|
$.getJSON($(this).attr('href'), function(data){
|
|
|
|
// don't allow other merges
|
|
|
|
subtitles_merge_link.remove();
|
|
|
|
});
|
|
|
|
// don't follow the link
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})();
|