mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
move wizard and user preference routes to nested folders
This commit is contained in:
parent
a353812400
commit
c0261ee487
30 changed files with 55 additions and 42 deletions
55
src/controllers/user/playback/index.js
Normal file
55
src/controllers/user/playback/index.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
import PlaybackSettings from 'playbackSettings';
|
||||
import dom from 'dom';
|
||||
import globalize from 'globalize';
|
||||
import loading from 'loading';
|
||||
import * as userSettings from 'userSettings';
|
||||
import autoFocuser from 'autoFocuser';
|
||||
import 'listViewStyle';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
// Shortcuts
|
||||
const UserSettings = userSettings.UserSettings;
|
||||
|
||||
export default function (view, params) {
|
||||
function onBeforeUnload(e) {
|
||||
if (hasChanges) {
|
||||
e.returnValue = 'You currently have unsaved changes. Are you sure you wish to leave?';
|
||||
}
|
||||
}
|
||||
|
||||
let settingsInstance;
|
||||
let hasChanges;
|
||||
const userId = params.userId || ApiClient.getCurrentUserId();
|
||||
const currentSettings = userId === ApiClient.getCurrentUserId() ? userSettings : new UserSettings();
|
||||
view.addEventListener('viewshow', function () {
|
||||
window.addEventListener('beforeunload', onBeforeUnload);
|
||||
|
||||
if (settingsInstance) {
|
||||
settingsInstance.loadData();
|
||||
} else {
|
||||
settingsInstance = new PlaybackSettings({
|
||||
serverId: ApiClient.serverId(),
|
||||
userId: userId,
|
||||
element: view.querySelector('.settingsContainer'),
|
||||
userSettings: currentSettings,
|
||||
enableSaveButton: true,
|
||||
enableSaveConfirmation: true,
|
||||
autoFocus: autoFocuser.isEnabled()
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
view.addEventListener('change', function () {
|
||||
hasChanges = true;
|
||||
});
|
||||
|
||||
view.addEventListener('viewdestroy', function () {
|
||||
if (settingsInstance) {
|
||||
settingsInstance.destroy();
|
||||
settingsInstance = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
Loading…
Add table
Add a link
Reference in a new issue