2017-06-05 23:12:18 -07:00
|
|
|
define(["appFooter-shared","emby-tabs","emby-button"],function(appFooter){"use strict";function setTabs(view,selectedIndex,builder){if(!view)return void(tabOwnerView&&(headerTabsContainer||(headerTabsContainer=queryScope.querySelector(".headerTabs")),document.body.classList.remove("withSectionTabs"),headerTabsContainer.innerHTML="",headerTabsContainer.classList.add("hide"),tabOwnerView=null));if(headerTabsContainer||(headerTabsContainer=queryScope.querySelector(".headerTabs")),tabOwnerView||headerTabsContainer.classList.remove("hide"),tabOwnerView!==view){var index=0,indexAttribute=null==selectedIndex?"":' data-index="'+selectedIndex+'"',tabsHtml='<div is="emby-tabs"'+indexAttribute+' class="tabs-viewmenubar"><div class="emby-tabs-slider" style="white-space:nowrap;">'+builder().map(function(t){var tabClass="emby-tab-button";t.enabled===!1&&(tabClass+=" hide");var tabHtml;return tabHtml=t.href?'<button onclick="Dashboard.navigate(this.getAttribute(\'data-href\'));" type="button" data-href="'+t.href+'" is="emby-button" class="'+tabClass+'" data-index="'+index+'"><div class="emby-button-foreground">'+t.name+"</div></button>":'<button type="button" is="emby-button" class="'+tabClass+'" data-index="'+index+'"><div class="emby-button-foreground">'+t.name+"</div></button>",index++,tabHtml}).join("")+"</div></div>";return headerTabsContainer.innerHTML=tabsHtml,document.body.classList.add("withSectionTabs"),tabOwnerView=view,!0}return headerTabsContainer.querySelector('[is="emby-tabs"]').selectedIndex(selectedIndex),tabOwnerView=view,!1}function getTabsElement(){return document.querySelector(".tabs-viewmenubar")}var tabOwnerView,headerTabsContainer,queryScope=document.querySelector(".skinHeader");return{setTabs:setTabs,getTabsElement:getTabsElement}});
|