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

49 lines
1.2 KiB
JavaScript
Raw Normal View History

2014-06-01 12:41:35 -07:00
(function ($, document, window) {
2015-08-21 09:54:11 -07:00
function loadPage(page, config) {
2014-06-02 12:32:41 -07:00
2015-09-03 10:01:51 -07:00
$('#selectChannelResolution', page).val(config.PreferredStreamingWidth || '');
2014-06-02 12:32:41 -07:00
2014-06-01 12:41:35 -07:00
Dashboard.hideLoadingMsg();
}
2015-06-07 21:47:19 -07:00
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getNamedConfiguration("channels").done(function (config) {
// This should be null if empty
config.PreferredStreamingWidth = $('#selectChannelResolution', form).val() || null;
ApiClient.updateNamedConfiguration("channels", config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
2015-09-01 07:01:59 -07:00
$(document).on('pageinit', "#channelSettingsPage", function () {
2014-06-02 12:32:41 -07:00
var page = this;
2015-08-21 09:54:11 -07:00
$('.channelSettingsForm', page).off('submit', onSubmit).on('submit', onSubmit);
2015-06-07 21:47:19 -07:00
}).on('pageshowready', "#channelSettingsPage", function () {
2014-06-01 12:41:35 -07:00
Dashboard.showLoadingMsg();
var page = this;
2015-08-21 09:54:11 -07:00
ApiClient.getNamedConfiguration("channels").done(function (config) {
2014-06-02 12:32:41 -07:00
2015-08-21 09:54:11 -07:00
loadPage(page, config);
2014-06-01 12:41:35 -07:00
});
});
})(jQuery, document, window);