sitegen/src/q+a/header.client.ts

13 lines
389 B
TypeScript
Raw Normal View History

const h1 = document.querySelector("h1")!;
2025-06-15 13:11:21 -07:00
const key = "net.paperclover.q+a.header";
const state = localStorage?.getItem(key);
if (state === "detrevni ton") h1.classList.toggle("invert");
h1.addEventListener("click", () => {
h1.classList.toggle("invert");
2025-06-15 13:11:21 -07:00
localStorage?.setItem(
key,
(localStorage.getItem?.(key) ?? "not inverted")
.split("").reverse().join(""),
);
});