1/* About-only progressive navigation; no network requests or form handling. */ 2(function () { 3 const button = document.querySelector('.av-menu'); 4 const nav = document.getElementById('primary-nav'); 5 if (!button || !nav) return; 6 document.documentElement.classList.add('av-enhanced'); 7 button.hidden = false; 8 function setOpen(open) { nav.classList.toggle('av-open', open); button.setAttribute('aria-expanded', String(open)); button.textContent = open ? 'Close menu' : 'Menu'; } 9 button.addEventListener('click', () => setOpen(button.getAttribute('aria-expanded') !== 'true')); 10 document.addEventListener('keydown', e => { if (e.key === 'Escape' && button.getAttribute('aria-expanded') === 'true') { setOpen(false); button.focus(); } }); 11 nav.addEventListener('click', e => { if (e.target.closest('a')) setOpen(false); }); 12 // Keep native playback as the no-JS fallback; avoid a buffering spinner on 13 // intentionally unloaded movies by showing an explicit opt-in control. 14 document.querySelectorAll('.av-film video').forEach(video => { 15 const frame = document.createElement('div'); 16 frame.className = 'av-film-frame'; 17 video.before(frame); 18 frame.append(video); 19 const play = document.createElement('button'); 20 play.type = 'button'; 21 play.className = 'av-film-play'; 22 play.setAttribute('aria-label', video.getAttribute('aria-label')); 23 play.innerHTML = '<span aria-hidden="true">â¶</span><span>Play film</span>'; 24 frame.append(play); 25 video.controls = false; 26 let attempt = 0; 27 let retry = false; 28 let startupTimer; 29 function showRetry() { 30 clearTimeout(startupTimer); 31 retry = true; 32 video.pause(); 33 video.controls = false; 34 play.hidden = false; 35 play.querySelector('span:last-child').textContent = 'Retry playback'; 36 play.focus(); 37 } 38 video.addEventListener('error', showRetry); 39 video.querySelector('source').addEventListener('error', showRetry); 40 play.addEventListener('click', async () => { 41 const currentAttempt = ++attempt; 42 const shouldReload = retry || video.error; 43 retry = false; 44 play.hidden = true; 45 video.controls = true; 46 // Some browsers leave play() pending after a failed <source> request. 47 startupTimer = setTimeout(() => { 48 if (currentAttempt === attempt && video.readyState < 2) showRetry(); 49 }, 12000); 50 try { 51 if (shouldReload) video.load(); 52 await video.play(); 53 if (currentAttempt === attempt) { clearTimeout(startupTimer); video.focus(); } 54 } catch (_) { 55 if (currentAttempt === attempt) showRetry(); 56 } 57 }); 58 }); 59})();
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.