forked from sent/waves
❕❕❕❕
This commit is contained in:
parent
9479504cc9
commit
55b199ac03
|
@ -11,11 +11,11 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
displayGames(gamesData);
|
displayGames(gamesData);
|
||||||
searchInput.addEventListener('input', function() {
|
searchInput.addEventListener('input', function() {
|
||||||
const query = searchInput.value.toLowerCase();
|
const query = searchInput.value.toLowerCase();
|
||||||
const filteredGames = gamesData.filter(game => {
|
const filtered = gamesData.filter(game => {
|
||||||
const name = game.name ? game.name.toLowerCase() : '';
|
const name = (game.name || '').toLowerCase();
|
||||||
return name.includes(query);
|
return name.includes(query);
|
||||||
});
|
});
|
||||||
displayGames(filteredGames);
|
displayGames(filtered);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(err => console.error('Error loading games data:', err));
|
.catch(err => console.error('Error loading games data:', err));
|
||||||
|
@ -34,7 +34,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||||
<h2>${game.name}</h2>
|
<h2>${game.name}</h2>
|
||||||
`;
|
`;
|
||||||
card.addEventListener('click', function() {
|
card.addEventListener('click', function() {
|
||||||
const url = `${location.origin}/assets/g/${game.directory}`;
|
const url = `/assets/g/${game.directory}`;
|
||||||
window.handleSearch(url);
|
window.handleSearch(url);
|
||||||
});
|
});
|
||||||
grid.appendChild(card);
|
grid.appendChild(card);
|
||||||
|
|
|
@ -25,24 +25,11 @@ elements.backIcon.addEventListener('click', handleBack);
|
||||||
elements.forwardIcon.addEventListener('click', handleForward);
|
elements.forwardIcon.addEventListener('click', handleForward);
|
||||||
|
|
||||||
function showLoadingScreen() {
|
function showLoadingScreen() {
|
||||||
const loadingScreen = document.querySelector('.loading-screen');
|
|
||||||
if (!loadingScreen) return;
|
|
||||||
if (typeof NProgress !== 'undefined') NProgress.start();
|
if (typeof NProgress !== 'undefined') NProgress.start();
|
||||||
loadingScreen.style.display = 'flex';
|
|
||||||
setTimeout(() => loadingScreen.style.opacity = 1, 10);
|
|
||||||
clearTimeout(loadingFallbackTimeout);
|
|
||||||
loadingFallbackTimeout = setTimeout(hideLoadingScreen, 10000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideLoadingScreen() {
|
function hideLoadingScreen() {
|
||||||
const loadingScreen = document.querySelector('.loading-screen');
|
|
||||||
if (!loadingScreen) return;
|
|
||||||
loadingScreen.style.opacity = 0;
|
|
||||||
setTimeout(() => {
|
|
||||||
loadingScreen.style.display = 'none';
|
|
||||||
if (typeof NProgress !== 'undefined') NProgress.done();
|
if (typeof NProgress !== 'undefined') NProgress.done();
|
||||||
}, 500);
|
|
||||||
clearTimeout(loadingFallbackTimeout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRefresh() {
|
function handleRefresh() {
|
||||||
|
@ -159,6 +146,8 @@ function handleIframeNavigation(url) {
|
||||||
if (url && normalizeUrl(url) !== normalizeUrl(historyStack[currentIndex] || '')) {
|
if (url && normalizeUrl(url) !== normalizeUrl(historyStack[currentIndex] || '')) {
|
||||||
showLoadingScreen();
|
showLoadingScreen();
|
||||||
addToHistory(url);
|
addToHistory(url);
|
||||||
|
} else {
|
||||||
|
hideLoadingScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +159,9 @@ elements.iframe.addEventListener('load', () => {
|
||||||
} else {
|
} else {
|
||||||
handleIframeNavigation(elements.iframe.contentWindow.location.href);
|
handleIframeNavigation(elements.iframe.contentWindow.location.href);
|
||||||
}
|
}
|
||||||
} catch (error) {} finally {
|
} catch (error) {
|
||||||
|
console.error('Error during iframe load handling:', error);
|
||||||
|
} finally {
|
||||||
hideLoadingScreen();
|
hideLoadingScreen();
|
||||||
}
|
}
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user