</p>
<p>
+ <div id="spinner" align="center">
+ <div class="animate-flicker">
+ <p>
+ <img src="/pngwheel.png" class="rotate thefade">
+ </p>
+ </div>
+ </div>
+
<form action="" id="zombo-form">
<div class="form-row large">
<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>
</form>
</p>
- <div align="center">
- <div class="animate-flicker">
- <p>
- <img src="/pngwheel.png" class="rotate thefade">
- </p>
- </div>
- </div>
-
<audio loop="" src="/zombo_words.mp3" type="audio/mpeg"></audio>
<button id="mute" class="fade volume">
<div>🔊</div>
const safety= document.querySelector("#safety");
+ const spinner = document.querySelector("#spinner");
+
comment_form.addEventListener('submit', function(e) {
e.preventDefault();
if (comment.value) {
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 and show spinner while generation is happening. */
+ zombo_form.style.display = "none";
+ spinner.style.display = "block";
socket.emit('generate', {"prompt": prompt.value, "code": code.value});
prompt.value = '';
});
+ socket.on('generation-done', () => {
+ /* Re-display the form and hide spinner now that generation is over. */
+ zombo_form.style.display = "grid";
+ spinner.style.display = "none";
+ });
+
// TODO: Dynamically generate many different prompts here
safety.addEventListener("click", () => {
prompt.value = "Matte painting of a Samurai warrior";