1(function ($) { 2 'use strict'; 3 4 function setCookie(name, value, days) { 5 var expires = ''; 6 if (days && days > 0) { 7 var date = new Date(); 8 date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); 9 expires = '; expires=' + date.toUTCString(); 10 } 11 document.cookie = name + '=' + (value || '') + expires + '; path=/'; 12 } 13 14 function getCookie(name) { 15 var nameEQ = name + '='; 16 var ca = document.cookie.split(';'); 17 for (var i = 0; i < ca.length; i++) { 18 var c = ca[i]; 19 while (c.charAt(0) === ' ') c = c.substring(1, c.length); 20 if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length); 21 } 22 return null; 23 } 24 25 function hasVerified() { 26 return getCookie('age_verified') === 'yes'; 27 } 28 29 function hideOverlay() { 30 var $overlay = $('#age-verification-overlay'); 31 $overlay.fadeOut(150, function () { 32 $overlay.empty(); 33 }); 34 } 35 36 function renderOverlay(data) { 37 var $overlay = $('#age-verification-overlay'); 38 if (!$overlay.length) { 39 $overlay = $('<div id="age-verification-overlay" class="age-verification-overlay" />').appendTo('body'); 40 } 41 42 var logo = data.logoUrl ? '<img class="age-verification-logo" src="' + data.logoUrl + '" alt="Logo" />' : ''; 43 44 var html = '' + 45 '<div class="age-verification-modal" role="dialog" aria-modal="true" aria-labelledby="age-verification-title">' + 46 ' <div class="age-verification-header">' + logo + '</div>' + 47 ' <div class="age-verification-body">' + 48 ' <h2 id="age-verification-title" class="age-verification-title">' + data.texts.title + '</h2>' + 49 ' <p class="age-verification-desc">' + data.texts.desc + '</p>' + 50 ' </div>' + 51 ' <div class="age-verification-actions">' + 52 ' <button type="button" class="age-verification-btn age-verification-btn-primary" id="age-verify-yes">' + data.texts.yes + '</button>' + 53 ' <button type="button" class="age-verification-btn age-verification-btn-secondary" id="age-verify-no">' + data.texts.no + '</button>' + 54 ' </div>' + 55 ' <div class="age-verification-footer">' + 56 ' ' + data.texts.tos_prefix + ' <a href="' + data.termsUrl + '" target="_blank" rel="noopener">' + data.texts.tos_anchor + '</a>.' + 57 ' </div>' + 58 '</div>'; 59 60 $overlay.html(html).show(); 61 62 $('#age-verify-yes').on('click', function () { 63 setCookie('age_verified', 'yes', parseInt(data.cookieDays || 30, 10)); 64 hideOverlay(); 65 }); 66 67 $('#age-verify-no').on('click', function () { 68 if (data.errorUrl && data.errorUrl.length > 0) { 69 window.location.href = data.errorUrl; 70 } else { 71 // No error page configured; keep the overlay without redirecting 72 } 73 }); 74 } 75 76 $(function () { 77 if (typeof AgeVerificationData === 'undefined') return; 78 79 // If already verified, do nothing 80 if (hasVerified()) return; 81 82 // Always render overlay on DOM ready 83 renderOverlay(AgeVerificationData); 84 }); 85})(jQuery);
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.