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

39 lines
1.4 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';
2021-01-26 16:25:38 -05:00
import '../../../components/listview/listview.scss';
2023-04-19 01:56:05 -04:00
// Shortcuts
const UserSettings = userSettings.UserSettings;
2023-04-19 01:56:05 -04:00
export default function (view, params) {
let homescreenSettingsInstance;
2023-04-19 01:56:05 -04:00
const userId = params.userId || ApiClient.getCurrentUserId();
const currentSettings = userId === ApiClient.getCurrentUserId() ? userSettings : new UserSettings();
2023-04-19 01:56:05 -04:00
view.addEventListener('viewshow', function () {
if (homescreenSettingsInstance) {
homescreenSettingsInstance.loadData();
} else {
homescreenSettingsInstance = new HomescreenSettings({
serverId: ApiClient.serverId(),
userId: userId,
element: view.querySelector('.homeScreenSettingsContainer'),
userSettings: currentSettings,
enableSaveButton: true,
enableSaveConfirmation: true,
autoFocus: autoFocuser.isEnabled()
});
}
});
2023-04-19 01:56:05 -04:00
view.addEventListener('viewdestroy', function () {
if (homescreenSettingsInstance) {
homescreenSettingsInstance.destroy();
homescreenSettingsInstance = null;
}
});
}