document.addEventListener('DOMContentLoaded', function() { const gamesText = document.querySelector('.games-text'); window.addEventListener('scroll', () => { const scrollPosition = window.scrollY; if (scrollPosition > 100) { gamesText.style.opacity = '0'; } else { gamesText.style.opacity = '0.8'; } }); const searchBar = document.querySelector('input'); const gamesGrid = document.getElementById('gamesGrid'); let allGames = []; fetch('https://deez.com.de/') .then(response => response.text()) .then(data => { let tempContainer = document.createElement('div'); tempContainer.innerHTML = data; const gameLinks = tempContainer.getElementsByTagName('a'); allGames = Array.from(gameLinks).map((link, index) => { let img = link.querySelector('img'); return { id: link.id, url: link.getAttribute('data-url'), image: img?.src || '', title: img?.getAttribute('title') || img?.alt || `Game ${index + 1}` }; }); renderGames(allGames, gamesGrid); }) .catch(error => { console.error('Error loading games:', error); gamesGrid.innerHTML = '

Error loading games. Please try again later.

'; }); function renderGames(games, loc) { loc.innerHTML = games.map((game, index) => `
${game.title}
${game.title}
`).join(''); } searchBar.addEventListener('input', (e) => { const searchTerm = e.target.value.toLowerCase(); const filteredGames = allGames.filter(game => game.title.toLowerCase().includes(searchTerm) ); renderGames(filteredGames, gamesGrid); }); function handleGamesClick(e) { const card = e.target.closest('.game-card'); if (!card) return; const url = card.dataset.url; console.log(card.dataset.id); openGame(card.dataset.id); } gamesGrid.addEventListener('click', (e) => { handleGamesClick(e); }); function detectHTTP(url) { if (!/^https?:\/\//i.test(url)) { url = 'https://' + url; } return url; } function openGame(id) { window.top.location.href = `/g?id=${id}`; } function oldOpenGame(url) { var url = detectHTTP(url); var win = window.open(); var iframe = win.document.createElement('iframe'); var pTitle = 'IXL | Dashboard'; var pFavicon = 'https://www.ixl.com/favicon.ico'; var faviconLinkElement = win.document.createElement("link"); console.log("Opening: " + url + " with title: '" + pTitle + "' and favicon: " + pFavicon); faviconLinkElement.rel = "icon"; faviconLinkElement.href = pFavicon; faviconLinkElement.type = "image/x-icon"; win.document.head.appendChild(faviconLinkElement); iframe.style.width = "100%"; iframe.style.height = "100%"; iframe.style.border = "none"; iframe.src = url; win.document.body.appendChild(iframe); win.document.title = pTitle; win.document.body.style.margin = "0px"; } });