]> git.cworth.org Git - zombocom-ai/blobdiff - index.html
Prepend images as they are generated
[zombocom-ai] / index.html
index 185927fc1ee244dbdabd5dfe4880a93f96b91b5a..13fc62af92a00c9e5dc6f0f3e7da2848c0ae0b72 100644 (file)
@@ -34,6 +34,7 @@
           <label for="prompt">
             What can you imagine?
           </label>
+          <button id="safety" type="button">Safety prompt</button>
           <textarea id="prompt" rows="4" width="100%" autocomplete="off" required></textarea>
         </div>
 
           </div>
         </div>
 
-        <div class="form-row small right">
-          <button id="safety" class="right" type="button">Safety prompt</button>
-        </div>
-
         <div class="form-row large">
           <button id="generate" type="submit">Make the infinite possible</button>
         </div>
@@ -140,15 +137,22 @@ mute.addEventListener("click", () => {
         figcaption.appendChild(caption_text);
         figure.appendChild(img);
         figure.appendChild(figcaption);
-        images.appendChild(figure);
+        images.prepend(figure);
     });
 
     zombo_form.addEventListener('submit', function(e) {
         e.preventDefault();
+        /* Hide the form while generation is happening. */
+        zombo_form.style.display = "none";
         socket.emit('generate', {"prompt": prompt.value, "code": code.value});
         prompt.value = '';
     });
 
+    socket.on('generation-done', () => {
+        /* Re-display the form now that image-generation is over. */
+        zombo_form.style.display = "grid";
+    });
+
     // TODO: Dynamically generate many different prompts here
     safety.addEventListener("click", () => {
         prompt.value = "Matte painting of a Samurai warrior";