document.addEventListener("DOMContentLoaded", function () { function handle(e) { e.preventDefault(); const cookieEl = e.target.parentElement; if (!window.WebCookieNotice) { console.debug("Missing WebCookieNotice on window"); return; } window.WebCookieNotice.acceptCookie( String(cookieEl.dataset.cookieName) ); cookieEl.classList.add("d-none"); } window.listenInlineCnButtons = () => { const cookieInlineActivation = document.getElementsByClassName("cn-cookie-activate"); [...cookieInlineActivation].forEach((cookieEl) => { const cookieBtnActivation = cookieEl.querySelector("button"); if (!cookieBtnActivation) { throw new Error("Invalid template cookie button"); } cookieBtnActivation.removeEventListener("click", handle); cookieBtnActivation.addEventListener("click", handle); }); }; window.listenInlineCnButtons(); });