|
|
@ -19157,11 +19157,11 @@ const getOffset = (el) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return { top: y, left: x };
|
|
|
|
return { top: y, left: x };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const getDetailsBottom = (seasonContainers, episodeContainers) => {
|
|
|
|
const getDetailsBottom = (seasonContainers, episodeContainers, activeElem) => {
|
|
|
|
const lastSeasonContainer = seasonContainers[seasonContainers.length - 1];
|
|
|
|
const lastSeasonContainer = seasonContainers[seasonContainers.length - 1];
|
|
|
|
const lastEpisodeContainer = episodeContainers[episodeContainers.length - 1];
|
|
|
|
const lastEpisodeContainer = episodeContainers[episodeContainers.length - 1];
|
|
|
|
let detailBottom = false;
|
|
|
|
let detailBottom = false;
|
|
|
|
if (seasonContainers.length > 0 && parseInt(lastSeasonContainer.style.top, 10) > 0) {
|
|
|
|
if (seasonContainers.length > 0 && parseInt(activeElem.style.top, 10) > 0) {
|
|
|
|
detailBottom = getHeight(lastSeasonContainer) + parseInt(getOffset(lastSeasonContainer).top, 10) + 10;
|
|
|
|
detailBottom = getHeight(lastSeasonContainer) + parseInt(getOffset(lastSeasonContainer).top, 10) + 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (episodeContainers.length > 0) {
|
|
|
|
else if (episodeContainers.length > 0) {
|
|
|
@ -20040,20 +20040,21 @@ class PlexMeetsHomeAssistant extends HTMLElement {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (this.getTop() < parseInt(getOffset(activeElem).top, 10) - 70) {
|
|
|
|
const detailTop = parseInt(getOffset(activeElem).top, 10) - 70;
|
|
|
|
|
|
|
|
const detailBottom = getDetailsBottom(seasonContainers, episodeContainers, activeElem);
|
|
|
|
|
|
|
|
if (this.getTop() < detailTop) {
|
|
|
|
window.scroll({
|
|
|
|
window.scroll({
|
|
|
|
top: getOffset(activeElem).top - 70
|
|
|
|
top: detailTop
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else if (detailBottom &&
|
|
|
|
const detailBottom = getDetailsBottom(seasonContainers, episodeContainers);
|
|
|
|
window.innerHeight < detailBottom - detailTop &&
|
|
|
|
if (detailBottom && this.getTop() + window.innerHeight > detailBottom) {
|
|
|
|
this.getTop() + window.innerHeight > detailBottom) {
|
|
|
|
window.scroll({
|
|
|
|
window.scroll({
|
|
|
|
top: detailBottom - window.innerHeight
|
|
|
|
top: detailBottom - window.innerHeight
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.renderNewElementsIfNeeded();
|
|
|
|
this.renderNewElementsIfNeeded();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
window.addEventListener('resize', () => {
|
|
|
|
window.addEventListener('resize', () => {
|
|
|
|