]> git.cworth.org Git - zombocom-ai/blobdiff - index.html
Allow user to zoom
[zombocom-ai] / index.html
index f438b60f3ac1f53abc9350715812caea641308f0..185927fc1ee244dbdabd5dfe4880a93f96b91b5a 100644 (file)
@@ -5,7 +5,7 @@
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <title>ZOMBO</title>
   <link href="/zombo.css" rel="stylesheet" type="text/css">
-  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
+  <meta name="viewport" content="width=device-width,initial-scale=1">
   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
   <meta name="HandheldFriendly" content="true">
 </head>
@@ -32,7 +32,7 @@
       <form action="" id="zombo-form">
         <div class="form-row large">
           <label for="prompt">
-            What do you imagine?
+            What can you imagine?
           </label>
           <textarea id="prompt" rows="4" width="100%" autocomplete="off" required></textarea>
         </div>
@@ -56,6 +56,9 @@
       </form>
     </p>
 
+    <div id="images">
+    </div>
+
     <ul id="comments">
     </ul>
 
@@ -102,6 +105,8 @@ mute.addEventListener("click", () => {
   <script>
     var socket = io();
 
+    const images = document.querySelector("#images");
+
     const comments = document.querySelector("#comments");
     const comment_form = document.querySelector("#comment-form");
     const comment = document.querySelector("#comment");
@@ -126,6 +131,18 @@ mute.addEventListener("click", () => {
         comments.appendChild(item);
     });
 
+    socket.on('image', (image) => {
+        const figure = document.createElement('figure');
+        const img = document.createElement('img');
+        img.src = image.filename;
+        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) {
         e.preventDefault();
         socket.emit('generate', {"prompt": prompt.value, "code": code.value});