mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
finish open subtitle config page
This commit is contained in:
parent
746a467d6a
commit
0718ddfce4
2 changed files with 45 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
(function ($, document, window) {
|
||||
|
||||
function loadPage(page, config, systemInfo) {
|
||||
function loadPage(page, config, languages) {
|
||||
|
||||
$('#chkSubtitlesMovies', page).checked(config.SubtitleOptions.DownloadMovieSubtitles).checkboxradio("refresh");
|
||||
$('#chkSubtitlesEpisodes', page).checked(config.SubtitleOptions.DownloadEpisodeSubtitles).checkboxradio("refresh");
|
||||
|
@ -10,9 +10,38 @@
|
|||
$('#txtOpenSubtitleUsername', page).val(config.SubtitleOptions.OpenSubtitlesUsername);
|
||||
$('#txtOpenSubtitlePassword', page).val('');
|
||||
|
||||
populateLanguages(page, config, languages);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
function populateLanguages(page, config, languages) {
|
||||
|
||||
var html = '<div data-role="controlgroup" data-corners="false" style="margin:0;">';
|
||||
|
||||
for (var i = 0, length = languages.length; i < length; i++) {
|
||||
|
||||
var culture = languages[i];
|
||||
|
||||
var id = "chkSubtitleLanguage" + i;
|
||||
|
||||
html += '<label style="font-size:13px;" for="' + id + '">' + culture.DisplayName + '</label>';
|
||||
html += '<input class="chkLang" data-lang="' + culture.ThreeLetterISOLanguageName.toLowerCase() + '" type="checkbox" id="' + id + '" />';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
||||
$('.downloadLanguages', page).html(html).trigger("create");
|
||||
|
||||
var langs = config.SubtitleOptions.DownloadLanguages || [];
|
||||
|
||||
$('.chkLang', page).each(function () {
|
||||
|
||||
this.checked = langs.indexOf(this.getAttribute('data-lang')) != -1;
|
||||
|
||||
}).checkboxradio('refresh');
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#metadataSubtitlesPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
@ -20,7 +49,7 @@
|
|||
var page = this;
|
||||
|
||||
var promise1 = ApiClient.getServerConfiguration();
|
||||
var promise2 = ApiClient.getSystemInfo();
|
||||
var promise2 = ApiClient.getCultures();
|
||||
|
||||
$.when(promise1, promise2).done(function (response1, response2) {
|
||||
|
||||
|
@ -55,6 +84,12 @@
|
|||
|
||||
config.SubtitleOptions.OpenSubtitlesPasswordHash = $('#txtOpenSubtitlePassword', form).val();
|
||||
|
||||
config.SubtitleOptions.DownloadLanguages = $('.chkLang:checked', form).get().map(function (c) {
|
||||
|
||||
return c.getAttribute('data-lang');
|
||||
|
||||
});
|
||||
|
||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue