';
}
html += '';
itemHtml += '';
if (s.Path) {
itemHtml += '';
}
itemHtml += '';
return itemHtml;
}).join('');
html += '
';
}
var elem = $('.subtitleList', page).html(html).trigger('create');
$('.btnViewSubtitles', elem).on('click', function () {
var index = this.getAttribute('data-index');
showLocalSubtitles(page, index);
});
$('.btnDelete', elem).on('click', function () {
var index = this.getAttribute('data-index');
deleteLocalSubtitle(page, index);
});
}
function fillLanguages(page, languages) {
$('#selectLanguage', page).html(languages.map(function (l) {
return '';
}));
var lastLanguage = appStorage.getItem('subtitleeditor-language');
if (lastLanguage) {
$('#selectLanguage', page).val(lastLanguage);
}
else {
Dashboard.getCurrentUser().then(function (user) {
var lang = user.Configuration.SubtitleLanguagePreference;
if (lang) {
$('#selectLanguage', page).val(lang);
}
});
}
}
function renderSearchResults(page, results) {
var lastProvider = '';
var html = '';
if (!results.length) {
$('.noSearchResults', page).show();
$('.subtitleResults', page).html('');
Dashboard.hideLoadingMsg();
return;
}
$('.noSearchResults', page).hide();
for (var i = 0, length = results.length; i < length; i++) {
var result = results[i];
var provider = result.ProviderName;
if (provider != lastProvider) {
if (i > 0) {
html += '';
}
html += '
' + provider + '
';
html += '
';
lastProvider = provider;
}
html += '';
html += '';
if (result.Comment) {
html += '';
}
else {
html += '';
}
//html += '';
html += '