1// Event.composedPath 2(function(e, d, w) { 3 if(!e.composedPath) { 4 e.composedPath = function() { 5 if (this.path) { 6 return this.path; 7 } 8 var target = this.target; 9 this.path = []; 10 while (target.parentNode !== null) { 11 this.path.push(target); target = target.parentNode; 12 } 13 this.path.push(d, w);return this.path; 14 }; 15 } 16})(Event.prototype, document, window); 17 18window.PINT_CCPA = { 19 banner: {}, 20 modal: {}, 21 setCookie: function (name, value, d) { 22 var days = d || 90; 23 var date = new Date(); 24 date.setTime(date.getTime() + 24*60*60*1000*days); 25 document.cookie = name + '=' + value + ';path=/;expires=' + date.toGMTString(); 26 }, 27 getCookie: function (name) { 28 var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)'); 29 return v ? v[2] : null; 30 }, 31 getCookieOptInChoices: function() { 32 var userChoices = {}; 33 var optionInputs = PINT_CCPA.modal.el.querySelectorAll('.cli-switch input[type="checkbox"]'); 34 for (var i = 0; i < optionInputs.length; i++) { 35 userChoices[optionInputs[i].getAttribute('data-id')] = optionInputs[i].checked; 36 } 37 return userChoices; 38 }, 39 toggleHidden: function(el) { 40 el.classList.toggle('pint-hidden'); 41 }, 42 savePreferences: function () { 43 // Hide banner 44 PINT_CCPA.toggleHidden(PINT_CCPA.banner.el); 45 // Add generic 'accepted' cookie 46 PINT_CCPA.setCookie('pint-cookies-accepted', true, 90); 47 // Get user opt-in choices 48 var userChoices = PINT_CCPA.getCookieOptInChoices(); 49 // Set a namespaced cookie for each option 50 for (var choice in userChoices) { 51 PINT_CCPA.setCookie('pint-'+choice, userChoices[choice], 90); 52 } 53 } 54 55}; 56 57if (PINT_CCPA.getCookie('pint-checkbox-non-necessary') !== 'false') PINT_CCPA.setCookie('pint-checkbox-non-necessary', 'true'); 58 59document.addEventListener('DOMContentLoaded', function() { 60 PINT_CCPA.banner.el = document.getElementById('pint-cookie-banner'); 61 PINT_CCPA.banner.settings = document.getElementById('pint-cookie-settings'); 62 PINT_CCPA.banner.accept = document.getElementById('pint-cookie-accept'); 63 PINT_CCPA.banner.saveAccept = document.getElementById('pint-cookie-save-accept'); 64 65 PINT_CCPA.modal.el = document.getElementById('pint-cookie-modal-wrapper'); 66 PINT_CCPA.modal.close = document.getElementById('pint-cookie-modal-close'); 67 PINT_CCPA.modal.sections = PINT_CCPA.modal.el.querySelectorAll('.cli-tab-header'); 68 69 // Show modal 70 PINT_CCPA.banner.settings.addEventListener('click', function () { 71 PINT_CCPA.toggleHidden(PINT_CCPA.modal.el); 72 }); 73 74 // Hide modal 75 PINT_CCPA.modal.close.addEventListener('click', function () { 76 PINT_CCPA.toggleHidden(PINT_CCPA.modal.el); 77 }); 78 79 // Accept cookie settings 80 PINT_CCPA.banner.accept.addEventListener('click', PINT_CCPA.savePreferences); 81 PINT_CCPA.banner.saveAccept.addEventListener('click', function() { 82 PINT_CCPA.savePreferences(); 83 PINT_CCPA.toggleHidden(PINT_CCPA.modal.el); 84 }); 85 86 // Cookie "section" toggles 87 for (var i =0; i < PINT_CCPA.modal.sections.length; i++) { 88 PINT_CCPA.modal.sections[i].addEventListener('click', function(e) { 89 /** 90 * Loop through the clicked el and parents until we find the one we want 91 * This is necessary as we have a nested `a` for accessibility that can 92 * potentially capture the click event (so we can't use e.target) 93 */ 94 var path = e.path || (e.composedPath && e.composedPath()); 95 for (var j = 0; j < path.length; j++) { 96 if (path[j].classList.contains('cli-tab-section')) { 97 path[j].classList.toggle('expanded'); 98 break; 99 } 100 } 101 }); 102 } 103 104 // Show banner if cookies havent already been accepted 105 if (!PINT_CCPA.getCookie('pint-cookies-accepted')) PINT_CCPA.toggleHidden(PINT_CCPA.banner.el); 106 107});
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.