20 lines
542 B
JavaScript
20 lines
542 B
JavaScript
|
|
|
|
function getCookie(name) {
|
|
var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
|
|
return v ? v[2] : null;
|
|
}
|
|
|
|
var logged = document.getElementById('logged');
|
|
var unknown = document.getElementById('unknown');
|
|
|
|
if(document.cookie.includes("username")){
|
|
|
|
console.log(getCookie('username'));
|
|
logged.style.display= 'block';
|
|
unknown.style.display = 'none';
|
|
document.getElementsByTagName('h1')[0].innerHTML = "Kaixo " + getCookie('username') + "!!";
|
|
}else{
|
|
logged.style.display = 'none';
|
|
unknown.style.display = 'block';
|
|
} |