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