From 25ee87cb0877406fc296638cd1d7072360bd475b Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 20 Dec 2022 15:53:26 -0800 Subject: [PATCH] Add support for an image that contains a link This will be a sort of Easter Egg for hiding a link to a puzzle. Hopefully this one goes smoothly! --- index.html | 10 +++++++++- index.js | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index fe30cc6..92e115e 100644 --- a/index.html +++ b/index.html @@ -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"; diff --git a/index.js b/index.js index 6f2a625..e573fdb 100644 --- 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); -- 2.43.0