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

67 lines
1.8 KiB
JavaScript
Raw Normal View History

define(['jQuery'], function ($) {
2016-10-22 22:11:46 -07:00
'use strict';
2014-09-22 14:56:54 -07:00
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
2016-04-12 22:28:45 -07:00
function getTabs() {
return [
{
href: 'cinemamodeconfiguration.html',
name: Globalize.translate('TabCinemaMode')
},
{
href: 'playbackconfiguration.html',
name: Globalize.translate('TabResumeSettings')
},
{
href: 'streamingsettings.html',
name: Globalize.translate('TabStreaming')
}];
}
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
2016-04-12 22:28:45 -07:00
LibraryMenu.setTabs('playback', 1, getTabs);
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
});