This commit is contained in:
traveler 2025-12-23 16:03:29 -06:00
parent aeaab4780c
commit f48e20fe29
10 changed files with 0 additions and 0 deletions

26
config/custom.js Executable file
View file

@ -0,0 +1,26 @@
// custom.js
(() => {
const TAB_CLASS_PREFIX = "tab-";
const knownTabs = new Set(["glance", "pncharris", "netgrimoire", "wasted-bandwidth"]);
function clearTabClasses() {
document.body.classList.forEach((c) => {
if (c.startsWith(TAB_CLASS_PREFIX)) document.body.classList.remove(c);
});
}
function applyTabClass() {
// Your URLs look like: https://homepage.netgrimoire.com/#pncharris
const hash = (window.location.hash || "").replace(/^#/, "").trim().toLowerCase();
const tab = knownTabs.has(hash) ? hash : "glance";
clearTabClasses();
document.body.classList.add(`${TAB_CLASS_PREFIX}${tab}`);
}
window.addEventListener("hashchange", applyTabClass);
window.addEventListener("load", applyTabClass);
applyTabClass();
})();