re-org
This commit is contained in:
parent
aeaab4780c
commit
f48e20fe29
10 changed files with 0 additions and 0 deletions
26
config/custom.js
Executable file
26
config/custom.js
Executable 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();
|
||||
})();
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue