fix showonotherpages
This commit is contained in:
@@ -665,6 +665,8 @@ const checkNavigation = () => {
|
||||
|
||||
// Check if parent is available and if the iframe is in an embedded environment
|
||||
if (!showOnOtherPages && window.parent && window.parent !== window) {
|
||||
const isHomePage = url => url.includes('/home') || url.endsWith('/web/') || url.endsWith('/web/index.html');
|
||||
if (isHomePage(newLocation)) {
|
||||
const homeTab = window.parent.document.getElementById('homeTab');
|
||||
const isHomeTabActive = homeTab && homeTab.classList.contains('is-active');
|
||||
|
||||
@@ -673,14 +675,16 @@ const checkNavigation = () => {
|
||||
console.log("HomeTab is active, reactivating slideshow");
|
||||
isHomePageActive = true;
|
||||
window.parent.document.querySelector('.featurediframe').style.display = 'block';
|
||||
cleanup();
|
||||
//cleanup();
|
||||
fetchRandomMovie();
|
||||
} else if (!isHomeTabActive && isHomePageActive) {
|
||||
console.log("Leaving HomeTab, cleaning up slideshow");
|
||||
isHomePageActive = false;
|
||||
window.parent.document.querySelector('.featurediframe').style.display = 'none';
|
||||
stopBackgroundVideo();
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.error("Spotlight iframe is not in an embedded environment, has a different domain or showOnOtherPages is set to true");
|
||||
}
|
||||
@@ -701,6 +705,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const isHomePage = url => url.includes('/home') || url.endsWith('/web/') || url.endsWith('/web/index.html');
|
||||
if (isHomePage(window.top.location.href)) {
|
||||
isHomePageActive = true;
|
||||
console.log("Homepage detected, starting slideshow");
|
||||
readCustomList().then(list => {
|
||||
if (list) { movieList = list; currentMovieIndex = 0; }
|
||||
fetchRandomMovie();
|
||||
|
Reference in New Issue
Block a user