1'use strict'; 2const config = window.SITE_CONFIG; 3const menu = document.querySelector('.menu-toggle'); 4const navigation = document.getElementById('navigation'); 5function closeMenu() { navigation.classList.remove('open'); menu.setAttribute('aria-expanded', 'false'); } 6menu.addEventListener('click', () => { 7 const open = navigation.classList.toggle('open'); 8 menu.setAttribute('aria-expanded', String(open)); 9}); 10navigation.querySelectorAll('a').forEach(a => a.addEventListener('click', closeMenu)); 11document.addEventListener('keydown', event => { if (event.key === 'Escape') closeMenu(); }); 12 13// Both demo controls share one player. No iframe or provider request exists before a click. 14const mount = document.getElementById('iframe-mount'); 15if (mount) { 16 const feedback = document.getElementById('demo-feedback'); 17 const retry = document.getElementById('demo-retry'); 18 let iframe; 19 let timer; 20 function loadDemo() { 21 let url; 22 try { 23 url = new URL(config.demoUrl); 24 if (url.protocol !== 'https:') throw new Error('Invalid URL'); 25 } catch { 26 feedback.textContent = "La demo non è disponibile ora."; 27 return; 28 } 29 document.getElementById('game-player').scrollIntoView({behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'instant' : 'smooth', block: 'start'}); 30 if (iframe) return; 31 document.getElementById('demo-cover').hidden = true; 32 mount.hidden = false; 33 feedback.textContent = "Caricamento della demoâ¦"; 34 retry.hidden = true; 35 iframe = document.createElement('iframe'); 36 iframe.className = 'iframeGame'; 37 iframe.id = 'iframeGameDesktop'; 38 iframe.title = config.gameName + ' â demo'; 39 iframe.width = '100%'; 40 iframe.height = '100%'; 41 iframe.setAttribute('frameborder', '0'); 42 iframe.setAttribute('hspace', '0'); 43 iframe.setAttribute('vspace', '0'); 44 iframe.setAttribute('scrolling', 'none'); 45 iframe.allow = 'autoplay; fullscreen'; 46 iframe.allowFullscreen = true; 47 iframe.addEventListener('load', () => { 48 clearTimeout(timer); 49 feedback.textContent = "Se il gioco non compare, ricarica il lettore."; 50 retry.hidden = false; 51 }); 52 iframe.src = url.href; 53 mount.append(iframe); 54 timer = setTimeout(() => { 55 feedback.textContent = "Il caricamento richiede più tempo. Puoi riprovare."; 56 retry.hidden = false; 57 }, 20000); 58 } 59 document.querySelectorAll('[data-start-demo]').forEach(button => button.addEventListener('click', loadDemo)); 60 retry.addEventListener('click', () => { 61 clearTimeout(timer); 62 if (iframe) iframe.remove(); 63 iframe = null; 64 loadDemo(); 65 }); 66}
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.