summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/initImages.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/js/initImages.ts b/js/initImages.ts
new file mode 100644
index 0000000..074de76
--- /dev/null
+++ b/js/initImages.ts
@@ -0,0 +1,23 @@
+function initImages() {
+ let content = document.getElementById("content")!;
+
+ let image_count = 0x0;
+ let image_list = Array.from(content.getElementsByTagName("x-image"));
+ for (let image of image_list) {
+ let file = image.getAttribute("data-file")!;
+ console.log("initialising image that links to \"" + file + "\"");
+
+ let image_element = document.createElement("img");
+ image_element.setAttribute("src", "/webp/thumbnail/" + file + ".webp");
+
+ let hyperlink_element = document.createElement("a");
+ hyperlink_element.setAttribute("href", "/webp/source/" + file + ".webp");
+ hyperlink_element.appendChild(image_element);
+
+ image.appendChild(hyperlink_element);
+
+ ++image_count;
+ }
+
+ console.log("initialised (" + image_count + ") image(s)");
+}