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:
parent
f8174ab27c
commit
94ea8068c9
10 changed files with 106858 additions and 4 deletions
2
static/scripts/highlight.min.js
vendored
2
static/scripts/highlight.min.js
vendored
File diff suppressed because one or more lines are too long
3
static/scripts/p5-1.4.1.min.js
vendored
3
static/scripts/p5-1.4.1.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,63 +0,0 @@
|
|||
import rr from "./railroad.js";
|
||||
|
||||
class RailroadDiagramManager {
|
||||
constructor() {
|
||||
this.figures = new Map();
|
||||
this.isCurrentlyNarrow = undefined;
|
||||
|
||||
this.diagramBreakpoint = window.matchMedia("(max-width: 450px)");
|
||||
this.diagramBreakpoint.addEventListener("change", () => {
|
||||
this.updateVisiblity();
|
||||
});
|
||||
}
|
||||
|
||||
add(svg) {
|
||||
const parent = svg.parentElement;
|
||||
if (!this.figures.has(parent)) {
|
||||
this.figures.set(parent, []);
|
||||
}
|
||||
|
||||
this.figures.get(parent).push(svg);
|
||||
|
||||
parent.removeChild(svg);
|
||||
}
|
||||
|
||||
updateVisiblity() {
|
||||
const isNarrow = this.diagramBreakpoint.matches;
|
||||
|
||||
if (isNarrow === this.isCurrentlyNarrow) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isCurrentlyNarrow = isNarrow;
|
||||
|
||||
for (let [figure, svgs] of this.figures.entries()) {
|
||||
for (let svg of svgs) {
|
||||
const svgHasNarrowClass = svg.classList.contains("narrow");
|
||||
if (isNarrow && svgHasNarrowClass)
|
||||
figure.appendChild(svg);
|
||||
else if (!isNarrow && !svgHasNarrowClass)
|
||||
figure.appendChild(svg);
|
||||
else if (svg.parentElement === figure)
|
||||
figure.removeChild(svg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let railroadDiagramManager = new RailroadDiagramManager();
|
||||
|
||||
export function railroadDiagram(builder, elementID, isNarrow) {
|
||||
const diagram = builder(rr);
|
||||
const svg = diagram.addTo(document.getElementById(elementID));
|
||||
|
||||
if (isNarrow) {
|
||||
svg.classList.add("narrow");
|
||||
}
|
||||
|
||||
railroadDiagramManager.add(svg);
|
||||
}
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
railroadDiagramManager.updateVisiblity();
|
||||
});
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,25 +0,0 @@
|
|||
/* 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 { }
|
||||
});
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
function getInlineSketchWidth() {
|
||||
return getComputedStyle(document.documentElement).getPropertyValue("--body-width");
|
||||
}
|
||||
|
||||
function convertRemToPx(rem) {
|
||||
return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue