1// Define a global variable for the number of days 2var consentDurationDays = 30; // Set this to any number of days you want 3// Function to display the consent banner 4function showConsentBanner() { 5 document.getElementById('consent-banner').style.display = 'block'; 6} 7// Function to hide the consent banner 8function hideConsentBanner() { 9 document.getElementById('consent-banner').style.display = 'none'; 10} 11// Function to set a cookie 12function setCookie(name, value, days) { 13 var expires = ""; 14 if (days) { 15 var date = new Date(); 16 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 17 expires = "; expires=" + date.toUTCString(); 18 } 19 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 20} 21// Function to get a cookie 22function getCookie(name) { 23 var nameEQ = name + "="; 24 var ca = document.cookie.split(';'); 25 for(var i=0;i < ca.length;i++) { 26 var c = ca[i]; 27 while (c.charAt(0)==' ') c = c.substring(1,c.length); 28 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 29 } 30 return null; 31} 32// Function to check user consent status 33function hasUserConsented() { 34 var consent = getCookie('cd5_user_consent'); 35 return consent === 'accepted'; 36} 37// Function to handle consent acceptance 38function acceptConsent() { 39 setCookie('cd5_user_consent', 'accepted', consentDurationDays); 40 hideConsentBanner(); 41 // Load GA script or any other tracking scripts here 42 if (typeof loadGAScript === 'function') { 43 loadGAScript(); 44 updateUserConsentGA(); 45 } 46} 47// Function to handle consent rejection 48function rejectConsent() { 49 setCookie('cd5_user_consent', 'rejected', consentDurationDays); 50 hideConsentBanner(); 51}
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.