atagen

jelq

public

an http based roguelike rpg about jelqing

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