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

50 lines
1.4 KiB
JavaScript
Raw Normal View History

2014-03-10 10:38:53 -07:00
(function ($, document, window) {
function loadPage(page, config) {
2014-06-29 10:35:05 -07:00
$('#chkEnablePlayTo', page).checked(config.EnablePlayTo).checkboxradio("refresh");
$('#chkEnableDlnaDebugLogging', page).checked(config.EnableDebugLogging).checkboxradio("refresh");
$('#txtClientDiscoveryInterval', page).val(config.ClientDiscoveryIntervalSeconds);
2014-03-23 13:49:05 -07:00
2014-03-10 10:38:53 -07:00
Dashboard.hideLoadingMsg();
}
$(document).on('pageshow', "#dlnaSettingsPage", function () {
Dashboard.showLoadingMsg();
var page = this;
2014-06-29 10:35:05 -07:00
ApiClient.getNamedConfiguration("dlna").done(function (config) {
2014-03-10 10:38:53 -07:00
loadPage(page, config);
});
});
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
2014-06-29 10:35:05 -07:00
ApiClient.getNamedConfiguration("dlna").done(function (config) {
2014-03-10 10:38:53 -07:00
2014-06-29 10:35:05 -07:00
config.EnablePlayTo = $('#chkEnablePlayTo', form).checked();
config.EnableDebugLogging = $('#chkEnableDlnaDebugLogging', form).checked();
config.ClientDiscoveryIntervalSeconds = $('#txtClientDiscoveryInterval', form).val();
2014-03-10 10:38:53 -07:00
2014-06-29 10:35:05 -07:00
ApiClient.updateNamedConfiguration("dlna", config).done(Dashboard.processServerConfigurationUpdateResult);
2014-03-10 10:38:53 -07:00
});
// Disable default form submission
return false;
}
window.DlnaSettingsPage = {
onSubmit: onSubmit
};
})(jQuery, document, window);