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

69 lines
1.9 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;
2015-12-14 08:43:03 -07:00
ApiClient.getServerConfiguration().then(function (config) {
2015-05-17 18:27:48 -07:00
config.RemoteClientBitrateLimit = parseInt(parseFloat(($('#txtRemoteClientBitrateLimit', form).val() || '0')) * 1000000);
2015-12-14 08:43:03 -07:00
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
2015-05-17 18:27:48 -07:00
});
// Disable default form submission
return false;
}
2015-09-01 07:01:59 -07:00
$(document).on('pageinit', "#streamingSettingsPage", function () {
2015-04-08 22:20:23 -07:00
var page = this;
$('#btnSelectTranscodingTempPath', page).on("click.selectDirectory", function () {
2015-10-13 12:22:45 -07:00
require(['directorybrowser'], function (directoryBrowser) {
2015-04-08 22:20:23 -07:00
2015-10-13 12:22:45 -07:00
var picker = new directoryBrowser();
2015-04-08 22:20:23 -07:00
2015-10-13 12:22:45 -07:00
picker.show({
2015-04-08 22:20:23 -07:00
2015-10-13 12:22:45 -07:00
callback: function (path) {
2015-04-08 22:20:23 -07:00
2015-10-13 12:22:45 -07:00
if (path) {
$('#txtTranscodingTempPath', page).val(path);
}
picker.close();
},
2015-04-08 22:20:23 -07:00
2015-10-13 12:22:45 -07:00
header: Globalize.translate('HeaderSelectTranscodingPath'),
instruction: Globalize.translate('HeaderSelectTranscodingPathHelp')
});
2015-04-08 22:20:23 -07:00
});
});
2015-05-17 18:27:48 -07:00
$('.streamingSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
2015-09-24 10:08:10 -07:00
}).on('pageshow', "#streamingSettingsPage", function () {
2015-04-08 22:20:23 -07:00
Dashboard.showLoadingMsg();
var page = this;
2015-12-14 08:43:03 -07:00
ApiClient.getServerConfiguration().then(function (config) {
2015-04-08 22:20:23 -07:00
loadPage(page, config);
});
});
})(jQuery, document, window);