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) => {
160 console.log("Received inform-name event: " + name);
164 socket.on('reset', () => {
165 images.replaceChildren();
168 socket.on('image', (image) => {
169 const figure = document.createElement('figure');
170 const img = document.createElement('img');
171 img.src = image.filename;
172 const figcaption = document.createElement('figcaption');
173 const caption_text = document.createTextNode(`${image.prompt} (${image.code})`);
174 figcaption.appendChild(caption_text);
175 figure.appendChild(img);
176 figure.appendChild(figcaption);
177 images.prepend(figure);
180 function hide_spinner() {
181 zombo_form.style.display = "grid";
182 spinner.style.display = "none";
185 zombo_form.addEventListener('submit', function(e) {
187 /* Hide the form and show spinner while generation is happening. */
188 zombo_form.style.display = "none";
189 spinner.style.display = "block";
190 spinner_timeout = setTimeout(hide_spinner, 60000);
191 socket.emit('generate', {"prompt": prompt.value, "code": code.value});
195 socket.on('generation-done', () => {
196 /* Re-display the form and hide spinner now that generation is over. */
197 clearTimeout(spinner_timeout);
201 function random_from(items) {
202 return items[Math.floor(Math.random()*items.length)];
205 safety.addEventListener("click", () => {
208 "A hyperrealistic photograph of",
209 "A matte painting of",
210 "Epic fantasy card art of",
211 "Professional oil painting of",
213 "A pencil sketch of",
219 " a Porsche 911 Carrera",
223 " an elfin princess",
225 " pastel purple clouds",
226 " a Teenage Mutant Ninja Turtle",
229 " in tropical surroundings",
231 " in an ocean storm",
232 " in a snowy forest",
233 " in a cardboard box",
235 " in an epic landscape",
236 " in a haunted forest",
237 " riding a motorbike",
238 " in a futuristic city at night",
239 " in a dystopian landscape, foggy",
240 " in the land of snow",
241 " that looks like a watermelon",
242 " on the streets of London at night with neon lights flashing",
243 " that is part octopus",
244 " melting into a puddle",
250 " by Vincent Van Gogh",
252 " by Johannes Vermeer",
253 ", fantasy art, neon fog",
254 ", epic lighting from above",
255 ", trending on artstation",
258 prompt.value = random_from(art_type) + random_from(subject) +
259 random_from(scenery) + random_from(artist);