]> git.cworth.org Git - zombocom-ai/commitdiff
Add support for an image that contains a link
authorCarl Worth <cworth@cworth.org>
Tue, 20 Dec 2022 23:53:26 +0000 (15:53 -0800)
committerCarl Worth <cworth@cworth.org>
Tue, 20 Dec 2022 23:53:26 +0000 (15:53 -0800)
This will be a sort of Easter Egg for hiding a link to a
puzzle. Hopefully this one goes smoothly!

index.html
index.js

index fe30cc65f11171a521888cdefdf0eb6807671d30..92e115ede8e264b75a77843e21cf39ebbd5aff7f 100644 (file)
@@ -176,7 +176,15 @@ mute.addEventListener("click", () => {
 
         const img = document.createElement('img');
         img.src = image.filename;
-        figure.appendChild(img);
+
+        if (image.link) {
+            const a = document.createElement('a');
+            a.href = image.link;
+            a.appendChild(img);
+            figure.appendChild(a);
+        } else {
+            figure.appendChild(img);
+        }
 
         if (image.censored) {
             img.style.display = "none";
index 6f2a62597395c90c1a2e48884edaf3b65a5ec028..e573fdb7ba89e35ced01b398c4e6d61bcbfdbc38 100644 (file)
--- a/index.js
+++ b/index.js
@@ -137,6 +137,7 @@ io.on('connection', (socket) => {
                 images.forEach((image) => {
                     image.id = state.images.length;
                     image.censored = false;
+                    image.link = "";
                     image.comments = [];
                     io.emit('image', image);
                     state.images.push(image);