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

Migration of wizard to ES6 modules

This commit is contained in:
Cameron 2020-07-17 19:04:56 +01:00
parent a9246f8f39
commit c11977c9fe
6 changed files with 235 additions and 227 deletions

View file

@ -1,39 +1,40 @@
define(['loading', 'emby-checkbox', 'emby-button', 'emby-select'], function (loading) {
'use strict';
import loading from 'loading';
import 'emby-checkbox';
import 'emby-button';
import 'emby-select';
function save(page) {
loading.show();
var apiClient = ApiClient;
var config = {};
config.EnableRemoteAccess = page.querySelector('#chkRemoteAccess').checked;
config.EnableAutomaticPortMapping = page.querySelector('#chkEnableUpnp').checked;
apiClient.ajax({
type: 'POST',
data: config,
url: apiClient.getUrl('Startup/RemoteAccess')
}).then(function () {
loading.hide();
navigateToNextPage();
});
}
function save(page) {
loading.show();
const apiClient = ApiClient;
const config = {};
config.EnableRemoteAccess = page.querySelector('#chkRemoteAccess').checked;
config.EnableAutomaticPortMapping = page.querySelector('#chkEnableUpnp').checked;
apiClient.ajax({
type: 'POST',
data: config,
url: apiClient.getUrl('Startup/RemoteAccess')
}).then(function () {
loading.hide();
navigateToNextPage();
});
}
function navigateToNextPage() {
Dashboard.navigate('wizardfinish.html');
}
function navigateToNextPage() {
Dashboard.navigate('wizardfinish.html');
}
function onSubmit(e) {
save(this);
e.preventDefault();
return false;
}
function onSubmit(e) {
save(this);
e.preventDefault();
return false;
}
return function (view, params) {
view.querySelector('.wizardSettingsForm').addEventListener('submit', onSubmit);
view.addEventListener('viewshow', function () {
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
});
view.addEventListener('viewhide', function () {
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
});
};
});
export default function (view, params) {
view.querySelector('.wizardSettingsForm').addEventListener('submit', onSubmit);
view.addEventListener('viewshow', function () {
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
});
view.addEventListener('viewhide', function () {
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
});
}