diff --git a/static/main.js b/static/main.js index 3f48078..5610a90 100644 --- a/static/main.js +++ b/static/main.js @@ -15,8 +15,6 @@ window.onload = () => { const notsafe = document.querySelector("#notsafe"); if (document.cookie.includes("NSFW=true")) { notsafe.checked = true; - document.querySelectorAll(".nsfw").forEach(e => e.classList.add("noff")); - addCookie("NSFW", true); isNSFWSHOW = true; } if (document.cookie.includes("always=true")) { @@ -45,10 +43,10 @@ window.onload = () => { } function addCookie(name, state) { - if (document.cookie.includes(name)) - document.cookie = document.cookie.replace(`${name}=${!state}`, `${name}=${state}`); + if (state) + document.cookie = `${name}=${state}; max-age=15780000; SameSite=None; Secure`; else - document.cookie += `${name}=${state}; max-age=15780000; SameSite=None; Secure`; + document.cookie = `${name}=`; } function cookieTime() {