dfs
This commit is contained in:
parent
90c0752590
commit
fb2883c8ff
2 changed files with 64 additions and 0 deletions
26
custom.css
26
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;
|
||||
}
|
||||
|
||||
38
custom.js
38
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();
|
||||
})();
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue