mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
40 lines
2 KiB
JavaScript
40 lines
2 KiB
JavaScript
define(["apphost", "connectionManager", "listViewStyle", "emby-button"], function(appHost, connectionManager) {
|
|
"use strict";
|
|
|
|
return function(view, params) {
|
|
view.querySelector(".btnLogout").addEventListener("click", function() {
|
|
Dashboard.logout();
|
|
});
|
|
|
|
view.addEventListener("viewshow", function() {
|
|
// this page can also be used by admins to change user preferences from the user edit page
|
|
var userId = params.userId || Dashboard.getCurrentUserId();
|
|
var 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(".lnkLanguagePreferences").setAttribute("href", "mypreferenceslanguages.html?userId=" + userId);
|
|
page.querySelector(".lnkSubtitlePreferences").setAttribute("href", "mypreferencessubtitles.html?userId=" + userId);
|
|
|
|
if (appHost.supports("multiserver")) {
|
|
page.querySelector(".selectServer").classList.remove("hide")
|
|
} else {
|
|
page.querySelector(".selectServer").classList.add("hide");
|
|
}
|
|
|
|
// 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");
|
|
}
|
|
|
|
ApiClient.getUser(userId).then(function(user) {
|
|
page.querySelector(".headerUsername").innerHTML = user.Name;
|
|
if (!user.Policy.IsAdministrator) {
|
|
page.querySelector(".adminSection").classList.add("hide");
|
|
}
|
|
});
|
|
})
|
|
}
|
|
});
|