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

49 lines
1.3 KiB
JavaScript
Raw Normal View History

2014-09-22 14:56:54 -07:00
(function ($, document, window) {
function loadPage(page, config) {
$('#txtMinResumePct', page).val(config.MinResumePct);
$('#txtMaxResumePct', page).val(config.MaxResumePct);
$('#txtMinResumeDuration', page).val(config.MinResumeDurationSeconds);
Dashboard.hideLoadingMsg();
}
2015-06-08 14:32:20 -07:00
function onSubmit() {
2014-09-22 14:56:54 -07:00
Dashboard.showLoadingMsg();
2015-06-08 14:32:20 -07:00
var form = this;
2014-09-22 14:56:54 -07:00
ApiClient.getServerConfiguration().done(function (config) {
2015-06-08 14:32:20 -07:00
config.MinResumePct = $('#txtMinResumePct', form).val();
config.MaxResumePct = $('#txtMaxResumePct', form).val();
config.MinResumeDurationSeconds = $('#txtMinResumeDuration', form).val();
2014-09-22 14:56:54 -07:00
2015-06-08 14:32:20 -07:00
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
2014-09-22 14:56:54 -07:00
});
2015-06-08 14:32:20 -07:00
// Disable default form submission
return false;
}
2014-09-22 14:56:54 -07:00
2015-06-08 14:32:20 -07:00
$(document).on('pageinitdepends', "#playbackConfigurationPage", function () {
2014-09-22 14:56:54 -07:00
2015-06-08 14:32:20 -07:00
$('.playbackConfigurationForm').off('submit', onSubmit).on('submit', onSubmit);
2014-09-22 14:56:54 -07:00
2015-06-08 14:32:20 -07:00
}).on('pageshowready', "#playbackConfigurationPage", function () {
2014-09-22 14:56:54 -07:00
2015-06-08 14:32:20 -07:00
Dashboard.showLoadingMsg();
2014-09-22 14:56:54 -07:00
2015-06-08 14:32:20 -07:00
var page = this;
2014-09-22 14:56:54 -07:00
2015-06-08 14:32:20 -07:00
ApiClient.getServerConfiguration().done(function (config) {
2014-09-22 14:56:54 -07:00
2015-06-08 14:32:20 -07:00
loadPage(page, config);
2014-09-22 14:56:54 -07:00
2015-06-08 14:32:20 -07:00
});
2014-09-22 14:56:54 -07:00
2015-06-08 14:32:20 -07:00
});
2014-09-22 14:56:54 -07:00
})(jQuery, document, window);