Skip to content
Snippets Groups Projects
cookie.js 764 B
Newer Older
  • Learn to ignore specific revisions
  • 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
    }
    
    
    Jonas Leder's avatar
    Jonas Leder committed
    let cookieInfo = document.querySelector(".cookieinfo");
    
    if(cookieInfo != null) {
        if (getCookie("cookieMessageHide") === "1") {
            cookieInfo.style.display = "none";
        } else {
            cookieInfo.style.display = "block";
        }
    
    Jonas Leder's avatar
    Jonas Leder committed
    
    
        document.querySelector(".cookieinfo-close").onclick = function() {
            console.log("close");
            document.cookie = "cookieMessageHide=1";
            cookieInfo.style.display = "none";
        }
    
    }