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

66 lines
1.7 KiB
JavaScript
Raw Normal View History

2015-04-08 22:20:23 -07:00
(function ($, document, window) {
function loadPage(page, config) {
$('#txtRemoteClientBitrateLimit', page).val((config.RemoteClientBitrateLimit / 1000000) || '');
Dashboard.hideLoadingMsg();
}
2015-05-17 18:27:48 -07:00
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getServerConfiguration().done(function (config) {
config.RemoteClientBitrateLimit = parseInt(parseFloat(($('#txtRemoteClientBitrateLimit', form).val() || '0')) * 1000000);
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
$(document).on('pageinitdepends', "#streamingSettingsPage", function () {
2015-04-08 22:20:23 -07:00
var page = this;
$('#btnSelectTranscodingTempPath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtTranscodingTempPath', page).val(path);
}
picker.close();
},
header: Globalize.translate('HeaderSelectTranscodingPath'),
instruction: Globalize.translate('HeaderSelectTranscodingPathHelp')
});
});
2015-05-17 18:27:48 -07:00
$('.streamingSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
2015-05-19 12:15:40 -07:00
}).on('pageshowready', "#streamingSettingsPage", function () {
2015-04-08 22:20:23 -07:00
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (config) {
loadPage(page, config);
});
});
})(jQuery, document, window);