Impressum

// find the div block with class name 'modal-trigger' const modalTrigger = document.querySelector('.modal-trigger'); // check if the modal-trigger div is present on the page if (modalTrigger) { // set a timeout of 15 seconds to click the modal-trigger div setTimeout(() => { // check if the cookie is not set if (!getCookie('modalTriggered')) { // perform the action of clicking the modal-trigger div modalTrigger.click(); // set the cookie to prevent the action from happening again in the same session setCookie('modalTriggered', true); } }, 15000); } // helper function to get the value of a cookie function getCookie(name) { const value = `; ${document.cookie}`; const parts = value.split(`; ${name}=`); if (parts.length === 2) return parts.pop().split(';').shift(); } // helper function to set a cookie function setCookie(name, value) { document.cookie = `${name}=${value}; path=/`; }