2017-09-14 23:31:28 -07:00
|
|
|
define(["layoutManager","connectionManager","events","viewManager","libraryBrowser","appRouter","apphost","playbackManager","browser","globalize","paper-icon-button-light","material-icons","scrollStyles","flexStyles"],function(layoutManager,connectionManager,events,viewManager,libraryBrowser,appRouter,appHost,playbackManager,browser,globalize){"use strict";function getCurrentApiClient(){return currentUser&¤tUser.localUser?connectionManager.getApiClient(currentUser.localUser.ServerId):connectionManager.currentApiClient()}function renderHeader(){var html="";html+='<div class="flex align-items-center flex-grow headerTop">',html+='<div class="headerLeft">';var backIcon=browser.safari?"chevron_left":"";html+='<button type="button" is="paper-icon-button-light" class="headerButton headerButtonLeft headerBackButton hide"><i class="md-icon">'+backIcon+"</i></button>",html+='<button type="button" is="paper-icon-button-light" class="headerButton headerHomeButton hide barsMenuButton headerButtonLeft"><i class="md-icon"></i></button>',html+='<button type="button" is="paper-icon-button-light" class="headerButton mainDrawerButton barsMenuButton headerButtonLeft hide"><i class="md-icon"></i></button>',html+='<h3 class="pageTitle"></h3>',html+="</div>",html+='<div class="headerRight">',html+='<span class="headerSelectedPlayer"></span>',html+='<button is="paper-icon-button-light" class="headerCastButton castButton headerButton headerButtonRight hide"><i class="md-icon"></i></button>',html+='<button type="button" is="paper-icon-button-light" class="headerButton headerButtonRight headerSearchButton hide"><i class="md-icon"></i></button>',html+='<button is="paper-icon-button-light" class="headerButton headerButtonRight btnNotifications"><div class="btnNotificationsInner hide">0</div><i class="md-icon"></i></button>',html+='<button is="paper-icon-button-light" class="headerButton headerButtonRight headerUserButton hide"><i class="md-icon"></i></button>',layoutManager.mobile||(html+='<button is="paper-icon-button-light" class="headerButton headerButtonRight headerSettingsButton hide" onclick="return LibraryMenu.onSettingsClicked(event);"><i class="md-icon"></i></button>'),html+="</div>",html+="</div>",html+='<div class="headerTabs sectionTabs hide">',html+="</div>",skinHeader.classList.add("skinHeader-withBackground"),skinHeader.innerHTML=html,headerHomeButton=skinHeader.querySelector(".headerHomeButton"),headerUserButton=skinHeader.querySelector(".headerUserButton"),headerSettingsButton=skinHeader.querySelector(".headerSettingsButton"),headerCastButton=skinHeader.querySelector(".headerCastButton"),headerSearchButton=skinHeader.querySelector(".headerSearchButton"),browser.chrome||skinHeader.classList.add("skinHeader-blurred"),lazyLoadViewMenuBarImages(),bindMenuEvents()}function lazyLoadViewMenuBarImages(){require(["imageLoader"],function(imageLoader){imageLoader.lazyChildren(skinHeader)})}function onBackClick(){appRouter.back()}function updateUserInHeader(user){var hasImage;if(user&&user.name){if(user.imageUrl){var userButtonHeight=26,url=user.imageUrl;user.supportsImageParams&&(url+="&height="+Math.round(userButtonHeight*Math.max(window.devicePixelRatio||1,2))),updateHeaderUserButton(url),hasImage=!0}headerUserButton.classList.remove("hide")}else headerUserButton.classList.add("hide");hasImage||updateHeaderUserButton(null),user&&user.localUser?(headerHomeButton&&headerHomeButton.classList.remove("hide"),headerSearchButton&&headerSearchButton.classList.remove("hide"),headerSettingsButton&&(user.localUser.Policy.IsAdministrator?headerSettingsButton.classList.remove("hide"):headerSettingsButton.classList.add("hide")),headerCastButton.classList.remove("hide")):(headerHomeButton.classList.add("hide"),headerCastButton.classList.add("hide"),headerSearchButton&&headerSearchButton.classList.add("hide"),headerSettingsButton&&headerSettingsButton.classList.add("hide")),requiresUserRefresh=!1}function updateHeaderUserButton(src){src?(headerUserButton.classList.add("headerUserButtonRo
|