2020-04-02 22:14:53 +02:00
|
|
|
function getCookie(key) {
|
|
|
|
let c = document.cookie;
|
|
|
|
if (!c)
|
|
|
|
return undefined;
|
|
|
|
let start = c.indexOf(key + "=") + key.length + 1;
|
|
|
|
let end = c.indexOf(";", start);
|
|
|
|
return c.substring(start, end < 0 ? c.length : end);
|
|
|
|
}
|
2019-10-04 22:15:03 +02:00
|
|
|
|
2020-04-02 22:14:53 +02:00
|
|
|
function setCookie(key, value, days) {
|
|
|
|
var date = new Date();
|
|
|
|
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
|
|
document.cookie = key + "=" + value + "; expires=" + date.toUTCString();
|
2019-10-04 22:15:03 +02:00
|
|
|
}
|