website/ts/cookie.ts

24 lines
No EOL
697 B
TypeScript

function acceptCookie(){
document.cookie = "cookieMessageHide=1";
checkHide();
}
function getCookie(name:string){
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
}
function checkHide(){
let cookieInfo: HTMLElement = <HTMLElement> document.getElementsByClassName("cookieinfo")[0];
if (getCookie("cookieMessageHide") === "1"){
cookieInfo.style.display = "none";
} else {
cookieInfo.style.display = "block";
}
}