refresh people on demand, when needed

This commit is contained in:
Luke Pulverenti 2016-08-14 17:29:35 -04:00
parent 93ebd18a5c
commit 5722b968dd
2 changed files with 21 additions and 38 deletions

View File

@ -197,6 +197,10 @@
function initSelectionBar(tabs) {
if (!browser.animate) {
return;
}
var contentScrollSlider = tabs.querySelector('.emby-tabs-slider');
if (!contentScrollSlider) {
@ -285,7 +289,7 @@
}
};
EmbyTabs.triggerTabChange = function (selected) {
EmbyTabs.triggerBeforeTabChange = function (selected) {
var tabs = this;
@ -294,6 +298,11 @@
selectedTabIndex: tabs.selectedIndex()
}
}));
};
EmbyTabs.triggerTabChange = function (selected) {
var tabs = this;
tabs.dispatchEvent(new CustomEvent("tabchange", {
detail: {

View File

@ -152,16 +152,22 @@
LibraryBrowser.configureSwipeTabs(ownerpage, tabs);
}
ownerpage.addEventListener('viewshow', LibraryBrowser.onTabbedpagebeforeshow);
tabs.addEventListener('beforetabchange', function(e) {
if (e.detail.previousIndex != null) {
panels[e.detail.previousIndex].classList.remove('is-active');
ownerpage.addEventListener('viewbeforeshow', function () {
if (tabs.triggerBeforeTabChange) {
tabs.triggerBeforeTabChange();
}
});
ownerpage.addEventListener('viewshow', function () {
tabs.triggerTabChange();
});
tabs.addEventListener('beforetabchange', function (e) {
if (e.detail.previousIndex != null) {
panels[e.detail.previousIndex].classList.remove('is-active');
}
var newPanel = panels[e.detail.selectedTabIndex];
if (e.detail.previousIndex != null && e.detail.previousIndex != e.detail.selectedTabIndex) {
@ -174,38 +180,6 @@
});
},
onTabbedpagebeforeshow: function (e) {
var page = e.target;
var delay = 0;
var pageTabsContainer = page.querySelector('.libraryViewNav');
if (!pageTabsContainer || !pageTabsContainer.triggerTabChange) {
delay = 300;
}
if (delay) {
setTimeout(function () {
LibraryBrowser.onTabbedpagebeforeshowInternal(page, e);
}, delay);
} else {
LibraryBrowser.onTabbedpagebeforeshowInternal(page, e);
}
},
onTabbedpagebeforeshowInternal: function (page, e) {
var pageTabsContainer = page.querySelector('.libraryViewNav');
// Go back to the first tab
if (!e.detail.isRestored) {
pageTabsContainer.selectedIndex(0);
return;
}
pageTabsContainer.triggerTabChange();
},
showTab: function (url, index) {
var afterNavigate = function () {