]> git.cworth.org Git - zombocom-ai/commitdiff
Add a reuse button
authorCarl Worth <cworth@cworth.org>
Thu, 8 Dec 2022 08:51:10 +0000 (00:51 -0800)
committerCarl Worth <cworth@cworth.org>
Thu, 8 Dec 2022 08:53:49 +0000 (00:53 -0800)
To allow for easily reusing cool prompts to make similar images.

index.html

index 0654ae41c33cc11f5e416ad2ff04b3ce70dcc901..d3f25aa2494815938573881513d42dcfd9ad4fd1 100644 (file)
@@ -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');