1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

modularize scripts

This commit is contained in:
Luke Pulverenti 2015-06-08 00:47:19 -04:00
parent 1dd2833ed7
commit bbfda77868
15 changed files with 95 additions and 133 deletions

View file

@ -54,7 +54,35 @@
Dashboard.hideLoadingMsg();
}
$(document).on('pageinit', "#channelSettingsPage", function () {
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getNamedConfiguration("channels").done(function (config) {
// This should be null if empty
config.PreferredStreamingWidth = $('#selectChannelResolution', form).val() || null;
config.MaxDownloadAge = $('#txtDownloadAge', form).val() || null;
config.DownloadSizeLimit = $('#txtDownloadSizeLimit', form).val() || null;
config.DownloadPath = $('#txtCachePath', form).val() || null;
config.DownloadingChannels = $('.chkChannelDownload:checked', form)
.get()
.map(function (i) {
return i.getAttribute('data-channelid');
});
ApiClient.updateNamedConfiguration("channels", config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
$(document).on('pageinitdepends', "#channelSettingsPage", function () {
var page = this;
@ -78,7 +106,9 @@
});
});
}).on('pageshow', "#channelSettingsPage", function () {
$('.channelSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
}).on('pageshowready', "#channelSettingsPage", function () {
Dashboard.showLoadingMsg();
@ -98,36 +128,4 @@
});
function onSubmit() {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getNamedConfiguration("channels").done(function (config) {
// This should be null if empty
config.PreferredStreamingWidth = $('#selectChannelResolution', form).val() || null;
config.MaxDownloadAge = $('#txtDownloadAge', form).val() || null;
config.DownloadSizeLimit = $('#txtDownloadSizeLimit', form).val() || null;
config.DownloadPath = $('#txtCachePath', form).val() || null;
config.DownloadingChannels = $('.chkChannelDownload:checked', form)
.get()
.map(function(i) {
return i.getAttribute('data-channelid');
});
ApiClient.updateNamedConfiguration("channels", config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
window.ChannelSettingsPage = {
onSubmit: onSubmit
};
})(jQuery, document, window);