1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/src/controllers/user/home/index.js

47 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-08-14 08:46:34 +02:00
import HomescreenSettings from '../../../components/homeScreenSettings/homeScreenSettings';
import * as userSettings from '../../../scripts/settings/userSettings';
import autoFocuser from '../../../components/autoFocuser';
import '../../../components/listview/listview.css';
/* eslint-disable indent */
// Shortcuts
const UserSettings = userSettings.UserSettings;
export default function (view, params) {
let homescreenSettingsInstance;
let hasChanges;
const userId = params.userId || ApiClient.getCurrentUserId();
const currentSettings = userId === ApiClient.getCurrentUserId() ? userSettings : new UserSettings();
view.addEventListener('viewshow', function () {
if (homescreenSettingsInstance) {
homescreenSettingsInstance.loadData();
} else {
homescreenSettingsInstance = new HomescreenSettings({
serverId: ApiClient.serverId(),
userId: userId,
2020-05-04 12:44:12 +02:00
element: view.querySelector('.homeScreenSettingsContainer'),
2020-04-03 03:16:06 +09:00
userSettings: currentSettings,
enableSaveButton: true,
enableSaveConfirmation: true,
autoFocus: autoFocuser.isEnabled()
});
}
});
2020-05-04 12:44:12 +02:00
view.addEventListener('change', function () {
hasChanges = true;
});
2020-05-04 12:44:12 +02:00
view.addEventListener('viewdestroy', function () {
if (homescreenSettingsInstance) {
homescreenSettingsInstance.destroy();
homescreenSettingsInstance = null;
}
});
}
/* eslint-enable indent */