2020-10-30 00:19:49 +01:00
|
|
|
function openPolicyPopup() {
|
|
|
|
if(getCookie("consentGiven") === "true") return;
|
|
|
|
|
2020-11-05 21:19:43 +01:00
|
|
|
$("#mind-policy-popup").fadeIn(300); // Enable the div
|
2020-10-30 00:19:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function agreePolicyPopup() {
|
|
|
|
const _paq = window._paq || [];
|
|
|
|
_paq.push(['rememberConsentGiven', 43800]);
|
2021-03-16 17:39:58 +01:00
|
|
|
_paq.push(['rememberCookieConsentGiven']);
|
2020-11-05 21:19:43 +01:00
|
|
|
$("#mind-policy-popup").fadeOut(300); // Disable the div
|
2021-03-16 17:39:58 +01:00
|
|
|
setCookie("consentGiven", "true", 1825); // todo: check if already present? also, firefox was throwing a warning...
|
2020-10-30 00:19:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function getCookie(cname) {
|
2020-11-06 00:27:57 +01:00
|
|
|
const name = cname + "=";
|
|
|
|
const decodedCookie = decodeURIComponent(document.cookie);
|
|
|
|
const ca = decodedCookie.split(';');
|
|
|
|
for(let i = 0; i <ca.length; i++) {
|
|
|
|
let c = ca[i];
|
2020-10-30 00:19:49 +01:00
|
|
|
while (c.charAt(0) === ' ') {
|
|
|
|
c = c.substring(1);
|
|
|
|
}
|
|
|
|
if (c.indexOf(name) === 0) {
|
|
|
|
return c.substring(name.length, c.length);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
function setCookie(name, value, days) {
|
2020-11-06 00:27:57 +01:00
|
|
|
let expires = "";
|
2020-10-30 00:19:49 +01:00
|
|
|
if (days) {
|
2020-11-06 00:27:57 +01:00
|
|
|
const date = new Date();
|
2020-10-30 00:19:49 +01:00
|
|
|
date.setTime(date.getTime() + (days*24*60*60*1000));
|
|
|
|
expires = "; expires=" + date.toUTCString();
|
|
|
|
}
|
|
|
|
document.cookie = name + "=" + (value || "") + expires + "; path=/;SameSite=Lax";
|
|
|
|
}
|