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

79 lines
2.1 KiB
JavaScript
Raw Normal View History

2013-05-21 13:36:26 -07:00
(function ($, document, window) {
function loadPage(page, config) {
$('#txtSeasonZeroName', page).val(config.SeasonZeroDisplayName);
2014-01-29 13:30:26 -07:00
$('#chkEnableRealtimeMonitor', page).checked(config.EnableRealtimeMonitor).checkboxradio("refresh");
2014-07-19 21:46:29 -07:00
$('#txtItemsByNamePath', page).val(config.ItemsByNamePath || '');
2013-05-21 13:36:26 -07:00
Dashboard.hideLoadingMsg();
}
$(document).on('pageshow', "#librarySettingsPage", function () {
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (config) {
loadPage(page, config);
});
2014-07-19 21:46:29 -07:00
}).on('pageinit', "#librarySettingsPage", function () {
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
});
function librarySettingsPage() {
var self = this;
self.onSubmit = function () {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getServerConfiguration().done(function (config) {
2014-07-19 21:46:29 -07:00
config.ItemsByNamePath = $('#txtItemsByNamePath', form).val();
config.SeasonZeroDisplayName = $('#txtSeasonZeroName', form).val();
2014-01-29 13:30:26 -07:00
config.EnableRealtimeMonitor = $('#chkEnableRealtimeMonitor', form).checked();
2013-05-21 13:36:26 -07:00
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
};
}
window.LibrarySettingsPage = new librarySettingsPage();
})(jQuery, document, window);