We use cookies and browser activity to improve your experience, personalize content and ads, and to analyze how our sites are used. For more information on how we collect and use this information, please review our Privacy Policy and Review our Terms. California consumers may exercise their CCPA rights here.
{ const privacyBanner = document.querySelector(‘.consumer-privacy-banner’); if (!privacyBanner) return; // early return if the banner is not found const PRIVACY_STATUS = “DDC.AllowUserData”; const allowUserData = window.localStorage.getItem(PRIVACY_STATUS); const hideForKeyboard = () => { // Get focusable elements inside the banner // This might be kind of ridiculous solutuon, and maybe we could get away with another solution like simply checking if the element has a `tabindex` attribute? // The problem is that :tabbable isn’t available as a vanilla JS selector. const tabbableElements = privacyBanner.querySelectorAll( ‘a[href], audio[controls], video[controls], button, details, iframe, input:not([disabled]), select:not([disabled]), summary, textarea:not([disabled]), [tabindex=”0″], [contenteditable=”true”], [accesskey]’ ); tabbableElements.forEach(el => el.setAttribute(‘tabindex’, ‘-1’)); }; if (allowUserData !== ‘true’) { const privacyBannerCloseButton = privacyBanner.querySelector(‘.consumer-privacy-banner-button’); if (!privacyBannerCloseButton) return; document.body.prepend(privacyBanner); privacyBannerCloseButton.addEventListener(‘click’, e => { e.preventDefault(); privacyBanner.classList.remove(‘in’); privacyBanner.classList.remove(‘no-animation’); privacyBanner.setAttribute(‘aria-hidden’, ‘true’); hideForKeyboard(); window.localStorage.setItem(PRIVACY_STATUS, ‘true’); }); } } if( (true || false) && true ) { addPrivacyBannerInline() } ]]>
Source