From: Carl Worth Date: Wed, 7 Dec 2022 18:17:52 +0000 (-0800) Subject: Generate new structure for images X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=b1856efb32864fbdbe9f0f3e6e96a19dddab7ff6;p=zombocom-ai Generate new structure for images Using both a figure and a figcaption for each image. This allows for more structured styling. --- diff --git a/index.html b/index.html index fb8cbc0..b7e3521 100644 --- a/index.html +++ b/index.html @@ -32,7 +32,7 @@
@@ -132,17 +132,15 @@ mute.addEventListener("click", () => { }); socket.on('image', (image) => { + const figure = document.createElement('figure'); const img = document.createElement('img'); img.src = image.filename; - const p_prompt = document.createElement('p'); - const prompt_text = document.createTextNode(`Prompt: ${image.prompt}`); - p_prompt.appendChild(prompt_text); - const p_code = document.createElement('p'); - const code_text = document.createTextNode(`Code: ${image.code}`); - p_code.appendChild(code_text); - images.appendChild(img); - images.appendChild(p_prompt); - images.appendChild(p_code); + const figcaption = document.createElement('figcaption'); + const caption_text = document.createTextNode(`${image.prompt} (${image.code})`); + figcaption.appendChild(caption_text); + figure.appendChild(img); + figure.appendChild(figcaption); + images.appendChild(figure); }); zombo_form.addEventListener('submit', function(e) {