From d2903baefec51956b7df8b78dea52d4e7f76164f Mon Sep 17 00:00:00 2001 From: Doruk Date: Fri, 13 May 2022 15:11:47 +0300 Subject: [PATCH] Slight Adjustment to /latest/ view Added Better Cookies Added the option --- static/main.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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() {