1(function() { 2 const DISCLAIMER_KEY = 'wxli_disclaimer_accepted'; 3 const DISCLAIMER_EXPIRY = 24 * 60 * 60 * 1000; // 24 hours in milliseconds 4 const modal = document.getElementById('age-disclaimer-modal'); 5 const acceptBtn = document.getElementById('disclaimer-accept'); 6 const cancelBtn = document.getElementById('disclaimer-cancel'); 7 8 // If modal doesn't exist on this page, exit silently 9 if (!modal) return; 10 11 // Check if disclaimer was already accepted and not expired 12 function isDisclaimerValid() { 13 const acceptedTime = localStorage.getItem(DISCLAIMER_KEY); 14 if (!acceptedTime) return false; 15 16 const elapsed = Date.now() - parseInt(acceptedTime, 10); 17 return elapsed < DISCLAIMER_EXPIRY; 18 } 19 20 if (isDisclaimerValid()) { 21 modal.style.display = 'none'; 22 document.body.classList.remove('disclaimer-active'); 23 return; 24 } 25 26 // Clear expired disclaimer 27 localStorage.removeItem(DISCLAIMER_KEY); 28 29 // Show disclaimer 30 modal.style.display = 'flex'; 31 document.body.classList.add('disclaimer-active'); 32 33 // Accept button handler 34 acceptBtn.addEventListener('click', function() { 35 localStorage.setItem(DISCLAIMER_KEY, Date.now().toString()); 36 modal.classList.add('disclaimer-closing'); 37 setTimeout(function() { 38 modal.style.display = 'none'; 39 document.body.classList.remove('disclaimer-active'); 40 41 // Trigger lazy video loading after disclaimer closes 42 loadLazyVideos(); 43 }, 400); 44 }); 45 46 // Load lazy videos: activate data-src on all <source> elements (WebM + MP4) 47 function loadLazyVideos() { 48 var lazyVideos = document.querySelectorAll('video.lazy-video:not(.loaded), #banner-video:not(.loaded)'); 49 lazyVideos.forEach(function(video) { 50 var sources = video.querySelectorAll('source[data-src]'); 51 if (sources.length > 0) { 52 sources.forEach(function(source) { 53 source.src = source.dataset.src; 54 source.removeAttribute('data-src'); 55 }); 56 video.load(); 57 video.classList.add('loaded'); 58 if (video.hasAttribute('autoplay') && video.hasAttribute('muted')) { 59 video.play().catch(function() {}); 60 } 61 } 62 }); 63 } 64 65 // Cancel button handler 66 cancelBtn.addEventListener('click', function() { 67 window.location.href = 'https://www.google.com'; 68 }); 69 70 // Prevent closing by clicking outside 71 modal.addEventListener('click', function(e) { 72 if (e.target === modal || e.target.classList.contains('disclaimer-backdrop')) { 73 // Do nothing - force user to make a choice 74 } 75 }); 76 77 // Prevent escape key from closing 78 document.addEventListener('keydown', function(e) { 79 if (e.key === 'Escape' && modal.style.display !== 'none') { 80 e.preventDefault(); 81 } 82 }); 83 })();
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.