diff --git a/scripts/policy-popup.js b/scripts/policy-popup.js index 394aee9..122db7c 100644 --- a/scripts/policy-popup.js +++ b/scripts/policy-popup.js @@ -6,9 +6,9 @@ function openPolicyPopup() { function agreePolicyPopup() { const _paq = window._paq || []; - _paq.push(['rememberConsentGiven']); + _paq.push(['rememberConsentGiven', 43800]); $("#policy-popup").fadeOut(1000); // Disable the div - document.cookie = "consentGiven=true;SameSite=Lax"; // todo: check if already present? also, firefox was throwing a warning... + setCookie("consentGiven", "true", 1825) // todo: check if already present? also, firefox was throwing a warning... } function getCookie(cname) { @@ -26,3 +26,13 @@ function getCookie(cname) { } return ""; } + +function setCookie(name, value, days) { + var expires = ""; + if (days) { + var date = new Date(); + date.setTime(date.getTime() + (days*24*60*60*1000)); + expires = "; expires=" + date.toUTCString(); + } + document.cookie = name + "=" + (value || "") + expires + "; path=/;SameSite=Lax"; +}