1document.addEventListener('DOMContentLoaded', () => { 2 let storage = window.localStorage; // Use localStorage for persistence 3 4 // Check for existing consent cookies 5 if (!storage.getItem('WPGCPAcceptedCookies') && !storage.getItem('WPGCPUserOptOut')) { 6 // Set default consent status 7 storage.setItem('LS_WPGCPAcceptedCookies', 'denied'); 8 storage.setItem('LS_WPGCPStatus', 'default'); 9 } 10 11 if (document.getElementById('ThisSiteUsesCookiesBox')) { 12 if (storage.getItem('WPGCPAcceptedCookies') || storage.getItem('WPGCPUserOptOut')) { 13 // User consent already set, skip showing the notice 14 return; 15 } 16 document.getElementById('ThisSiteUsesCookiesBox').style.display = 'block'; 17 } 18 19 if (document.getElementById('AcceptCookiesButton')) { 20 document.getElementById('AcceptCookiesButton').addEventListener('click', () => { 21 // Function is defined in head 22 wpgcpConsentGrantedAdStorage(); 23 24 storage.setItem('LS_WPGCPAcceptedCookies', 'granted'); 25 storage.setItem('LS_WPGCPStatus', 'update'); 26 27 // Update Bing UET consent state 28 window.uetq = window.uetq || []; 29 window.uetq.push('consent', 'update', { 30 'ad_storage': 'granted', 31 'ad_personalization': 'granted', 32 'ad_user_data': 'granted' 33 }); 34 35 let numDays = 30; 36 let date = new Date(); 37 date.setTime(date.getTime() + (numDays * 24 * 60 * 60 * 1000)); 38 document.cookie = "WPGCPAcceptedCookies=true; expires=" + date.toGMTString() + "; path=/; Secure; SameSite=Strict"; 39 storage.setItem('WPGCPAcceptedCookies', 'true'); // Store in localStorage too 40 document.getElementById('ThisSiteUsesCookiesBox').remove(); 41 }); 42 } 43 44 if (document.getElementById('DeclineCookiesButton')) { 45 document.getElementById('DeclineCookiesButton').addEventListener('click', (e) => { 46 e.preventDefault(); 47 48 storage.setItem('LS_WPGCPAcceptedCookies', 'denied'); 49 storage.setItem('LS_WPGCPStatus', 'update'); 50 51 // Update Bing UET consent state 52 window.uetq = window.uetq || []; 53 window.uetq.push('consent', 'update', { 54 'ad_storage': 'denied', 55 'ad_personalization': 'denied', 56 'ad_user_data': 'denied' 57 }); 58 59 let numDays = 30; 60 let date = new Date(); 61 date.setTime(date.getTime() + (numDays * 24 * 60 * 60 * 1000)); 62 document.cookie = "WPGCPUserOptOut=true; expires=" + date.toGMTString() + "; path=/; Secure; SameSite=Strict"; 63 storage.setItem('WPGCPUserOptOut', 'true'); // Store in localStorage too 64 document.getElementById('ThisSiteUsesCookiesBox').remove(); 65 }); 66 } 67});
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.