From: Max Value Date: Mon, 23 Mar 2026 22:02:37 +0000 (+0000) Subject: Added WIP attribution script X-Git-Url: https://git.ozva.co.uk/?a=commitdiff_plain;h=a72369a68a20a88646652717a8856355d0fbe688;p=chester Added WIP attribution script --- diff --git a/attribution.js b/attribution.js new file mode 100644 index 0000000..cab14a9 --- /dev/null +++ b/attribution.js @@ -0,0 +1,21 @@ +function setupAttribution () { + // convert attribution images into figures + const images = document.getElementsByTagName("img"); + for (e of images) { + if ("attribute" in e.dataset) { + const figure = document.createElement("figure"); + const figcaption = document.createElement("figcaption"); + const image = e.cloneNode(); + + figure.classList.add("attributionFigure") + figcaption.innerHTML = e.dataset.attribute; + + figure.append(image); + figure.append(figcaption); + e.before(figure); + e.remove(); + } + } +} + +setupAttribution(); diff --git a/style.css b/style.css index 2b8eb41..987fa90 100644 --- a/style.css +++ b/style.css @@ -238,3 +238,19 @@ blockquote { .ref { margin: 20px 5% 20px 5%; } + +/* attribution figure */ +.attributionFigure { margin-bottom: -1.4em; } +.attributionFigure figcaption { + display: inline-block; + height: 1em; + width: auto; + margin: 0; + margin-bottom: -1.4em; + padding: 0.2em; + transform: translate(20px, calc(-20px - 1em)); + + color: rgba(255,255,255,0.5); + background-color: rgba(0,0,0,0.5); + font-style: italic; +}