</div>
<p>
- Welcome to Zombocom. You can do anything at Zombcom, anything at
+ Welcome to Zombocom. You can do anything at Zombocom, anything at
all. The only limit is yourself!
</p>
<label for="prompt">
What do you imagine?
</label>
- <textarea id="prompt" rows="4" width="100%" autocomplete="off" required>
- </textarea>
+ <textarea id="prompt" rows="4" width="100%" autocomplete="off" required></textarea>
</div>
<div class="form-row small left">
- <label for="code">
- Numeric code
- </label>
- <input id="code" type="text" size="10" autocomplete="off" placeholder="(Chosen randomly)" />
+ <div class="labeled-row">
+ <label for="code">
+ Numeric code:
+ </label>
+ <input id="code" type="text" autocomplete="off" placeholder="(Leave blank for random)" />
+ </div>
</div>
<div class="form-row small right">
- <button id="safety" type="button">Safety prompt</button>
- <script>
- const prompt = document.querySelector("#prompt");
- const safety= document.querySelector("#safety");
- // TODO: Dynamically generate many different prompts here
- safety.addEventListener("click", () => {
- prompt.value = "Matte painting of a Samurai warrior";
- return false;
- })
- </script>
+ <button id="safety" class="right" type="button">Safety prompt</button>
</div>
<div class="form-row large">
</form>
</p>
+ <div id="images">
+ </div>
+
+ <ul id="comments">
+ </ul>
+
+ <p>
+ <form action="" id="comment-form">
+ <input id="comment" type="text" style="width:100%" autocomplete="off" placeholder="Add a comment" />
+ </form>
+ </p>
+
<div align="center">
<div class="animate-flicker">
<p>
</button>
</div>
+
+ <script src="/socket.io/socket.io.js"></script>
+ <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");
+
+ const zombo_form = document.querySelector("#zombo-form");
+ const prompt = document.querySelector("#prompt");
+ const code = document.querySelector("#code");
+
+ const safety= document.querySelector("#safety");
+
+ comment_form.addEventListener('submit', function(e) {
+ e.preventDefault();
+ if (comment.value) {
+ socket.emit('comment', comment.value);
+ comment.value = '';
+ }
+ });
+
+ socket.on('comment', function(msg) {
+ var item = document.createElement('li');
+ item.textContent = msg;
+ comments.appendChild(item);
+ });
+
+ socket.on('image', (image) => {
+ const img = document.createElement('img');
+ img.src = image.filename;
+ const p_prompt = document.createElement('p');
+ p_prompt.innerHtml = `Prompt: ${image.prompt}`;
+ const p_code = document.createElement('p');
+ p_code.innerHtml = `Code: ${image.code}`;
+ images.appendChild(img);
+ images.appendChild(p_prompt);
+ images.appendChild(p_code);
+ });
+
+ zombo_form.addEventListener('submit', function(e) {
+ e.preventDefault();
+ socket.emit('generate', {"prompt": prompt.value, "code": code.value});
+ prompt.value = '';
+ });
+
+ // TODO: Dynamically generate many different prompts here
+ safety.addEventListener("click", () => {
+ prompt.value = "Matte painting of a Samurai warrior";
+ return false;
+ });
+
+ </script>
</body>
</html>