atagen

jelq

public

an http based roguelike rpg about jelqing

Star0
Watch0
a043b8dc91b73012728c66725d8a23704ec419d1
1
ssh://brewery@pls.lobotomise.me:33/atagen/jelq.git
src/ui.htmlHtml540 lines21.3 KB
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8">
5
<title>jelqd</title>
6
<style>
7
.frame { border: 2px inset; background: #fff; height: 85vh; overflow: scroll; padding: 4px; }
8
#log { white-space: pre-wrap; margin: 0; }
9
pre, li, p, td, label { overflow-wrap: anywhere; }
10
</style>
11
</head>
12
<body>
13
14
<h1>jelqd</h1>
15
<p>A roguelike played over HTTP.</p>
16
<p>Pick a resource, pick a method, send it.<br>The log on the right is everything the server has said to you.</p>
17
<p>Language <select id="locale"><option>en-GB</option><option>en-US</option><option>en-AU</option></select></p>
18
19
<table width="100%" cellspacing="6">
20
<tr>
21
<td width="45%" valign="top">
22
<div class="frame">
23
24
<div id="alerts"></div>
25
26
<form id="form">
27
<h3>Method</h3>
28
<div id="methods"></div>
29
<datalist id="excuses"></datalist>
30
31
<h3>Request</h3>
32
<table id="fields" cellpadding="2"></table>
33
34
<p><input type="submit" id="send" value="Send" style="font-size: 1.3em"></p>
35
36
<h3>Stats</h3>
37
<table id="progress" border="1" cellspacing="0" cellpadding="3"></table>
38
<br>
39
<table id="stats" border="1" cellspacing="0" cellpadding="3"></table>
40
41
<h3>Resource</h3>
42
<div id="targets"></div>
43
</form>
44
45
<p><small>Every request goes through <code>/ui/send</code>, which replays it inside the server, so the page can show redirects and send methods and headers that browsers refuse.</small></p>
46
</div>
47
</td>
48
<td valign="top">
49
<div class="frame" id="frame"><pre id="log"></pre></div>
50
</td>
51
</tr>
52
</table>
53
54
<script>
55
const REL = "https://jelq.dev/rels/";
56
const METHODS = ["JELQ", "HOLD", "GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS", "TRACE"];
57
const ALL_LUBES = ["", "application/baby-oil", "application/coconut-oil", "application/lotion", "application/vaseline", "text/plain; charset=spit", "image/jpeg"];
58
let stocked = null;
59
let excuses = [];
60
let nonce = null;
61
let inventorySeq = 0;
62
const PROGRESS = [
63
  { header: "x-turn", label: "Turn" },
64
  { header: "x-floor-turn", label: "Floor turn" },
65
  { header: "x-floor", label: "Floor", better: 1 },
66
  { header: "x-cash", label: "Cash", better: 1 },
67
];
68
const STATS = [
69
  { header: "x-self-reported-length", label: "Self-reported length", better: 1, places: 2, measured: { header: "x-length", label: "Length" } },
70
  { header: "x-girth", label: "Girth", better: 1, places: 2 },
71
  { header: "x-foreskin", label: "Foreskin", better: 1, places: 2 },
72
  { header: "x-friction", label: "Friction", better: -1 },
73
  { header: "x-eq", label: "EQ" },
74
  { header: "x-stamina", label: "Stamina", better: 1 },
75
  { header: "x-suspicion", label: "Suspicion", better: -1 },
76
  { header: "x-shame", label: "Shame", better: -1 },
77
];
78
const AROUSAL = ["Flaccid", "Cold", "Warm", "Ideal", "Swollen", "Throbbing", "Straining", "Imminent"];
79
const DANGER_COLOURS = { dangerous: "#b8860b", critical: "red" };
80
let lastStats = {};
81
const QUIET = new Set(["link", "set-cookie", "server", "x-powered-by", "cache-control", "content-length", "content-type", "date"].concat(PROGRESS.concat(STATS).flatMap(s => [s.header, s.measured?.header]).filter(Boolean)));
82
83
const FIELDS = {
84
  seed: { label: "seed (unranked)", kind: "text" },
85
  technique: { label: "technique", kind: "select" },
86
  also: { label: "combo with", kind: "select" },
87
  intensity: { label: "intensity, 1 to 10", kind: "number", value: "5" },
88
  lube: { label: "Content-Type", header: "Content-Type", kind: "select" },
89
  range: { label: "Range", header: "Range", kind: "text", placeholder: "inches=0-2" },
90
  ifMatch: { label: "If-Match", header: "If-Match", kind: "text" },
91
  ifNoneMatch: { label: "If-None-Match", header: "If-None-Match", kind: "text" },
92
  ifModifiedSince: { label: "If-Modified-Since", header: "If-Modified-Since", kind: "text", placeholder: "an HTTP-date" },
93
  proxy: { label: "Proxy-Authorization", header: "Proxy-Authorization", kind: "text", placeholder: "Ruler 5.4" },
94
  upgrade: { label: "Upgrade", header: "Upgrade", kind: "select", options: ["", "underhand", "overhand"] },
95
  authorization: { label: "Authorization", header: "Authorization", kind: "text", placeholder: 'Excuse "homework"' },
96
  extra: { label: "other headers, one per line", kind: "textarea", placeholder: "Expect: gains" },
97
};
98
const BY_TARGET = {
99
  "runs POST": ["seed"],
100
  "length GET": ["range"],
101
  "length HEAD": ["range"],
102
  "foreskin DELETE": ["ifMatch"],
103
  "elder GET": ["proxy", "ifModifiedSince"],
104
  "grip GET": ["upgrade"],
105
  "diagnosis GET": ["authorization", "ifNoneMatch"],
106
};
107
const GROUPS = [
108
  ["play", "Play"],
109
  ["shop", "Shop"],
110
  ["you", "You"],
111
  ["said", "From the last response"],
112
  ["reading", "Reading"],
113
  ["meta", "Meta"],
114
];
115
const GROUP_OF = { run: "play", floor: "play", drawer: "play", shop: "play", "shop-item": "shop", kitchen: "play", portal: "play", elder: "play", diagnosis: "play", length: "you", foreskin: "you", grip: "you", inventory: "you", footage: "you", techniques: "reading", thread: "reading" };
116
const NAMES = { run: "the run", thread: "the 2009 forum thread" };
117
const GLOBALS = [
118
  { key: "runs", group: "play", name: "start a new run", path: "/runs", methods: ["POST"] },
119
  { key: "global", group: "meta", name: "leaderboard", path: "/leaderboard", methods: ["GET", "HEAD", "OPTIONS"] },
120
  { key: "global", group: "meta", name: "graveyard", path: "/graveyard", methods: ["GET", "HEAD", "OPTIONS"] },
121
];
122
123
let run = null;
124
let linked = [];
125
let techniques = [];
126
let offered = [];
127
let known = new Set();
128
let fresh = new Set();
129
let challenged = false;
130
const etags = {};
131
let target = "/runs";
132
let method = "POST";
133
const values = {};
134
135
const $ = id => document.getElementById(id);
136
137
function short(path) {
138
  return path.replace(/[0-9a-f]{32}/, id => id.slice(0, 6) + "…");
139
}
140
141
function el(tag, props, ...children) {
142
  const node = Object.assign(document.createElement(tag), props || {});
143
  for (const child of children) node.append(child);
144
  return node;
145
}
146
147
function titled(text) {
148
  return text.charAt(0).toUpperCase() + text.slice(1);
149
}
150
151
function technique(name) {
152
  return techniques.find(t => t.name === name);
153
}
154
155
function clashes(a, b) {
156
  const rules = [a.lubricant, b.lubricant];
157
  return rules.includes("required") && rules.includes("forbidden");
158
}
159
160
// The options a field can take right now, or null for free text.
161
function options(name) {
162
  if (name === "technique") return techniques.map(t => t.name);
163
  if (name === "also") {
164
    const first = technique(fieldValue("technique"));
165
    if (!first || !first.intensity) return [""];
166
    const partners = techniques.filter(t => t.intensity && t.name !== first.name && !clashes(first, t));
167
    return [""].concat(partners.map(t => t.name));
168
  }
169
  if (name === "lube") {
170
    const lubes = stocked === null ? ALL_LUBES : ALL_LUBES.filter(l => l === "" || l.includes("/") && !l.startsWith("application/") || stocked.includes(l.replace("application/", "")));
171
    return lubeRule() === "required" ? lubes.filter(Boolean) : lubes;
172
  }
173
  return FIELDS[name].options || null;
174
}
175
176
function raw(name) {
177
  return values[name] ?? FIELDS[name].value ?? "";
178
}
179
180
function fieldValue(name) {
181
  const allowed = options(name);
182
  const value = raw(name);
183
  if (allowed && !allowed.includes(value)) return allowed[0] ?? "";
184
  return value;
185
}
186
187
function lubeRule() {
188
  const picked = [technique(fieldValue("technique")), technique(fieldValue("also"))].filter(Boolean);
189
  if (!picked.some(t => t.lubricant)) return "none";
190
  for (const rule of ["forbidden", "required"]) {
191
    if (picked.some(t => t.lubricant === rule)) return rule;
192
  }
193
  return "optional";
194
}
195
196
function allowedMethods(t) {
197
  return t.key === "run" && !techniques.length ? t.methods.filter(m => m !== "JELQ") : t.methods;
198
}
199
200
function targets() {
201
  const listed = run ? linked : [];
202
  const known = new Set(listed.concat(GLOBALS).map(t => t.path));
203
  const fresh = offered.filter((t, i) => !known.has(t.path) && offered.findIndex(o => o.path === t.path) === i);
204
  return listed.concat(fresh, GLOBALS);
205
}
206
207
function current() {
208
  return targets().find(t => t.path === target) || GLOBALS[0];
209
}
210
211
function chooseTarget(t) {
212
  const allowed = allowedMethods(t);
213
  target = t.path;
214
  method = allowed.includes("JELQ") ? "JELQ" : allowed.find(m => m !== "HEAD" && m !== "OPTIONS") || allowed[0];
215
  render();
216
}
217
218
function renderStats(headers) {
219
  const dangers = Object.fromEntries((headers && headers["x-danger"] || "").split(",").filter(Boolean).map(d => d.trim().split("=")));
220
  renderTable($("progress"), PROGRESS, headers, dangers);
221
  renderTable($("stats"), STATS, headers, dangers);
222
  lastStats = headers || {};
223
}
224
225
function renderTable(table, list, headers, dangers) {
226
  table.replaceChildren();
227
  const stats = list.map(s => s.measured && headers && s.measured.header in headers ? { ...s, ...s.measured, unmeasured: s.header } : s);
228
  for (let i = 0; i < stats.length; i += 2) {
229
    const row = el("tr");
230
    for (const stat of stats.slice(i, i + 2)) {
231
      const value = headers ? headers[stat.header] : undefined;
232
      const done = stat.header === "x-floor-turn" && headers && "x-floor-over" in headers;
233
      const cell = el("td", { style: done ? "color: green; font-weight: bold" : "" }, value === undefined ? "—" : value);
234
      const changed = value === undefined ? null : change(stat, value);
235
      if (changed) cell.append(" ", changed);
236
      const measured = stat.unmeasured in lastStats;
237
      const colour = DANGER_COLOURS[dangers[stat.header.slice(2)]] || (measured ? "green" : "");
238
      row.append(el("th", { align: "left", textContent: stat.label, style: colour ? "color: " + colour : "" }), cell);
239
    }
240
    table.append(row);
241
  }
242
}
243
244
function fromIdeal(arousal) {
245
  const rung = AROUSAL.indexOf(arousal);
246
  return rung < 0 ? AROUSAL.length : Math.abs(rung - AROUSAL.indexOf("Ideal"));
247
}
248
249
function change(stat, value) {
250
  const before = lastStats[stat.header];
251
  if (before === undefined || before === value) return null;
252
  if (stat.header === "x-eq") {
253
    const closer = Math.sign(fromIdeal(before) - fromIdeal(value));
254
    const was = el("b", { textContent: before, style: closer ? "color: " + (closer > 0 ? "green" : "red") : "" });
255
    return el("small", {}, "(was ", was, ")");
256
  }
257
  if (!stat.better) return null;
258
  const delta = parseFloat(value) - parseFloat(before);
259
  if (!(Math.abs(delta) >= 0.005)) return null;
260
  const text = (delta > 0 ? "+" : "") + (stat.places ? delta.toFixed(stat.places) : delta);
261
  return el("b", { textContent: text, style: "color: " + (Math.sign(delta) === stat.better ? "green" : "red") });
262
}
263
264
function renderAlerts(list) {
265
  const box = $("alerts");
266
  box.replaceChildren();
267
  const alerts = [];
268
  let door = null;
269
  for (const [name, value] of list || []) {
270
    if (name === "via") door = titled(value.split(" ").pop()) + " is at the door.";
271
    if (name === "x-observed-by") alerts.push((value === "cat" ? "The cat" : titled(value)) + " is watching.");
272
    if (name === "warning") {
273
      const text = (value.match(/"([^"]*)"/) || [, value])[1];
274
      alerts.push(titled(text) + (/[.!?]$/.test(text) ? "" : "."));
275
    }
276
  }
277
  if (door && !alerts.some(a => a.startsWith(door))) alerts.unshift(door);
278
  const stamina = (list || []).find(([name]) => name === "x-stamina");
279
  if (stamina && stamina[1].startsWith("0/")) alerts.push("Exhausted. HOLD for the refractory period.");
280
  for (const alert of alerts) box.append(el("h2", { textContent: alert }));
281
}
282
283
function renderTargets() {
284
  const box = $("targets");
285
  box.replaceChildren();
286
  const all = targets();
287
  for (const [group, title] of GROUPS) {
288
    const members = all.filter(t => t.group === group);
289
    if (!members.length) continue;
290
    box.append(el("h4", { textContent: title }));
291
    for (const t of members) {
292
      const radio = el("input", { type: "radio", name: "target", checked: t.path === target, onchange: () => chooseTarget(t) });
293
      const name = fresh.has(t.path) ? el("b", { textContent: t.name }) : t.name;
294
      box.append(el("label", {}, radio, " ", name, " ", el("small", { textContent: short(t.path) })), el("br"));
295
    }
296
  }
297
}
298
299
function renderMethods() {
300
  const box = $("methods");
301
  box.replaceChildren();
302
  const allowed = allowedMethods(current());
303
  for (const m of METHODS.filter(m => allowed.includes(m))) {
304
    const radio = el("input", { type: "radio", name: "method", checked: m === method, onchange: () => { method = m; render(); } });
305
    const label = el("label", {}, radio, " ");
306
    label.append(m === "JELQ" ? el("big", {}, el("b", { textContent: "JELQ" })) : m);
307
    box.append(label, " ");
308
  }
309
}
310
311
function fieldNames() {
312
  const t = current();
313
  const key = t.key + " " + method;
314
  let names = BY_TARGET[key] || [];
315
  if (key === "run JELQ") {
316
    const chosen = technique(fieldValue("technique"));
317
    names = ["technique"];
318
    if (options("also").length > 1) names.push("also");
319
    if (chosen && chosen.intensity) names.push("intensity");
320
    if (["required", "optional"].includes(lubeRule())) names.push("lube");
321
  }
322
  const scoped = run && !["runs", "global"].includes(t.key);
323
  const asked = challenged && scoped && !names.includes("authorization");
324
  return (asked ? ["authorization"] : []).concat(names);
325
}
326
327
function renderExcuses() {
328
  const said = excuses.concat(["the truth"]);
329
  $("excuses").replaceChildren(...said.map(e => el("option", {
330
    value: nonce ? 'Digest username="' + e + '", nonce="' + nonce + '"' : 'Excuse "' + e + '"',
331
  })));
332
}
333
334
function renderFields() {
335
  const table = $("fields");
336
  table.replaceChildren();
337
  for (const name of fieldNames()) {
338
    const f = FIELDS[name];
339
    let value = fieldValue(name);
340
    if (name === "ifMatch" && !value) value = values.ifMatch = etags[current().path] || "";
341
    const choices = options(name);
342
    let input;
343
    if (choices) {
344
      const isNew = o => ["technique", "also"].includes(name) && fresh.has("technique " + o);
345
      input = el("select", {}, ...choices.map(o => el("option", { value: o, textContent: o || "(none)", selected: o === value, style: isNew(o) ? "font-weight: bold" : "" })));
346
    } else if (f.kind === "textarea") {
347
      input = el("textarea", { rows: 3, cols: 40, value, placeholder: f.placeholder || "" });
348
    } else {
349
      const hint = name === "authorization" && nonce ? 'Digest username="helping Nan", nonce="' + nonce + '"' : f.placeholder || "";
350
      input = el("input", { type: f.kind, value, placeholder: hint, size: 30 });
351
    }
352
    input.oninput = () => { values[name] = input.value; };
353
    input.onchange = () => { values[name] = input.value; if (choices) renderFields(); };
354
    if (name === "authorization") input.setAttribute("list", "excuses");
355
    table.append(el("tr", {}, el("td", { align: "right", valign: "top", textContent: f.label }), el("td", {}, input)));
356
  }
357
  const extra = el("textarea", { rows: 3, cols: 40, value: raw("extra"), placeholder: FIELDS.extra.placeholder });
358
  extra.oninput = () => { values.extra = extra.value; };
359
  const more = el("details", { open: Boolean(values.extra) }, el("summary", { textContent: "more headers" }), extra);
360
  table.append(el("tr", {}, el("td"), el("td", {}, more)));
361
  $("send").value = method + " " + short(current().path);
362
}
363
364
function render() {
365
  if (!allowedMethods(current()).includes(method)) return chooseTarget(current());
366
  renderTargets();
367
  renderMethods();
368
  renderFields();
369
}
370
371
function parseLinks(header) {
372
  const resources = [];
373
  const moves = [];
374
  for (const match of header.matchAll(/<([^>]*)>((?:\s*;\s*[a-z-]+="[^"]*")*)/g)) {
375
    const params = Object.fromEntries([...match[2].matchAll(/([a-z-]+)="([^"]*)"/g)].map(p => [p[1], p[2]]));
376
    const name = (params.rel || "").replace(REL, "");
377
    if (name === "technique") {
378
      moves.push({ name: params.title, lubricant: params.lubricant || null, intensity: params.intensity || null });
379
      continue;
380
    }
381
    const methods = (params.allow || "GET").split(",").map(s => s.trim());
382
    resources.push({ key: name, group: GROUP_OF[name] || "play", name: NAMES[name] || params.title || name, path: match[1], methods });
383
  }
384
  return [resources, moves];
385
}
386
387
function hrefs(value, found) {
388
  if (value && typeof value === "object") {
389
    if (typeof value.href === "string") {
390
      const name = value.title || value.item || value.name || value.href.split("/").pop();
391
      found.push({ key: "offered", group: "said", name, path: value.href, methods: [value.method || "GET"] });
392
    }
393
    for (const key in value) hrefs(value[key], found);
394
  }
395
  return found;
396
}
397
398
function log(text) {
399
  $("log").prepend(text + "\n\n");
400
  $("frame").scrollTop = 0;
401
}
402
403
function describe(r) {
404
  const lines = ["< " + r.status + " " + r.reason];
405
  for (const [name, value] of r.headers) {
406
    if (!QUIET.has(name)) lines.push("< " + name + ": " + short(value));
407
  }
408
  let body = null;
409
  try { body = JSON.parse(r.body); } catch (e) {}
410
  if (body && typeof body === "object") {
411
    const rest = Object.assign({}, body);
412
    if (rest.detail) lines.push("  " + rest.detail);
413
    for (const key of ["type", "title", "status", "detail"]) delete rest[key];
414
    if (Object.keys(rest).length) lines.push(short(JSON.stringify(rest, null, 2)).replace(/^/gm, "  "));
415
  } else if (r.body) {
416
    const range = (r.headers.find(h => h[0] === "content-range") || [])[1] || "";
417
    const partial = r.status === 206 && range.match(/^bytes (\d+)-(\d+)\/(\d+)$/);
418
    lines.push("  " + r.body);
419
    if (partial) lines.push("  [bytes " + partial[1] + "-" + partial[2] + " of " + partial[3] + ". Half-mast.]");
420
  }
421
  return lines.join("\n");
422
}
423
424
function absorb(r, sentPath) {
425
  const headers = Object.fromEntries(r.headers.map(([n, v]) => [n.toLowerCase(), v]));
426
  if (headers.etag) etags[sentPath] = headers.etag;
427
  const digest = (headers["www-authenticate"] || "").match(/nonce="([^"]*)"/);
428
  if ("www-authenticate" in headers) nonce = digest ? digest[1] : null;
429
  renderExcuses();
430
  let body = null;
431
  try { body = JSON.parse(r.body); } catch (e) {}
432
  const started = r.status === 201 && (sentPath === "/runs" || sentPath.startsWith("/runs?"));
433
434
  if (started) {
435
    run = headers.location;
436
    lastStats = {};
437
    log("--- a new run has started at " + short(run) + " ---");
438
  }
439
  if ("x-eq" in headers) {
440
    renderStats(headers);
441
    renderAlerts(r.headers);
442
    challenged = r.status === 401 || "via" in headers;
443
  }
444
  if (headers.link) [linked, techniques] = parseLinks(headers.link);
445
  if (run) {
446
    const active = run;
447
    const seq = ++inventorySeq;
448
    fetch("/ui/send", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ method: "GET", path: run + "/inventory", headers: [], body: "" }) })
449
      .then(r => r.json())
450
      .then(r => {
451
        if (run !== active || seq !== inventorySeq) return;
452
        try {
453
          const held = JSON.parse(r.body);
454
          stocked = (held.items || []).map(i => i.name);
455
          excuses = held.excuses || [];
456
          renderExcuses();
457
          render();
458
        } catch (e) {}
459
      });
460
  }
461
  offered = body ? hrefs(body, []) : [];
462
  if (headers.location && !started) {
463
    offered.unshift({ key: "offered", group: "said", name: short(headers.location).split("/").pop() + " (Location)", path: headers.location, methods: ["GET"] });
464
  }
465
  if (run && "x-run-over" in headers) {
466
    log("--- the run has ended ---");
467
    renderAlerts(null);
468
    challenged = false;
469
    run = null;
470
    linked = [];
471
    techniques = [];
472
  }
473
  const menu = targets().filter(t => t.group !== "said").map(t => t.path).concat(techniques.map(t => "technique " + t.name));
474
  fresh = started ? new Set() : new Set(menu.filter(m => !known.has(m)));
475
  known = new Set(menu);
476
  if (started || !targets().some(t => t.path === target)) {
477
    const home = linked.find(t => t.key === "run");
478
    chooseTarget(home || GLOBALS[0]);
479
  } else {
480
    render();
481
  }
482
}
483
484
async function go(event) {
485
  event.preventDefault();
486
  const t = current();
487
  const key = t.key + " " + method;
488
  const value = name => fieldValue(name).trim();
489
  const headers = [];
490
  let path = t.path;
491
  for (const name of fieldNames()) {
492
    const f = FIELDS[name];
493
    if (f.header && value(name)) headers.push([f.header, value(name)]);
494
  }
495
  if (fieldNames().includes("upgrade") && value("upgrade")) headers.push(["Connection", "upgrade"]);
496
  for (const line of raw("extra").split("\n")) {
497
    const at = line.indexOf(":");
498
    if (at > 0) headers.push([line.slice(0, at).trim(), line.slice(at + 1).trim()]);
499
  }
500
  if (key === "run JELQ") {
501
    const names = fieldNames();
502
    const chosen = [value("technique")].concat(names.includes("also") && value("also") ? [value("also")] : []);
503
    path += "?technique=" + encodeURIComponent(chosen.join(","));
504
    if (names.includes("intensity")) path += "&intensity=" + encodeURIComponent(value("intensity"));
505
    delete values.also;
506
  }
507
  if (key === "runs POST" && value("seed")) path += "?seed=" + encodeURIComponent(value("seed"));
508
509
  const sent = ["> " + method + " " + short(path)].concat(headers.map(([name, v]) => "> " + name + ": " + v)).join("\n");
510
  delete values.authorization;
511
  headers.push(["Accept-Language", $("locale").value]);
512
  let r;
513
  try {
514
    const response = await fetch("/ui/send", {
515
      method: "POST",
516
      headers: { "Content-Type": "application/json" },
517
      body: JSON.stringify({ method, path, headers }),
518
    });
519
    r = await response.json();
520
  } catch (error) {
521
    log(sent + "\n! The server did not answer. Is jelqd still running? (" + error.message + ")");
522
    return;
523
  }
524
  if (!Array.isArray(r.headers)) {
525
    log(sent + "\n! The page could not read that reply:\n  " + JSON.stringify(r));
526
    return;
527
  }
528
  log(sent + "\n" + describe(r));
529
  absorb(r, path);
530
}
531
532
$("form").onsubmit = go;
533
$("locale").value = localStorage.getItem("locale") || "en-GB";
534
$("locale").onchange = () => localStorage.setItem("locale", $("locale").value);
535
renderStats(null);
536
render();
537
log("Welcome. Choose \"start a new run\" and send POST to begin. The newest turn is always at the top.");
538
</script>
539
</body>
540
</html>