1/* Play-gate, refresh, and fullscreen for the game embed iframe. 2 Expects #embed-frame (with data-src, not src â the game only loads 3 once Play is clicked), #playGate/#playGateBtn, #refresh-btn, 4 #fullscreen-btn on the page. */ 5 6// Homepage "Continue playing" â same storage key/shape as 7// assets/jsload/recentlyplayed.js. Kept inline (rather than requiring 8// that script here too) so every already-generated gamepage records 9// correctly without an extra <script> tag. 10function recordContinuePlaying(slug) { 11 try { 12 const STORAGE_KEY = 'gbkRecentlyPlayed'; 13 const MAX_ITEMS = 12; 14 const nameEl = document.querySelector('.website-name'); 15 const thumbEl = document.querySelector('.game-thumb'); 16 const name = nameEl ? nameEl.textContent.trim() : slug; 17 const image = thumbEl ? thumbEl.src : ''; 18 const url = '/g/' + slug + '/'; 19 if (!image) return; 20 21 let list = JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]'); 22 if (!Array.isArray(list)) list = []; 23 list = list.filter(function(item) { return item.url !== url; }); 24 list.unshift({ name: name, image: image, url: url }); 25 list = list.slice(0, MAX_ITEMS); 26 localStorage.setItem(STORAGE_KEY, JSON.stringify(list)); 27 } catch (err) {} 28} 29 30document.addEventListener('DOMContentLoaded', function() { 31 const iframe = document.getElementById('embed-frame'); 32 const playGate = document.getElementById('playGate'); 33 const playGateBtn = document.getElementById('playGateBtn'); 34 const fullscreenBtn = document.getElementById('fullscreen-btn'); 35 const refreshBtn = document.getElementById('refresh-btn'); 36 37 function startGame() { 38 if (!iframe || iframe.src) return; // already playing 39 iframe.src = iframe.dataset.src; 40 if (playGate) playGate.style.display = 'none'; 41 42 const slug = document.querySelector('.game-stats')?.dataset.game; 43 44 // Play count â see gamevotes.js, which exposes this once it's 45 // loaded. Guarded in case script order/load ever changes. 46 if (slug && window.GBKInteractions) { 47 window.GBKInteractions.recordPlay(slug); 48 } 49 50 if (slug) recordContinuePlaying(slug); 51 } 52 53 if (playGateBtn) { 54 playGateBtn.addEventListener('click', startGame); 55 } 56 57 if (fullscreenBtn && iframe) { 58 fullscreenBtn.addEventListener('click', function() { 59 startGame(); 60 if (iframe.requestFullscreen) { 61 iframe.requestFullscreen(); 62 } else if (iframe.mozRequestFullScreen) { 63 iframe.mozRequestFullScreen(); 64 } else if (iframe.webkitRequestFullscreen) { 65 iframe.webkitRequestFullscreen(); 66 } else if (iframe.msRequestFullscreen) { 67 iframe.msRequestFullscreen(); 68 } 69 }); 70 } 71 72 if (refreshBtn && iframe) { 73 refreshBtn.addEventListener('click', function() {
74 if (iframe.src) iframe.src = iframe.src; 75 }); 76 } 77});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.