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

905 B · 21 lines · JavaScript Raw History
 1// The six columns that fold up off the screen on load. It plays once per build
 2// rather than once per page: the head script in base.html owns that decision and
 3// keys it on the bundle hash, so a deploy is a cold load and gets the opening.
 4
 5export const initLoader = () => {
 6  if (document.documentElement.dataset.returning) return;
 7
 8  const loader = document.querySelector(".loader");
 9  if (!loader || loader.dataset.wait !== "true") return;
10
11  // The one attribute drives both the paused columns and the dots in the CSS.
12  const release = () => loader.removeAttribute("data-wait");
13
14  // The home page fires this once its hero has loaded or failed to. A broken
15  // image still has to release the overlay or the page stays behind it.
16  window.addEventListener("loaderReady", release, { once: true });
17
18  // Belt and braces, in case the hero fires neither event.
19  window.setTimeout(release, 5000);
20};