Move a bunch of scripts and CSS to assets so they can be processed with Hugo Pipes

Use Pipes to fingerprint and add SLI information to <script> and <link> tags.
This commit is contained in:
Eryn Wells 2022-11-07 08:35:48 -08:00
parent f8174ab27c
commit 94ea8068c9
10 changed files with 106858 additions and 4 deletions

25
assets/scripts/site.js Normal file
View file

@ -0,0 +1,25 @@
/* site.js
* Eryn Wells <eryn@erynwells.me>
*/
window.addEventListener("DOMContentLoaded", () => {
const siteHeader = document.querySelector("header.site");
if (!siteHeader) {
return;
}
siteHeader.classList.add("visible");
siteHeader.addEventListener("animationend", () => {
console.log("Animation ended");
siteHeader.classList.add("sticky");
}, false);
try {
const documentReferrer = new URL(document.referrer);
if (documentReferrer.pathname === "/") {
siteHeader.classList.add("animated");
} else {
siteHeader.classList.add("sticky");
}
} catch { }
});