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
2015-12-14 08:43:03 -07:00
ApiClient.getServerConfiguration().then(function (config) {
2014-09-22 14:56:54 -07:00
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-12-14 08:43:03 -07:00
ApiClient.updateServerConfiguration(config).then(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-09-01 07:01:59 -07:00
$(document).on('pageinit', "#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-09-24 10:08:10 -07:00
}).on('pageshow', "#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-12-14 08:43:03 -07:00
ApiClient.getServerConfiguration().then(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);