((id) => { const append = (scriptid, url, async) => { let d = document, sn = 'script', f = d.getElementsByTagName(sn)[0]; if (!f) { f = d.head; } const s = d.createElement(sn); s.async = async; s.id = scriptid; s.src = url; s.nonce = '{{{NONCE}}}'; s.charset = 'utf-8'; f.parentNode.insertBefore(s, f); }; const is2parttld = (value) => { const tldindicators = ['co', 'com', 'info', 'web', 'info', 'gov', 'edu', 'biz', 'net', 'org']; const countryindicators = [ 'uk', 'us', 'fr', 'es', 'de', 'at', 'au', 'ae', 'be', 'br', 'ca', 'ch', 'cn', 'co', 'cz', 'dk', 'eg', 'eu', 'fi', 'gb', 'gr', 'hk', 'hr', 'hu', 'ie', 'in', 'jp', 'mx', 'nl', 'no', 'nz', 'pl', 'ro', 'ru', 'se', ]; return tldindicators.indexOf(value) !== -1 || countryindicators.indexOf(value) !== -1; }; const getRootDomain = () => { let rootDomain = ''; const parts = window.location.hostname.split('.'); if (parts.length === 2) { rootDomain = parts[0]; } else if (parts.length > 2) { // see if the next to last value is a common tld const part = parts[parts.length - 2]; if (is2parttld(part)) { rootDomain = parts[parts.length - 3]; // go back one more } else { rootDomain = part; } } return rootDomain; }; const waitForElementToDisplay = (selector, callback, checkFrequencyInMs, timeoutInMs) => { const startTimeInMs = Date.now(); const loopSearch = () => { if (document.querySelector(selector) != null) { callback(); return; } else { setTimeout(() => { if (timeoutInMs && Date.now() - startTimeInMs > timeoutInMs) { return; } loopSearch(); }, checkFrequencyInMs); } }; loopSearch(); }; window.evidon = {}; window.evidon.id = id; window.evidon.test = false; // set to true for non-production testing. // window.evidon.userid = ''; const cdn = '//c.evidon.com/'; const rootDomain = getRootDomain(); const noticecdn = cdn + 'sitenotice/'; append('evidon-notice', noticecdn + 'evidon-sitenotice-tag.js', false); append('evidon-location', cdn + 'geo/country.js', true); append('evidon-themes', noticecdn + id + '/snthemes.js', true); if (rootDomain) { append( 'evidon-settings', noticecdn + id + '/' + rootDomain + (window.evidon.test ? '/test' : '') + '/settings.js', true, ); } window.evidon.priorConsentCallback = (categories, vendors, cookies) => { // add the tags which need to wait for prior consent // here. This should be all your advertising tags and // probably most of your social and tracking tags. }; window.evidon.closeCallback = () => { // this is executed if the user closed a UI element without either Accepting (providing consent) // or Declining (declining to provide consent). }; window.evidon.consentWithdrawnCallback = () => { // this is exeucted if the user withdraws consent and elects to // no longer allow technologies to run on the site. }; window.evidon.consentDeclinedCallback = () => { // this is executed if the user explicitly declines giving consent by // using a Decline button }; waitForElementToDisplay( '#_evidon_banner', () => { const buttonsParent = document.getElementById('_evidon_banner'); const newDiv = document.createElement('div'); newDiv.className = 'evidon-buttons'; const optionButton = document.getElementById('_evidon-option-button'); const declineButton = document.getElementById('_evidon-decline-button'); const acceptButton = document.getElementById('_evidon-accept-button'); buttonsParent.appendChild(newDiv); newDiv.appendChild(optionButton); newDiv.appendChild(declineButton); newDiv.appendChild(acceptButton); }, 100, 10000, ); waitForElementToDisplay( '#evidon-prefdiag-nav-2', () => { document.getElementById('evidon-prefdiag-nav-2').children[0].innerHTML = document .getElementById('evidon-prefdiag-nav-2') .children[0].innerHTML.replace('Cookie Policy', 'Cookie Statement'); }, 100, 10000, ); waitForElementToDisplay( '#prc-message', () => { document.getElementById('prc-message').children[0].innerHTML = document .getElementById('prc-message') .children[0].innerHTML.replace('Cookie Policy', 'Cookie Statement'); }, 100, 10000, ); waitForElementToDisplay( '#_evidon_banner', () => { const theme = localStorage.getItem('prefers_color'); if (theme === 'dark') { document.getElementById('_evidon_banner').classList.add('dark-theme'); } }, 100, 10000, ); waitForElementToDisplay( '#evidon-prefdiag-overlay', () => { const theme = localStorage.getItem('prefers_color'); if (theme === 'dark') { document.getElementById('evidon-prefdiag-overlay')?.classList?.add('dark-theme'); } }, 100, 10000, ); // Uncomment below to test locally // setTimeout(() => window.evidon.notice.setDomain('qa-developerstudio.fiserv.com'), 2000); })(6251);