freegames.today
freegames .today

Achievement Unlocked!
Badge
Description

Wedding

// Alpine.js Live Search component function liveSearch() { return { query: '', results: [], recentGames: [], showResults: false, loading: false, init() { try { this.recentGames = JSON.parse(localStorage.getItem('myarcade_history') || '[]').slice(0, 5); } catch (e) { this.recentGames = []; } }, clearRecent() { localStorage.removeItem('myarcade_history'); this.recentGames = []; }, search() { if (this.query.length < 2) { this.showResults = false; this.results = []; return; } this.loading = true; this.showResults = true; fetch('https://freegames.today/wp-admin/admin-ajax.php?action=live_search_games&q=' + encodeURIComponent(this.query)) .then(r => r.json()) .then(data => { this.results = data.success ? data.data.results : []; this.loading = false; }) .catch(() => { this.loading = false; }); } }; }