1(function () { 2 var reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches; 3 4 document.querySelectorAll('.mcg-marquee').forEach(function (track) { 5 var imgs = Array.prototype.slice.call(track.querySelectorAll('img')); 6 function ready() { 7 void track.offsetWidth; 8 track.classList.add('is-ready'); 9 } 10 if (!imgs.length) { 11 ready(); 12 return; 13 } 14 Promise.all( 15 imgs.map(function (img) { 16 if (typeof img.decode === 'function') { 17 return img.decode().catch(function () {}); 18 } 19 return new Promise(function (resolve) { 20 if (img.complete) resolve(); 21 else { 22 img.addEventListener('load', resolve, { once: true }); 23 img.addEventListener('error', resolve, { once: true }); 24 } 25 }); 26 }) 27 ).then(ready); 28 }); 29 30 document.querySelectorAll('[data-mcg-crossfade]').forEach(function (root) { 31 var stage = root.querySelector('.mcg-crossfade') || root; 32 var slides = Array.prototype.slice.call(root.querySelectorAll('.mcg-crossfade-item')); 33 var bar = root.querySelector('.mcg-crossfade-progress-bar'); 34 if (!slides.length) return; 35 36 // Reduced motion: CSS stacks every quote; don't rotate or lock height. 37 if (reduce) return; 38 39 function lockHeight() { 40 var max = 0; 41 slides.forEach(function (slide) { 42 max = Math.max(max, slide.offsetHeight); 43 }); 44 if (max) stage.style.height = max + 'px'; 45 } 46 47 slides[0].classList.add('is-on'); 48 lockHeight(); 49 window.addEventListener('resize', lockHeight); 50 if (document.fonts && document.fonts.ready) { 51 document.fonts.ready.then(lockHeight); 52 } 53 slides.forEach(function (slide) { 54 slide.querySelectorAll('img').forEach(function (img) { 55 if (!img.complete) img.addEventListener('load', lockHeight, { once: true }); 56 }); 57 }); 58 59 var DURATION = 4500; 60 var j = 0; 61 var timer = null; 62 var deadline = 0; 63 var remaining = DURATION; 64 65 function restartBar() { 66 if (!bar) return; 67 bar.classList.remove('is-running'); 68 void bar.offsetWidth; 69 bar.classList.add('is-running'); 70 } 71 72 function advance() { 73 slides[j].classList.remove('is-on'); 74 j = (j + 1) % slides.length; 75 slides[j].classList.add('is-on'); 76 } 77 78 function schedule(ms) { 79 clearTimeout(timer); 80 deadline = Date.now() + ms; 81 timer = setTimeout(function () { 82 advance(); 83 remaining = DURATION; 84 restartBar(); 85 schedule(DURATION); 86 }, ms); 87 } 88 89 root.addEventListener('mouseenter', function () { 90 remaining = Math.max(0, deadline - Date.now()); 91 clearTimeout(timer); 92 root.classList.add('is-paused'); 93 }); 94 root.addEventListener('mouseleave', function () { 95 root.classList.remove('is-paused'); 96 schedule(remaining || DURATION); 97 }); 98 99 restartBar(); 100 schedule(DURATION); 101 }); 102})();
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.