jellyfin-web/dashboard-ui/scripts/librarysettings.js

86 lines
2.6 KiB
JavaScript
Raw Normal View History

2013-05-21 13:36:26 -07:00
(function ($, document, window) {
function loadPage(page, config) {
if (config.MergeMetadataAndImagesByName) {
$('.fldImagesByName', page).hide();
} else {
$('.fldImagesByName', page).show();
}
$('#txtSeasonZeroName', page).val(config.SeasonZeroDisplayName);
$('#selectEnableRealtimeMonitor', page).val(config.EnableLibraryMonitor).selectmenu("refresh");
2014-01-29 13:30:26 -07:00
2014-07-19 21:46:29 -07:00
$('#txtItemsByNamePath', page).val(config.ItemsByNamePath || '');
2015-01-09 22:53:35 -07:00
$('#chkEnableAudioArchiveFiles', page).checked(config.EnableAudioArchiveFiles).checkboxradio("refresh");
$('#chkEnableVideoArchiveFiles', page).checked(config.EnableVideoArchiveFiles).checkboxradio("refresh");
2013-05-21 13:36:26 -07:00
Dashboard.hideLoadingMsg();
}
2015-06-07 18:23:56 -07:00
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getServerConfiguration().done(function (config) {
config.ItemsByNamePath = $('#txtItemsByNamePath', form).val();
config.SeasonZeroDisplayName = $('#txtSeasonZeroName', form).val();
config.EnableLibraryMonitor = $('#selectEnableRealtimeMonitor', form).val();
2015-06-07 18:23:56 -07:00
config.EnableAudioArchiveFiles = $('#chkEnableAudioArchiveFiles', form).checked();
config.EnableVideoArchiveFiles = $('#chkEnableVideoArchiveFiles', form).checked();
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
$(document).on('pageshowready', "#librarySettingsPage", function () {
2013-05-21 13:36:26 -07:00
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (config) {
loadPage(page, config);
});
2015-06-07 18:23:56 -07:00
}).on('pageinitdepends', "#librarySettingsPage", function () {
2014-07-19 21:46:29 -07:00
var page = this;
$('#btnSelectIBNPath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtItemsByNamePath', page).val(path);
}
picker.close();
},
header: Globalize.translate('HeaderSelectImagesByNamePath'),
instruction: Globalize.translate('HeaderSelectImagesByNamePathHelp')
});
});
2013-05-21 13:36:26 -07:00
2015-06-07 18:23:56 -07:00
$('.librarySettingsForm').off('submit', onSubmit).on('submit', onSubmit);
});
2013-05-21 13:36:26 -07:00
})(jQuery, document, window);