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">
39 <button value="cancel">Cancel</button>
40 <button id="confirm" value="default">Confirm</button>
46 <div id="spinner" align="center">
47 <div class="animate-flicker">
49 <img src="/pngwheel.png" class="rotate thefade">
54 <form action="" id="zombo-form">
55 <div class="form-row large">
59 <button id="safety" type="button">Safety prompt</button>
60 <textarea id="prompt" rows="4" width="100%" autocomplete="off" required></textarea>
63 <div class="form-row small left">
64 <div class="labeled-row">
68 <input id="code" type="text" autocomplete="off" placeholder="(Leave blank for random)" />
72 <div class="form-row large">
73 <button id="generate" type="submit">Make the infinite possible</button>
85 <form action="" id="comment-form">
86 <input id="comment" type="text" style="width:100%" autocomplete="off" placeholder="Add a comment" />
90 <audio loop="" src="/zombo_words.mp3" type="audio/mpeg"></audio>
91 <button id="mute" class="fade volume">
94 const mute = document.querySelector("#mute");
95 const icon = document.querySelector("#mute > div");
96 const audio = document.querySelector("audio");
98 mute.addEventListener("click", () => {
102 icon.innerHTML = "🔈";
105 icon.innerHTML = "🔊";
107 mute.classList.add("fade");
115 <script src="/socket.io/socket.io.js"></script>
119 const name = document.querySelector("#name");
120 const name_dialog = document.querySelector("#name-dialog");
121 const images = document.querySelector("#images");
122 const comments = document.querySelector("#comments");
123 const comment_form = document.querySelector("#comment-form");
124 const comment = document.querySelector("#comment");
125 const zombo_form = document.querySelector("#zombo-form");
126 const prompt = document.querySelector("#prompt");
127 const code = document.querySelector("#code");
128 const safety= document.querySelector("#safety");
129 const spinner = document.querySelector("#spinner");
132 comment.addEventListener('focus', () => {
133 /* Do nothing if name is already set. */
137 /* Otherwise, bring up the modal dialog to set the name. */
138 name_dialog.showModal();
141 name_dialog.addEventListener('close', () => {
142 socket.emit('set-name', name.value);
145 comment_form.addEventListener('submit', function(e) {
148 socket.emit('comment', comment.value);
153 socket.on('comment', function(msg) {
154 var item = document.createElement('li');
155 item.textContent = msg;
156 comments.appendChild(item);
159 socket.on('inform-name', (name) => {
163 socket.on('reset', () => {
164 images.replaceChildren();
167 socket.on('image', (image) => {
168 const figure = document.createElement('figure');
169 const img = document.createElement('img');
170 img.src = image.filename;
171 const figcaption = document.createElement('figcaption');
172 const caption_text = document.createTextNode(`${image.prompt} (${image.code})`);
173 figcaption.appendChild(caption_text);
174 figure.appendChild(img);
175 figure.appendChild(figcaption);
176 images.prepend(figure);
179 function hide_spinner() {
180 zombo_form.style.display = "grid";
181 spinner.style.display = "none";
184 zombo_form.addEventListener('submit', function(e) {
186 /* Hide the form and show spinner while generation is happening. */
187 zombo_form.style.display = "none";
188 spinner.style.display = "block";
189 spinner_timeout = setTimeout(hide_spinner, 60000);
190 socket.emit('generate', {"prompt": prompt.value, "code": code.value});
194 socket.on('generation-done', () => {
195 /* Re-display the form and hide spinner now that generation is over. */
196 clearTimeout(spinner_timeout);
200 function random_from(items) {
201 return items[Math.floor(Math.random()*items.length)];
204 safety.addEventListener("click", () => {
207 "A hyperrealistic photograph of",
208 "A matte painting of",
209 "Epic fantasy card art of",
210 "Professional oil painting of",
212 "A pencil sketch of",
218 " a Porsche 911 Carrera",
222 " an elfin princess",
224 " pastel purple clouds",
225 " a Teenage Mutant Ninja Turtle",
228 " in tropical surroundings",
230 " in an ocean storm",
231 " in a snowy forest",
232 " in a cardboard box",
234 " in an epic landscape",
235 " in a haunted forest",
236 " riding a motorbike",
237 " in a futuristic city at night",
238 " in a dystopian landscape, foggy",
239 " in the land of snow",
240 " that looks like a watermelon",
241 " on the streets of London at night with neon lights flashing",
242 " that is part octopus",
243 " melting into a puddle",
249 " by Vincent Van Gogh",
251 " by Johannes Vermeer",
252 ", fantasy art, neon fog",
253 ", epic lighting from above",
254 ", trending on artstation",
257 prompt.value = random_from(art_type) + random_from(subject) +
258 random_from(scenery) + random_from(artist);