]> OzVa Git service - chester/commitdiff
Added WIP attribution script
authorMax Value <greenwoodw50@gmail.com>
Mon, 23 Mar 2026 22:02:37 +0000 (22:02 +0000)
committerMax Value <greenwoodw50@gmail.com>
Mon, 23 Mar 2026 22:02:37 +0000 (22:02 +0000)
attribution.js [new file with mode: 0644]
style.css

diff --git a/attribution.js b/attribution.js
new file mode 100644 (file)
index 0000000..cab14a9
--- /dev/null
@@ -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();
index 2b8eb417f3abe3761ceeab0df307accc307e99a4..987fa90abb699ae8fc05ab7b4c39c61cbe1afc41 100644 (file)
--- 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;
+}