jellyfin-web/dashboard-ui/scripts/mypreferencescommon.js

1 line
1.9 KiB
JavaScript
Raw Normal View History

2017-07-05 11:24:45 -07:00
define(["apphost","connectionManager","listViewStyle","emby-linkbutton"],function(appHost,connectionManager){"use strict";return function(view,params){view.querySelector(".btnLogout").addEventListener("click",function(){Dashboard.logout()}),view.addEventListener("viewshow",function(){var page=this,userId=params.userId||Dashboard.getCurrentUserId();page.querySelector(".lnkDisplayPreferences").setAttribute("href","mypreferencesdisplay.html?userId="+userId),page.querySelector(".lnkLanguagePreferences").setAttribute("href","mypreferenceslanguages.html?userId="+userId),page.querySelector(".lnkSubtitleSettings").setAttribute("href","mypreferencessubtitles.html?userId="+userId),page.querySelector(".lnkHomeScreenPreferences").setAttribute("href","mypreferenceshome.html?userId="+userId),page.querySelector(".lnkMyProfile").setAttribute("href","myprofile.html?userId="+userId),page.querySelector(".lnkSync").setAttribute("href","mysyncsettings.html?userId="+userId),page.querySelector(".lnkCameraUpload").setAttribute("href","camerauploadsettings.html?userId="+userId),appHost.supports("cameraupload")?page.querySelector(".lnkCameraUpload").classList.remove("hide"):page.querySelector(".lnkCameraUpload").classList.add("hide"),appHost.supports("sync")?page.querySelector(".lnkSync").classList.remove("hide"):page.querySelector(".lnkSync").classList.add("hide"),Dashboard.getCurrentUser().then(function(user){var headerUser=page.querySelector(".headerUser");headerUser.innerHTML=user.Name,user.Policy.IsAdministrator?page.querySelector(".adminSection").classList.remove("hide"):page.querySelector(".adminSection").classList.add("hide"),user.EnableAutoLogin&&connectionManager.getSavedServers().length<2?view.querySelector(".btnLogout").classList.add("hide"):view.querySelector(".btnLogout").classList.remove("hide")}),appHost.supports("multiserver")?page.querySelector(".selectServer").classList.remove("hide"):page.querySelector(".selectServer").classList.add("hide")})}});