1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/dashboard-ui/scripts/librarysettings.js

86 lines
2.5 KiB
JavaScript
Raw Normal View History

2013-05-21 16:36:26 -04: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 15:30:26 -05:00
2014-07-20 00:46:29 -04:00
$('#txtItemsByNamePath', page).val(config.ItemsByNamePath || '');
2015-01-10 00:53:35 -05:00
$('#chkEnableAudioArchiveFiles', page).checked(config.EnableAudioArchiveFiles).checkboxradio("refresh");
$('#chkEnableVideoArchiveFiles', page).checked(config.EnableVideoArchiveFiles).checkboxradio("refresh");
2013-05-21 16:36:26 -04:00
Dashboard.hideLoadingMsg();
}
2015-06-07 21:23:56 -04: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 21:23:56 -04: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 16:36:26 -04:00
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (config) {
loadPage(page, config);
});
2015-09-01 10:01:59 -04:00
}).on('pageinit', "#librarySettingsPage", function () {
2014-07-20 00:46:29 -04: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 16:36:26 -04:00
2015-06-07 21:23:56 -04:00
$('.librarySettingsForm').off('submit', onSubmit).on('submit', onSubmit);
});
2013-05-21 16:36:26 -04:00
})(jQuery, document, window);