1'use strict'; 2 3(() => { 4 const flashLayer = document.querySelector('[data-contact-lightning]'); 5 if (!flashLayer) return; 6 const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)'); 7 8 let timeout = 0; 9 let animation = null; 10 let seed = 0x5b19a4d3; 11 12 const random = () => { 13 seed = (Math.imul(seed, 1664525) + 1013904223) >>> 0; 14 return seed / 4294967296; 15 }; 16 17 const schedule = () => { 18 window.clearTimeout(timeout); 19 if (document.hidden || (reducedMotion.matches || document.documentElement.dataset.motion === 'reduce')) return; 20 timeout = window.setTimeout(runFlash, 6000 + random() * 14000); 21 }; 22 23 const runFlash = () => { 24 if (document.hidden || (reducedMotion.matches || document.documentElement.dataset.motion === 'reduce')) { 25 schedule(); 26 return; 27 } 28 29 const doubleFlash = random() > 0.58; 30 const strength = 0.065 + random() * 0.055; 31 const keyframes = doubleFlash 32 ? [ 33 { opacity: 0, offset: 0 }, 34 { opacity: strength * 0.72, offset: 0.1 }, 35 { opacity: strength * 0.08, offset: 0.25 }, 36 { opacity: strength, offset: 0.46 }, 37 { opacity: strength * 0.14, offset: 0.67 }, 38 { opacity: 0, offset: 1 }, 39 ] 40 : [ 41 { opacity: 0, offset: 0 }, 42 { opacity: strength, offset: 0.18 }, 43 { opacity: strength * 0.2, offset: 0.48 }, 44 { opacity: 0, offset: 1 }, 45 ]; 46 47 animation?.cancel(); 48 animation = flashLayer.animate(keyframes, { 49 duration: doubleFlash ? 760 + random() * 420 : 520 + random() * 360, 50 easing: 'linear', 51 fill: 'none', 52 }); 53 animation.addEventListener('finish', schedule, { once: true }); 54 animation.addEventListener('cancel', schedule, { once: true }); 55 }; 56 57 const reset = () => { 58 window.clearTimeout(timeout); 59 animation?.cancel(); 60 animation = null; 61 flashLayer.style.opacity = '0'; 62 schedule(); 63 }; 64 65 document.addEventListener('visibilitychange', reset); 66 reducedMotion.addEventListener('change', reset); 67 window.addEventListener('site-motion-change', reset); 68 schedule(); 69})();
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.