From: Carl Worth Date: Thu, 8 Dec 2022 08:51:10 +0000 (-0800) Subject: Add a reuse button X-Git-Url: https://git.cworth.org/git?p=zombocom-ai;a=commitdiff_plain;h=3fb2bec10ed7b64ae2455abde1febce6156d854e Add a reuse button To allow for easily reusing cool prompts to make similar images. --- diff --git a/index.html b/index.html index 0654ae4..d3f25aa 100644 --- a/index.html +++ b/index.html @@ -156,8 +156,18 @@ mute.addEventListener("click", () => { figure.appendChild(img); const figcaption = document.createElement('figcaption'); - const caption_text = document.createTextNode(`${image.prompt} (${image.code})`); + const caption_text = document.createTextNode(`${image.prompt} (${image.code}) `); figcaption.appendChild(caption_text); + + const reuse_button = document.createElement('button'); + reuse_button.appendChild(document.createTextNode("Reuse")); + figcaption.appendChild(reuse_button); + + reuse_button.addEventListener('click', () => { + prompt.value = image.prompt; + window.scrollTo(0,0); + }); + figure.appendChild(figcaption); const dl_comments = document.createElement('dl');