Slight Adjustment to /latest/ view

Added Better Cookies
Added the option
This commit is contained in:
Doruk 2022-05-13 15:11:47 +03:00
parent c6cffefe80
commit d2903baefe

View file

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