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;
2015-12-14 08:43:03 -07:00
ApiClient.getNamedConfiguration("channels").then(function (config) {
2015-06-07 21:47:19 -07:00
// This should be null if empty
config.PreferredStreamingWidth = $('#selectChannelResolution', form).val() || null;
2015-12-14 08:43:03 -07:00
ApiClient.updateNamedConfiguration("channels", config).then(Dashboard.processServerConfigurationUpdateResult);
2015-06-07 21:47:19 -07:00
});
// 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
2015-09-24 10:08:10 -07:00
}).on('pageshow', "#channelSettingsPage", function () {
2014-06-01 12:41:35 -07:00
Dashboard.showLoadingMsg();
var page = this;
2015-12-14 08:43:03 -07:00
ApiClient.getNamedConfiguration("channels").then(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);