This commit is contained in:
Dmitry Lyzo 2021-04-26 00:17:48 +03:00
parent 04c4e03ac1
commit 1eef924b8d

View File

@ -78,14 +78,10 @@ import '../elements/emby-button/emby-button';
}
export function setTabs(view, selectedIndex, getTabsFn, getTabContainersFn, onBeforeTabChange, onTabChange, setSelectedIndex) {
if (!view) {
if (tabOwnerView) {
if (!headerTabsContainer) {
headerTabsContainer = queryScope.querySelector('.headerTabs');
}
ensureElements();
if (!view) {
if (tabOwnerView) {
document.body.classList.remove('withSectionTabs');
headerTabsContainer.innerHTML = '';
@ -99,8 +95,6 @@ import '../elements/emby-button/emby-button';
};
}
ensureElements();
const tabsContainerElem = headerTabsContainer;
if (!tabOwnerView) {
@ -178,18 +172,13 @@ import '../elements/emby-button/emby-button';
return {
tabsContainer: tabsContainerElem,
tabs: tabsContainerElem.querySelector('[is="emby-tabs"]'),
tabs: tabsElem,
replaced: true
};
}
if (!tabsElem) {
tabsElem = tabsContainerElem.querySelector('[is="emby-tabs"]');
}
tabsElem.selectedIndex(selectedIndex);
tabOwnerView = view;
return {
tabsContainer: tabsContainerElem,
tabs: tabsElem,
@ -198,12 +187,6 @@ import '../elements/emby-button/emby-button';
}
export function selectedTabIndex(index) {
const tabsContainerElem = headerTabsContainer;
if (!tabsElem) {
tabsElem = tabsContainerElem.querySelector('[is="emby-tabs"]');
}
if (index != null) {
tabsElem.selectedIndex(index);
} else {