website/js/cookie.js

28 lines
764 B
JavaScript
Raw Normal View History

2021-03-24 22:18:55 +01:00
function getCookie(name){
var nameEQ = name + "=";
var ca = document.cookie.split(";");
for (var i=0; i < ca.length; i++) {
var c = ca[i];
while(c.charAt(0) === " ") c = c.substr(1, c.length);
if(c.indexOf(nameEQ) === 0) return c.substr(nameEQ.length, c.length)
}
return null
}
2021-03-24 23:50:10 +01:00
2021-03-24 23:07:40 +01:00
let cookieInfo = document.querySelector(".cookieinfo");
2021-03-24 23:50:10 +01:00
if(cookieInfo != null) {
if (getCookie("cookieMessageHide") === "1") {
cookieInfo.style.display = "none";
} else {
cookieInfo.style.display = "block";
}
2021-03-24 23:07:40 +01:00
2021-03-24 23:50:10 +01:00
document.querySelector(".cookieinfo-close").onclick = function() {
console.log("close");
document.cookie = "cookieMessageHide=1";
cookieInfo.style.display = "none";
}
}