Skibidi Game Hub 🥀🙏 — No Cap 🔥
`, }, { id: "tetris", title: "Tetris", description: "Classic Tetris. Use arrow keys to move, rotate blocks. Built with vanilla JS. Skibidi nostalgia overload.", code: ` Tetris
`, }, { id: "2048", title: "2048", description: "Slide and merge tiles to reach 2048. Vanilla JS vibes, no cap. Skibidi addicting AF.", code: ` 2048
Score: 0
` } ]; const homeSection = document.getElementById("home"); const gamePage = document.getElementById("game-page"); const gameFrame = document.getElementById("game-frame"); const gameDescription = document.getElementById("game-description"); const navHomeBtn = document.getElementById("nav-home-btn"); const searchBar = document.getElementById("search-bar"); // Inject game cards function renderGameCards(filter=""){ homeSection.innerHTML = ""; const filteredGames = games.filter(g => g.title.toLowerCase().includes(filter.toLowerCase())); if(filteredGames.length === 0){ homeSection.innerHTML = `

No skibidi games found fr 😤

`; return; } filteredGames.forEach(game => { const card = document.createElement("div"); card.classList.add("game-card"); card.setAttribute("data-id", game.id); card.innerHTML = `
${game.title}
`; card.onclick = () => loadGame(game.id); homeSection.appendChild(card); }); } // Load game in iframe function loadGame(id){ const game = games.find(g => g.id === id); if(!game) return; // Show nav home button & game page, hide home navHomeBtn.style.display = "block"; gamePage.style.display = "flex"; homeSection.style.display = "none"; searchBar.style.display = "none"; // Set description gameDescription.textContent = game.description; // Create blob URL from game code const blob = new Blob([game.code], {type: 'text/html'}); const url = URL.createObjectURL(blob); gameFrame.src = url; } // Return home view navHomeBtn.onclick = () => { navHomeBtn.style.display = "none"; gamePage.style.display = "none"; homeSection.style.display = "flex"; searchBar.style.display = "block"; // Revoke blob URL to free memory if(gameFrame.src.startsWith("blob:")){ URL.revokeObjectURL(gameFrame.src); } gameFrame.src = ""; } // Search filter searchBar.oninput = e => { renderGameCards(e.target.value); } renderGameCards();