Fixed check to not use cookies and use localStorage instead

This commit is contained in:
Tracker-Friendly 2024-04-24 17:08:32 +01:00
parent 390d9d497e
commit 5e87b3d2d3
1 changed files with 6 additions and 10 deletions

View File

@ -609,23 +609,19 @@ function exportNotes() {
}
function isFirstTimeVisitor() {
if (document.cookie.indexOf("visited=true") !== -1) {
return false;
} else {
var expirationDate = new Date();
expirationDate.setFullYear(expirationDate.getFullYear() + 1);
document.cookie = "visited=true; expires=" + expirationDate.toUTCString() + "; path=/; SameSite=strict";
if (localStorage.getItem("FIRSTVISIT") === null) {
localStorage.setItem("FIRSTVISIT", "1")
return true;
} else {
return false;
}
}
function firstNewVersion() {
if (document.cookie.indexOf("version=1.2") !== -1) {
if (localStorage.getItem("NEWVERSION") == "1.2") {
return false;
} else {
var expirationDate = new Date();
expirationDate.setFullYear(expirationDate.getFullYear() + 1);
document.cookie = "version=1.2; expires=" + expirationDate.toUTCString() + "; path=/; SameSite=strict";
localStorage.setItem("NEWVERSION", "1.2")
return true;
}
}