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>
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();
179 socket.on('image', (image) => {
180 const figure = document.createElement('figure');
181 const img = document.createElement('img');
182 img.src = image.filename;
183 const figcaption = document.createElement('figcaption');
184 const caption_text = document.createTextNode(`${image.prompt} (${image.code})`);
185 figcaption.appendChild(caption_text);
186 figure.appendChild(img);
187 figure.appendChild(figcaption);
188 images.prepend(figure);
191 function hide_spinner() {
192 zombo_form.style.display = "grid";
193 spinner.style.display = "none";
196 zombo_form.addEventListener('submit', function(e) {
198 /* Hide the form and show spinner while generation is happening. */
199 zombo_form.style.display = "none";
200 spinner.style.display = "block";
201 spinner_timeout = setTimeout(hide_spinner, 60000);
202 socket.emit('generate', {"prompt": prompt.value, "code": code.value});
206 socket.on('generation-done', () => {
207 /* Re-display the form and hide spinner now that generation is over. */
208 clearTimeout(spinner_timeout);
212 function random_from(items) {
213 return items[Math.floor(Math.random()*items.length)];
216 safety.addEventListener("click", () => {
219 "A hyperrealistic photograph of",
220 "A matte painting of",
221 "Epic fantasy card art of",
222 "Professional oil painting of",
224 "A pencil sketch of",
230 " a Porsche 911 Carrera",
234 " an elfin princess",
236 " pastel purple clouds",
237 " a Teenage Mutant Ninja Turtle",
240 " in tropical surroundings",
242 " in an ocean storm",
243 " in a snowy forest",
244 " in a cardboard box",
246 " in an epic landscape",
247 " in a haunted forest",
248 " riding a motorbike",
249 " in a futuristic city at night",
250 " in a dystopian landscape, foggy",
251 " in the land of snow",
252 " that looks like a watermelon",
253 " on the streets of London at night with neon lights flashing",
254 " that is part octopus",
255 " melting into a puddle",
261 " by Vincent Van Gogh",
263 " by Johannes Vermeer",
264 ", fantasy art, neon fog",
265 ", epic lighting from above",
266 ", trending on artstation",
269 prompt.value = random_from(art_type) + random_from(subject) +
270 random_from(scenery) + random_from(artist);