2020-08-16 20:24:45 +02:00
|
|
|
import { appHost } from '../../../components/apphost';
|
2020-08-14 08:46:34 +02:00
|
|
|
import '../../../components/listview/listview.css';
|
|
|
|
import '../../../elements/emby-button/emby-button';
|
|
|
|
import layoutManager from '../../../components/layoutManager';
|
2020-07-18 21:08:35 +01:00
|
|
|
|
|
|
|
export default function (view, params) {
|
|
|
|
view.querySelector('.btnLogout').addEventListener('click', function () {
|
|
|
|
Dashboard.logout();
|
|
|
|
});
|
|
|
|
|
|
|
|
view.querySelector('.selectServer').addEventListener('click', function () {
|
|
|
|
Dashboard.selectServer();
|
|
|
|
});
|
|
|
|
|
|
|
|
view.querySelector('.clientSettings').addEventListener('click', function () {
|
|
|
|
window.NativeShell.openClientSettings();
|
|
|
|
});
|
|
|
|
|
|
|
|
view.addEventListener('viewshow', function () {
|
|
|
|
// this page can also be used by admins to change user preferences from the user edit page
|
|
|
|
const userId = params.userId || Dashboard.getCurrentUserId();
|
|
|
|
const page = this;
|
|
|
|
|
|
|
|
page.querySelector('.lnkMyProfile').setAttribute('href', 'myprofile.html?userId=' + userId);
|
|
|
|
page.querySelector('.lnkDisplayPreferences').setAttribute('href', 'mypreferencesdisplay.html?userId=' + userId);
|
|
|
|
page.querySelector('.lnkHomePreferences').setAttribute('href', 'mypreferenceshome.html?userId=' + userId);
|
|
|
|
page.querySelector('.lnkPlaybackPreferences').setAttribute('href', 'mypreferencesplayback.html?userId=' + userId);
|
|
|
|
page.querySelector('.lnkSubtitlePreferences').setAttribute('href', 'mypreferencessubtitles.html?userId=' + userId);
|
2020-07-26 23:57:28 -05:00
|
|
|
page.querySelector('.lnkQuickConnectPreferences').setAttribute('href', 'mypreferencesquickconnect.html');
|
2020-07-18 21:08:35 +01:00
|
|
|
|
|
|
|
if (window.NativeShell && window.NativeShell.AppHost.supports('clientsettings')) {
|
|
|
|
page.querySelector('.clientSettings').classList.remove('hide');
|
|
|
|
} else {
|
|
|
|
page.querySelector('.clientSettings').classList.add('hide');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (appHost.supports('multiserver')) {
|
|
|
|
page.querySelector('.selectServer').classList.remove('hide');
|
|
|
|
} else {
|
|
|
|
page.querySelector('.selectServer').classList.add('hide');
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiClient.getUser(userId).then(function (user) {
|
|
|
|
page.querySelector('.headerUsername').innerHTML = user.Name;
|
2020-08-26 20:06:48 +02:00
|
|
|
if (user.Policy.IsAdministrator && !layoutManager.tv) {
|
|
|
|
page.querySelector('.adminSection').classList.remove('hide');
|
2019-04-26 20:39:43 -07:00
|
|
|
}
|
2020-07-18 21:08:35 +01:00
|
|
|
});
|
2019-01-17 04:55:51 +09:00
|
|
|
|
2020-08-26 20:06:48 +02:00
|
|
|
// Hide the actions if user preferences are being edited for a different user
|
|
|
|
if (params.userId && params.userId !== Dashboard.getCurrentUserId) {
|
|
|
|
page.querySelector('.userSection').classList.add('hide');
|
|
|
|
page.querySelector('.adminSection').classList.add('hide');
|
|
|
|
}
|
|
|
|
|
2020-08-14 08:46:34 +02:00
|
|
|
import('../../../components/autoFocuser').then(({default: autoFocuser}) => {
|
2020-07-18 21:08:35 +01:00
|
|
|
autoFocuser.autoFocus(view);
|
2019-11-06 13:43:39 +03:00
|
|
|
});
|
2020-07-18 21:08:35 +01:00
|
|
|
});
|
|
|
|
}
|