5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7 <link href="/zombo.css" rel="stylesheet" type="text/css">
8 <meta name="viewport" content="width=device-width,initial-scale=1">
9 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
10 <meta name="HandheldFriendly" content="true">
16 <div id="header" align="center">
22 <img src="/zombocom.png" alt="Zombocom" longdesc="http://zombo.com" width="1199" height="217">
27 Welcome to Zombocom. You can do anything at Zombocom, anything at
28 all. The only limit is yourself!
31 <dialog id="name-dialog">
32 <form method="dialog">
35 <input id="name" type="text" autocomplete="off">
39 <button value="default">OK</button>
45 <div id="spinner" align="center">
46 <div class="animate-flicker">
48 <img src="/pngwheel.png" class="rotate thefade">
53 <form action="" id="zombo-form">
54 <div class="form-row large">
58 <button id="safety" type="button">Safety prompt</button>
59 <textarea id="prompt" rows="4" width="100%" autocomplete="off" required></textarea>
62 <div class="form-row small left">
63 <div class="labeled-row">
67 <input id="code" type="text" autocomplete="off" placeholder="(Leave blank for random)" />
71 <div class="form-row large">
72 <button id="generate" type="submit">Make the infinite possible</button>
80 <dl id="comments" class="comments">
84 <form action="" id="comment-form">
85 <input id="comment" type="text" style="width:100%" autocomplete="off" placeholder="Add a comment" />
89 <audio loop="" src="/zombo_words.mp3" type="audio/mpeg"></audio>
90 <button id="mute" class="menu-button fade volume">
93 const mute = document.querySelector("#mute");
94 const icon = document.querySelector("#mute > div");
95 const audio = document.querySelector("audio");
97 mute.addEventListener("click", () => {
101 icon.innerHTML = "🔈";
104 icon.innerHTML = "🔊";
106 mute.classList.add("fade");
112 <button id="profile" class="menu-button">
118 <script src="/socket.io/socket.io.js"></script>
122 const name = document.querySelector("#name");
123 const name_dialog = document.querySelector("#name-dialog");
124 const images = document.querySelector("#images");
125 const comments = document.querySelector("#comments");
126 const comment_form = document.querySelector("#comment-form");
127 const comment = document.querySelector("#comment");
128 const zombo_form = document.querySelector("#zombo-form");
129 const prompt = document.querySelector("#prompt");
130 const code = document.querySelector("#code");
131 const safety= document.querySelector("#safety");
132 const spinner = document.querySelector("#spinner");
133 const profile = document.querySelector("#profile");
136 comment.addEventListener('focus', () => {
137 /* Do nothing if name is already set. */
141 /* Otherwise, bring up the modal dialog to set the name. */
142 name_dialog.showModal();
145 profile.addEventListener('click', () => {
146 name_dialog.showModal();
149 name_dialog.addEventListener('close', () => {
150 socket.emit('set-name', name.value);
153 comment_form.addEventListener('submit', function(e) {
156 socket.emit('comment', comment.value);
161 socket.on('comment', function(comment) {
162 const dt = document.createElement('dt');
163 const dd = document.createElement('dd');
164 dt.textContent = comment.name + ':';
165 dd.textContent = comment.text;
166 comments.appendChild(dt);
167 comments.appendChild(dd);
170 socket.on('inform-name', (name) => {
171 console.log("Received inform-name event: " + name);
175 socket.on('reset', () => {
176 images.replaceChildren();
177 comments.replaceChildren();
180 socket.on('image', (image) => {
181 const figure = document.createElement('figure');
182 const img = document.createElement('img');
183 img.src = image.filename;
184 const figcaption = document.createElement('figcaption');
185 const caption_text = document.createTextNode(`${image.prompt} (${image.code})`);
186 figcaption.appendChild(caption_text);
187 figure.appendChild(img);
188 figure.appendChild(figcaption);
189 images.prepend(figure);
192 function hide_spinner() {
193 zombo_form.style.display = "grid";
194 spinner.style.display = "none";
197 zombo_form.addEventListener('submit', function(e) {
199 /* Hide the form and show spinner while generation is happening. */
200 zombo_form.style.display = "none";
201 spinner.style.display = "block";
202 spinner_timeout = setTimeout(hide_spinner, 60000);
203 socket.emit('generate', {"prompt": prompt.value, "code": code.value});
207 socket.on('generation-done', () => {
208 /* Re-display the form and hide spinner now that generation is over. */
209 clearTimeout(spinner_timeout);
213 function random_from(items) {
214 return items[Math.floor(Math.random()*items.length)];
217 safety.addEventListener("click", () => {
220 "A hyperrealistic photograph of",
221 "A matte painting of",
222 "Epic fantasy card art of",
223 "Professional oil painting of",
225 "A pencil sketch of",
231 " a Porsche 911 Carrera",
235 " an elfin princess",
237 " pastel purple clouds",
238 " a Teenage Mutant Ninja Turtle",
241 " in tropical surroundings",
243 " in an ocean storm",
244 " in a snowy forest",
245 " in a cardboard box",
247 " in an epic landscape",
248 " in a haunted forest",
249 " riding a motorbike",
250 " in a futuristic city at night",
251 " in a dystopian landscape, foggy",
252 " in the land of snow",
253 " that looks like a watermelon",
254 " on the streets of London at night with neon lights flashing",
255 " that is part octopus",
256 " melting into a puddle",
262 " by Vincent Van Gogh",
264 " by Johannes Vermeer",
265 ", fantasy art, neon fog",
266 ", epic lighting from above",
267 ", trending on artstation",
270 prompt.value = random_from(art_type) + random_from(subject) +
271 random_from(scenery) + random_from(artist);