|
|
|
|
|
function getCookie(name) { |
|
|
const value = `; ${document.cookie}`; |
|
|
const parts = value.split(`; ${name}=`); |
|
|
if (parts.length === 2) return parts.pop().split(';').shift(); |
|
|
} |
|
|
|
|
|
|
|
|
function setCookie(name, value, days) { |
|
|
let expires = ""; |
|
|
if (days) { |
|
|
const date = new Date(); |
|
|
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); |
|
|
expires = "; expires=" + date.toUTCString(); |
|
|
} |
|
|
document.cookie = name + "=" + (value || "") + expires + "; path=/"; |
|
|
} |
|
|
|
|
|
|
|
|
window.onload = function() { |
|
|
const consentGiven = getCookie("consentGiven"); |
|
|
if (!consentGiven) { |
|
|
document.getElementById("consentModal").style.display = "flex"; |
|
|
} |
|
|
}; |
|
|
|
|
|
|
|
|
document.getElementById("okButton").onclick = function() { |
|
|
setCookie("consentGiven", "true", 365); |
|
|
document.getElementById("consentModal").style.display = "none"; |
|
|
}; |