Skip to content

Commit

Permalink
Save nightmare toggle state
Browse files Browse the repository at this point in the history
  • Loading branch information
Jobus0 committed Dec 25, 2024
1 parent 2482cb8 commit 9fae713
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/main.sass
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ a
text-decoration: line-through
color: $negative-light

.hide-excluded-toggle .ghost.excluded
.hide-excluded .ghost.excluded
display: none

#evidence-buttons
Expand Down
30 changes: 15 additions & 15 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ const ghostSheet = document.querySelector("#journal-minimap")!;
const body = document.body;
const bottomContent = document.querySelector<HTMLElement>("#bottom-content")!;

if (readCookie("hide-excluded-toggle") === "True") {
body.classList.add("hide-excluded-toggle")
if (readCookie("nightmare").toLowerCase() === "true") {
body.classList.add("nightmare")
nightmareToggle.classList.add("active");
}

if (readCookie("hide-excluded").toLowerCase() === "true") {
body.classList.add("hide-excluded")
hideExcludedToggle.classList.add("active");
}

Expand Down Expand Up @@ -68,7 +73,14 @@ document.querySelectorAll(".toggle").forEach(toggle => {
})

nightmareToggle.addEventListener("click", function () {
body.classList.toggle("nightmare");
let state = body.classList.toggle("nightmare");
writeCookie("nightmare", state.toString())
updateGhosts();
});

hideExcludedToggle.addEventListener("click", function () {
let state = body.classList.toggle("hide-excluded");
writeCookie("hide-excluded", state.toString())
updateGhosts();
});

Expand Down Expand Up @@ -178,18 +190,6 @@ possessionButtons.forEach((button, i) => button.addEventListener("click", functi
}
}));

hideExcludedToggle.addEventListener("click", function () {
if (body.classList.contains("hide-excluded-toggle")) {
body.classList.remove("hide-excluded-toggle");
writeCookie("hide-excluded-toggle", "False")
} else {
body.classList.add("hide-excluded-toggle");
writeCookie("hide-excluded-toggle", "True")
}

updateGhosts();
});

evidenceButtons.forEach(button => button.addEventListener("click", function () {
let changedGhostEvidences;
let changedEvidence = button.dataset.evidence;
Expand Down

0 comments on commit 9fae713

Please sign in to comment.