2017-05-03 14:54:29 -07:00
|
|
|
define(["layoutManager","viewManager","libraryBrowser","embyRouter","playbackManager","browser","paper-icon-button-light","material-icons","scrollStyles","flexStyles"],function(layoutManager,viewManager,libraryBrowser,embyRouter,playbackManager,browser){"use strict";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 mainDrawerButton barsMenuButton headerButtonLeft hide"><i class="md-icon">menu</i></button>',html+='<button type="button" is="paper-icon-button-light" class="headerButton headerAppsButton barsMenuButton headerButtonLeft"><i class="md-icon">home</i></button>',html+='<h3 class="libraryMenuButtonText headerButton"></h3>',html+="</div>",html+='<div class="headerRight">',html+='<span class="headerSelectedPlayer"></span>',html+='<button is="paper-icon-button-light" class="btnCast headerButton-btnCast headerButton headerButtonRight hide autoSize"><i class="md-icon">cast</i></button>',html+='<button type="button" is="paper-icon-button-light" class="headerButton headerButtonRight headerSearchButton hide autoSize"><i class="md-icon">search</i></button>',html+='<button is="paper-icon-button-light" class="headerButton headerButtonRight headerVoiceButton hide autoSize"><i class="md-icon">mic</i></button>',html+='<button is="paper-icon-button-light" class="headerButton headerButtonRight btnNotifications"><div class="btnNotificationsInner">0</div></button>',html+='<button is="paper-icon-button-light" class="headerButton headerButtonRight headerUserButton autoSize"><i class="md-icon">person</i></button>',browser.mobile||(html+='<button is="paper-icon-button-light" class="headerButton headerButtonRight dashboardEntryHeaderButton autoSize" onclick="return LibraryMenu.onSettingsClicked(event);"><i class="md-icon">settings</i></button>'),html+="</div>",html+="</div>",html+='<div class="headerTabs hide">',html+="</div>",skinHeader.innerHTML=html,browser.chrome||skinHeader.classList.add("skinHeader-blurred"),lazyLoadViewMenuBarImages(),bindMenuEvents()}function lazyLoadViewMenuBarImages(){require(["imageLoader"],function(imageLoader){imageLoader.lazyChildren(skinHeader)})}function onBackClick(){embyRouter.back()}function updateUserInHeader(user){var hasImage,headerUserButton=skinHeader.querySelector(".headerUserButton");if(user&&user.name&&user.imageUrl){var userButtonHeight=26,url=user.imageUrl;user.supportsImageParams&&(url+="&height="+Math.round(userButtonHeight*Math.max(window.devicePixelRatio||1,2))),headerUserButton&&(updateHeaderUserButton(headerUserButton,url),hasImage=!0)}headerUserButton&&!hasImage&&updateHeaderUserButton(headerUserButton,null),user&&updateLocalUser(user.localUser),requiresUserRefresh=!1}function updateHeaderUserButton(headerUserButton,src){src?(headerUserButton.classList.add("headerUserButtonRound"),headerUserButton.classList.remove("autoSize"),headerUserButton.innerHTML='<img src="'+src+'" />'):(headerUserButton.classList.remove("headerUserButtonRound"),headerUserButton.classList.add("autoSize"),headerUserButton.innerHTML='<i class="md-icon">person</i>')}function updateLocalUser(user){var headerSearchButton=skinHeader.querySelector(".headerSearchButton"),btnCast=skinHeader.querySelector(".btnCast"),dashboardEntryHeaderButton=skinHeader.querySelector(".dashboardEntryHeaderButton");user?(btnCast.classList.remove("hide"),headerSearchButton&&headerSearchButton.classList.remove("hide"),dashboardEntryHeaderButton&&(user.Policy.IsAdministrator?dashboardEntryHeaderButton.classList.remove("hide"):dashboardEntryHeaderButton.classList.add("hide")),require(["apphost"],function(apphost){apphost.supports("voiceinput")?skinHeader.querySelector(".headerVoiceButton").classList.add("hide"):skinHeader.querySelector(".headerVoiceButton").classList.
|