From fb2883c8ff145fbe9bc23d04d2567c12b88f6bad Mon Sep 17 00:00:00 2001 From: traveler Date: Tue, 23 Dec 2025 15:25:57 -0600 Subject: [PATCH] dfs --- custom.css | 26 ++++++++++++++++++++++++++ custom.js | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/custom.css b/custom.css index e69de29..933aa18 100755 --- a/custom.css +++ b/custom.css @@ -0,0 +1,26 @@ +/* custom.css */ + +/* Make background cover nicely */ +body { + background-size: cover !important; + background-position: center center !important; + background-attachment: fixed !important; + } + + /* Per-tab backgrounds */ + body.tab-glance { + background-image: url("/images/bg-glance.jpg") !important; + } + + body.tab-pncharris { + background-image: url("pncharris-bg.png") !important; + } + + body.tab-netgrimoire { + background-image: url("/images/bg-netgrimoire.jpg") !important; + } + + body.tab-wasted-bandwidth { + background-image: url("/images/bg-wasted.jpg") !important; + } + \ No newline at end of file diff --git a/custom.js b/custom.js index e69de29..6364936 100755 --- a/custom.js +++ b/custom.js @@ -0,0 +1,38 @@ +// custom.js +(function () { + const tabClasses = [ + "tab-glance", + "tab-pncharris", + "tab-netgrimoire", + "tab-wasted-bandwidth", + ]; + + function normalize(s) { + return (s || "") + .toLowerCase() + .replace(/[^a-z0-9]+/g, "-") + .replace(/(^-|-$)/g, ""); + } + + function applyTabClass() { + // Tabs commonly appear in the URL hash with Homepage tabs + // We'll derive the active tab from location.hash as best-effort. + const hash = (location.hash || "").replace(/^#/, ""); + const slug = normalize(hash) || "glance"; + + document.body.classList.remove(...tabClasses); + + if (slug.includes("pncharris")) document.body.classList.add("tab-pncharris"); + else if (slug.includes("netgrimoire")) document.body.classList.add("tab-netgrimoire"); + else if (slug.includes("wasted") || slug.includes("bandwidth")) + document.body.classList.add("tab-wasted-bandwidth"); + else document.body.classList.add("tab-glance"); + } + + window.addEventListener("hashchange", applyTabClass); + window.addEventListener("load", applyTabClass); + + // Initial run + applyTabClass(); + })(); + \ No newline at end of file