repos
/ orchard main

orchard

mirror

Every site I host, in one repo, along with the Cloudflare Tunnel and Caddy that front them. It's all Go, Vite, and SQLite, and it runs on a desktop at home with nothing listening on an inbound port.

blogbuncaddycloudflare-tunneldockergogolanghomelabhtml-templatemonorepoself-hostedseosqlitestatic-sitetypstuptime-monitoringviteweb-analytics

533 B · 15 lines · JavaScript Raw History
 1// The ref switcher is a <details> and opens and closes without JavaScript. All
 2// this adds is the one thing markup cannot, closing on a click outside it.
 3document.addEventListener("click", (event) => {
 4  document.querySelectorAll("details.refswitch[open]").forEach((el) => {
 5    if (!el.contains(event.target)) el.open = false;
 6  });
 7});
 8
 9document.addEventListener("keydown", (event) => {
10  if (event.key !== "Escape") return;
11  document.querySelectorAll("details.refswitch[open]").forEach((el) => {
12    el.open = false;
13  });
14});