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