// GameAnything-Bench task submission page (static). Texts, choices and limits come from data.json, which
// export_static.py writes from validator.py / texts.py / examples.py; the checks below mirror validator.py.
// A submission becomes a pull request on the private dataset REPO. With D.submit_url set, the form is posted to
// server.py, which checks it again and opens the pull request (no account needed). Without it, the person signs in
// with Hugging Face and the page opens the pull request with their own token (works for organisation members only).
import {oauthLoginUrl, oauthHandleRedirectIfPresent, uploadFiles} from "https://cdn.jsdelivr.net/npm/@huggingface/hub@0.18.2/+esm";
const REPO = {type: "dataset", name: "GameAnything/gameanything-submissions"};
const $ = (s, el = document) => el.querySelector(s), $$ = (s, el = document) => [...el.querySelectorAll(s)];
const esc = s => String(s).replace(/[&<>"]/g, c => ({"&": "&", "<": "<", ">": ">", '"': """}[c]));
const LOCAL = { // texts only this page needs
signin: ["Sign in with Hugging Face", "用 Hugging Face 登录"],
signin_why: ["Needed to submit. You can fill the form first; what you type is kept.", "提交时需要登录。可以先填表,已填的内容会保留。"],
signed: ["Signed in as", "已登录:"],
need_signin: ["Please sign in with Hugging Face first (above the form). What you typed is kept.", "请先用 Hugging Face 登录(在表单上方)。已填的内容会保留。"],
sending: ["Submitting…", "正在提交……"],
no_access: ["Your account cannot write to the submissions repository yet. Ask a maintainer for access to the GameAnything organisation.",
"你的账号还没有提交仓库的写权限,请联系维护者加入 GameAnything 组织。"],
drop: ["Click to choose files, or drop them here", "点击选择文件,或拖到这里"],
drop_sub: ["png · jpg · webp · mp4 · webm · mov · txt · md", "png · jpg · webp · mp4 · webm · mov · txt · md"],
sec_ref: ["Reference", "素材"], sec_task: ["Task", "题目"], sec_you: ["Credit", "署名"],
h_len: ["{a}–{b} {u}", "{a}–{b} {u}"], h_where: ["pick where the reference shows it", "请选素材里的位置"],
cta_start: ["Write a challenge ↓", "开始出题 ↓"], cta_example: ["See an example first", "先看一道例题"],
ex_s1: ["The reference", "带来的素材"], ex_s2: ["What the AI should build", "想让 AI 做成什么"], ex_s3: ["What counts as done", "怎样算做对"],
ex_s3_more: ["{n} scoring points in all; one of each kind is shown here.", "这道题一共 {n} 条评分点,这里每类只列一条。"],
exbar: ["Examples", "参考例子"], exbar_sub: ["Click into any field and the example's answer for that field appears under it.", "点进任何一栏,它下面就会出现例题在这一栏的写法。"],
ex_all_open: ["Show all", "全部展开"], ex_all_close: ["Hide all", "全部收起"], ex_open: ["See the example for this field ▾", "看这一栏的例子 ▾"],
ex_label: ["Example", "例子"], ex_close: ["Hide", "收起"],
f_img: ["img", "图"], f_video: ["video", "视频"], f_text: ["text", "文本"], f_paras: ["{n} paragraphs", "{n} 段"], f_remove: ["Remove", "移除"],
clip_a: ["Set clip start here", "设为片段开始"], clip_b: ["Set clip end here", "设为片段结束"],
p_pick: ["Where the reference shows it:", "素材里哪里能看到:"],
p_pick_none: ["Where the reference shows it (add your reference above and you can simply pick here):", "素材里哪里能看到(先在上面“素材”里上传文件或贴链接,这里就能直接点选):"],
p_time_ph: ["time, e.g. 0:35–0:40", "时间,如 0:35–0:40"], p_now: ["Current time", "取当前时间"], p_para_add: ["+ pick a paragraph…", "+ 选段落…"],
para: ["para {n}", "第 {n} 段"], strip: ["Play the clip here. “Current time” in a point fills in where the player is.", "在这里播放视频;在某条评分点里点“取当前时间”,就会填入当前播放位置。"],
h_negative: ["write what must be there, not what must be absent", "请写“要有什么”,不要写“不能有什么”"],
h_vague: ["name something that can be seen or tried", "请写看得到、试得出的具体内容"],
ex_ref: ["Reference", "素材"], ex_fit: ["Why this game fits", "为什么适合这款游戏"],
ex_idea: ["What should the AI build?", "想让 AI 做成什么"], ex_edit: ["Follow-up edit", "后续修改"], hours_ph: ["Hours played…", "玩了多久……"],
};
let D, lang = "en", OA = null, screenState = null, verdictShown = false, files = [], modFiles = [], exTab = 0, exOpen = new Set(), exAuto = new Set();
// form zones: clicking into one shows the example's answer for it (once; after that the person decides)
const ZONE = {fit: "#fit", ref: "#drop, #link, #time_range", category: "#category", idea: "#idea", edit: "#edit",
content: "#content_rows", function: "#function_rows", visual: "#visual_rows"};
const li = () => D.langs.indexOf(lang);
const fmt = (s, kw = {}) => s.replace(/\{(\w+)(?::\.(\d)f)?\}/g, (_, k, p) => p != null ? Number(kw[k]).toFixed(+p) : kw[k] ?? "");
const t = (k, kw) => fmt((D.text[k] || LOCAL[k])[li()], {u: D.unit[lang], ...kw}), msg = (k, kw) => fmt(D.msg[k][li()], {u: D.unit[lang], ...kw});
const rich = s => esc(s).replace(/\*\*(.+?)\*\*/g, "$1").replace(/`(.+?)`/g, "$1").replace(/^### (.*)$/m, "
$1
").replace(/\n\n/g, " ");
// ---------------------------------------------------------------- checks (mirror of validator.py)
const CJK = /[㐀-鿿]/g, WORD = /\p{L}+|\d+/gu;
const cjkN = s => (s.match(CJK) || []).length, wordN = s => (s.replace(CJK, " ").match(WORD) || []).length;
const size = s => lang === "zh" ? cjkN(s) + Math.floor((3 * wordN(s) + 1) / 2) : wordN(s) + Math.floor((2 * cjkN(s) + 2) / 3);
const lim = k => D.limits[k].map(x => Math.floor(x * D.scale[lang]));
const WHERE = /\d{1,2}:\d{2}|图\s*\d|第\s*\d+\s*[段张页章幕]|\b(imgs?|images?|photos?|pictures?|figs?|paras?|paragraphs?|ch|chapters?|pages?|pp?)\.?\s*\d|段落|开头|结尾|\b(opening|ending|first|last) (scene|shot|line|paragraph|image)/i;
const RANGE = /^\s*(\d{1,2}:)?\d{1,2}:\d{2}(\.\d+)?\s*[-–~到至]\s*(\d{1,2}:)?\d{1,2}:\d{2}(\.\d+)?\s*$/;
const NEGATIVE = /^\s*(no\b|not\b|never\b|don'?t\b|must not\b|should not\b|without\b|不能|不要|不可|不许|没有|禁止)/i;
const VAGUE = /\b(awesome|beautiful|realistic|faithful|accurate|high[- ]quality|looks? like the (video|image|reference|original))\b|好看|好玩|逼真|还原度高|高质量|精美|酷炫|和(原片|视频|图片|素材)一样/i;
const ext = n => (n.match(/\.[^.]+$/) || [""])[0].toLowerCase();
const kind = n => D.ext.image.includes(ext(n)) ? "image" : D.ext.video.includes(ext(n)) ? "video" : D.ext.text.includes(ext(n)) ? "text" : "";
const norm = p => p.replace(/[((][^()()]*[))]/g, " ").replace(/[^\p{L}\p{N}]+/gu, " ").trim().toLowerCase();
const seconds = x => x.trim().split(":").reduce((a, b) => a * 60 + parseFloat(b), 0);
const clipBounds = r => r.trim().split(/\s*[-–~到至]\s*/).map(seconds);
const lowEffort = s => { const tk = [...(s.match(CJK) || []), ...(s.replace(CJK, " ").match(WORD) || [])].map(x => x.toLowerCase());
return /(.)\1{4,}/u.test(s) || (tk.length >= 10 && new Set(tk).size / tk.length < 0.34); };
const quote = xs => xs.map(x => `“${x.length <= 44 ? x : x.slice(0, 42) + "…"}”`).join(" / ");
const pointIssue = p => { const [a, b] = lim("point"), n = size(p.text); return n < a || n > b ? "len" : NEGATIVE.test(p.text) ? "negative" : VAGUE.test(p.text) ? "vague" : !WHERE.test(p.where) ? "where" : ""; };
function knownGames(genres) {
const ids = [];
for (const [, g] of D.choices.genres.en) if (genres.includes(g)) for (const id of D.genre_games[g]) if (!ids.includes(id)) ids.push(id);
if (genres.includes("other")) for (const id of D.game_ids) if (!ids.includes(id)) ids.push(id);
return ids;
}
function screen(genres, modding) { // genres: {kind: hours band}
const kinds = Object.keys(genres);
if (!kinds.length) return {ok: false, message: msg("need_genre")};
if (kinds.some(g => !genres[g])) return {ok: false, message: msg("need_hours_answer")};
if (!modding) return {ok: false, message: msg("need_modding_answer")};
const first = knownGames(kinds); // nobody is turned away: every game is open, those of the ticked kinds first
return {ok: true, games: [...first, ...D.game_ids.filter(id => !first.includes(id))]};
}
const videoSeconds = f => new Promise(res => { const v = document.createElement("video"); v.preload = "metadata";
v.onloadedmetadata = () => { URL.revokeObjectURL(v.src); res(v.duration); }; v.onerror = () => res(NaN); v.src = URL.createObjectURL(f); });
async function check(v) {
const errors = [], warnings = [], M = D.max, L = D.limits, MB = 1e6;
if (!screenState) return {errors: [msg("screen_first")]};
const points = v.points;
if (v.game === D.new_game) { const g = v.new_game, [na, nb] = lim("new_modding"), n = size(g.modding);
if (g.name.length < 2 || g.name.length > 60) errors.push(msg("new_name"));
if (!/^https?:\/\/\S+$/.test(g.link)) errors.push(msg("new_link"));
if (n < na || n > nb) errors.push(msg("new_modding_len", {a: na, b: nb, n})); else if (lowEffort(g.modding)) errors.push(msg("low_effort", {x: g.modding.slice(0, 44)}));
if (!g.help) errors.push(msg("new_help")); }
else if (!D.game_track[v.game]) errors.push(msg("game"));;
if (v.mod_link && !/^https?:\/\/\S+$/.test(v.mod_link)) errors.push(msg("mod_link"));
if (modFiles.length > L.mod_files) errors.push(msg("mod_files_max", {m: L.mod_files, n: modFiles.length}));
for (const f of modFiles) { const k = kind(f.name);
if (k !== "image" && k !== "video") errors.push(msg("mod_file_type", {x: f.name})); else if (f.size > M[k]) errors.push(msg("file_big", {x: f.name, s: f.size / MB, c: M[k] / MB})); }
if (!v.category) errors.push(msg("category"));
if (!v.license) errors.push(msg("license"));
if (!files.length && !v.link) errors.push(msg("no_ref"));
if (v.link && !/^https?:\/\/\S+$/.test(v.link)) errors.push(msg("link"));
if (v.time_range && !RANGE.test(v.time_range)) errors.push(msg("range"));
if (files.length > M.files) errors.push(msg("max_files", {m: M.files, n: files.length}));
let total = 0;
for (const f of files) {
total += f.size; const k = kind(f.name);
if (!k) { errors.push(msg("file_type", {x: f.name})); continue; }
if (!f.size) errors.push(msg("file_empty", {x: f.name}));
if (f.size > M[k]) errors.push(msg("file_big", {x: f.name, s: f.size / MB, c: M[k] / MB}));
}
if (total > M.total) errors.push(msg("total_big", {s: total / MB, c: M.total / MB}));
const kinds = files.map(f => kind(f.name)), hasVideo = kinds.includes("video"), [c0, c1] = L.clip_seconds;
if (v.license === "third_party") { if (files.length) errors.push(msg("third_files")); if (!v.link) errors.push(msg("third_link")); }
if (["public_domain", "cc"].includes(v.license) && !v.source) errors.push(msg("source"));
if (v.link && !files.length && !v.time_range) warnings.push(msg("w_range_link"));
let clip = null;
if (v.time_range && RANGE.test(v.time_range)) { clip = clipBounds(v.time_range); const n = Math.round(clip[1] - clip[0]); if (n < c0 || n > c1) errors.push(msg("clip_len", {a: c0, b: c1, x: v.time_range, n})); }
else if (hasVideo) for (const f of files.filter(f => kind(f.name) === "video")) { // a whole uploaded video is the reference
const n = Math.round(await videoSeconds(f));
if (n > c1) errors.push(msg("clip_len", {a: c0, b: c1, x: f.name, n})); else if (!(n >= c0)) warnings.push(msg("w_range_video"));
}
if (kinds.length && kinds.every(k => k === "image") && !v.link && files.length < L.images) errors.push(msg("few_images", {m: L.images, n: files.length}));
const tm = Math.floor(L.text_units * D.scale[lang]);
for (const f of files) if (kind(f.name) === "text" && f.size <= M.text) { const n = size(await f.text()); if (n < tm) errors.push(msg("short_text", {x: f.name, n, m: tm})); }
const length = (key, text, label) => { const [a, b] = lim(key), n = size(text); if (n < a || n > b) errors.push(msg(label, {a, b, n})); };
length("idea", v.idea, "idea_len"); length("fit", v.fit, "fit_len"); if (v.edit) length("edit", v.edit, "edit_len");
for (const d of D.dims) { const k = points[d.id].length, name = d.label[li()];
if (k < d.min) errors.push(msg("dim_min", {d: name, m: d.min, n: k}));
if (k > L.points_per_dim) errors.push(msg("dim_max", {d: name, m: L.points_per_dim, n: k})); }
const flat = D.dims.flatMap(d => points[d.id]), texts = flat.map(p => p.text), norms = texts.map(norm), [a, b] = lim("point"), all = [v.idea, v.fit, v.edit, ...texts].filter(Boolean);
for (const [key, bad] of [["point_len", texts.filter(x => size(x) < a || size(x) > b)], ["point_where", flat.filter(p => !WHERE.test(p.where)).map(p => p.text || "…")],
["point_negative", texts.filter(x => NEGATIVE.test(x))], ["point_vague", texts.filter(x => VAGUE.test(x))],
["point_dup", [...new Set(texts.filter(x => x && norms.filter(y => y === norm(x)).length > 1))].sort()],
["low_effort", all.filter(lowEffort)], ["copied", all.filter(x => D.copied.includes(norm(x)))]])
if (bad.length) errors.push(msg(key, {a, b, x: quote(bad)}));
const nImg = kinds.filter(k => k === "image").length;
if (nImg && !v.link) { const cited = flat.flatMap(p => [...p.where.matchAll(/(?:imgs?|images?|photos?|pictures?|图)\.?\s*(\d+)/gi)].map(m => +m[1]));
if (cited.length && Math.max(...cited) > nImg) errors.push(msg("where_img", {n: Math.max(...cited), m: nImg})); }
if (clip) for (const p of flat) { const out = (p.where.match(/\d{1,2}:\d{2}(?::\d{2})?/g) || []).filter(x => !((clip[0] - 1 <= seconds(x) && seconds(x) <= clip[1] + 1) || seconds(x) <= clip[1] - clip[0] + 1));
if (out.length) { errors.push(msg("where_time", {x: out[0], r: v.time_range})); break; } }
const visibility = v.license === "third_party" ? "private" : "public";
if (visibility === "private") warnings.push(msg("w_private"));
if (!v.ack) errors.push(msg("ack"));
if (v.nickname.length < 1 || v.nickname.length > 40) errors.push(msg("nickname"));
if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(v.email)) errors.push(msg("email"));
if (!v.consent) errors.push(msg("consent"));
if (errors.length) return {errors};
const ks = new Set(kinds);
if (v.link && (v.time_range || !ks.size)) ks.add("video");
return {errors, warnings, points, visibility, modality: ks.size > 1 ? "hybrid" : [...ks][0] || "video"};
}
// ---------------------------------------------------------------- reading the form
const radio = name => ($(`input[name=${name}]:checked`) || {}).value || "";
const boxes = name => $$(`input[name=${name}]:checked`).map(x => x.value);
const val = id => $("#" + id).value.trim();
const genreHours = () => Object.fromEntries(boxes("genres").map(g => [g, ($(`#hours select[data-g=${g}]`) || {}).value || ""]));
const readPoints = () => Object.fromEntries(D.dims.map(d => [d.id, $$(`#${d.id}_rows .point`).map(r => ({text: $("textarea", r).value.trim(), where: whereOf(r)}))
.filter(p => p.text || p.where)]));
const draftPoints = () => Object.fromEntries(D.dims.map(d => [d.id, $$(`#${d.id}_rows .point`).map(r => ({text: $("textarea", r).value, imgs: r._ref.imgs, paras: r._ref.paras, extra: $("input", r).value}))]));
// the reference, by kind; images are numbered in upload order (img 1, img 2 ...), paragraphs run through the text files
const imgFiles = () => files.filter(f => kind(f.name) === "image"), vidFiles = () => files.filter(f => kind(f.name) === "video");
const paras = () => files.filter(f => kind(f.name) === "text").flatMap(f => f._paras || []);
const clock = s => `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, "0")}`;
const splitParas = s => { const a = s.replace(/\r/g, "").split(/\n\s*\n/).map(x => x.trim()).filter(Boolean); return a.length > 1 ? a : s.split(/\n/).map(x => x.trim()).filter(Boolean); };
function whereOf(row) { // the location as text, e.g. "img 2; img 3" or "0:35–0:40"
const r = row._ref, nI = imgFiles().length, nP = paras().length, tp = $(".timepick", row);
return [...r.imgs.filter(n => n <= nI).sort((a, b) => a - b).map(n => `${t("f_img")} ${n}`), ...r.paras.filter(n => n <= nP).sort((a, b) => a - b).map(n => t("para", {n})),
...(tp.hidden ? [] : [$("input", tp).value.trim()])].filter(Boolean).join(lang === "zh" ? ";" : "; ");
}
const isMaker = () => D.makers.includes(radio("modding"));
const form = () => ({game: radio("game"), new_game: {name: val("new_name"), link: val("new_link"), modding: val("new_modding"), help: radio("new_help")},
mod_link: isMaker() ? val("mod_link") : "", mod_note: isMaker() ? val("mod_note").slice(0, 300) : "", category: radio("category"), link: val("link"), time_range: val("time_range"), license: radio("license"),
source: val("source"), fit: val("fit"), idea: val("idea"), points: readPoints(), edit: val("edit"), nickname: val("nickname"), email: val("email"),
ack: $("#ack").checked, consent: $("#consent").checked});
// ---------------------------------------------------------------- rendering
function options(el, name, type, key) { // radio / checkbox group that keeps its answers across languages
const keep = type === "radio" ? [radio(name)] : boxes(name);
el.innerHTML = D.choices[key][lang].map(([label, id]) => {
const [a, b] = label.split(" → ");
return ``;
}).join("");
}
function renderHours(preset) { // one hours question per ticked kind
const keep = preset || genreHours(), label = Object.fromEntries(D.choices.genres[lang].map(([l, id]) => [id, l.split(" → ")[0]]));
const kinds = boxes("genres");
$("#hours").innerHTML = kinds.length ? kinds.map(g => ``).join("")
: `
`).join("")}`;
function renderExample() { // top of the page: reference -> what to build -> what counts as done
const e = D.examples[exTab], i = li(), n = D.dims.reduce((s, d) => s + e.points[d.id].length, 0);
$$("#ex_tabs button, #exf_tabs button").forEach(b => { const on = +b.dataset.i === exTab; b.classList.toggle("on", on); b.setAttribute("aria-selected", on); });
const brief = D.dims.map(d => { const p = e.points[d.id][0]; return `
${esc(d.label[i])}
${esc(p[i])}${esc(p[2 + i])}
`; }).join("");
const head = (k, key) => `
${k}${t(key)}
`;
$("#ex_body").innerHTML = `
${head(1, "ex_s1")}${exMedia(e)}
${esc(e.reference[i])}
` +
`
${head(2, "ex_s2")}
${esc(e.game[i])}${esc(e.category[i])}
${esc(e.idea[i])}
` +
`
${head(3, "ex_s3")}
${brief}
${t("ex_s3_more", {n})}
`;
renderHints();
}
function renderHints() { // in the form: under each field, what the chosen example wrote there
const e = D.examples[exTab], i = li(), pts = d => `${e.points[d].map(p => `
${esc(p[i])}${esc(p[2 + i])}
`).join("")}`;
const hint = {fit: `
${esc(e.game[i])}: ${esc(e.fit[i])}
`, ref: `${exMedia(e)}
${esc(e.reference[i])}
${e.credit ? `
${esc(e.credit)}
` : ""}`,
category: `
${esc(e.category[i])}
`, idea: `
${esc(e.idea[i])}
`, edit: `
${esc(e.edit[i])}
`, content: pts("content"), function: pts("function"), visual: pts("visual")};
const segs = D.examples.map((x, n) => ``).join("");
for (const el of $$(".exhint")) { const k = el.dataset.ex;
el.innerHTML = exOpen.has(k) ? `
${t("ex_label")}${segs}` +
`
${hint[k]}
`
: ``; }
$("#ex_all").textContent = t(exOpen.size === $$(".exhint").length ? "ex_all_close" : "ex_all_open");
}
function counters() {
for (const k of ["idea", "fit", "edit", "new_modding"]) { const [a, b] = lim(k), n = size($("#" + k).value), c = $(`#${k}_n`);
c.textContent = n || k !== "edit" ? `${n} / ${a}–${b} ${D.unit[lang]}` : ""; c.className = "count " + (!n ? "" : n >= a && n <= b ? "good" : "bad"); }
const [a, b] = lim("point"); let total = 0;
for (const d of D.dims) for (const r of $$(`#${d.id}_rows .point`)) {
const p = {text: $("textarea", r).value.trim(), where: whereOf(r)}, c = $(".count", r), n = size(p.text), issue = p.text ? pointIssue(p) : "";
if (p.text && !issue) total++;
c.textContent = !p.text ? "" : `${n} ${D.unit[lang]}` + (issue ? ` · ${t("h_" + issue, {a, b})}` : " ✓"); c.className = "count " + (!p.text ? "" : issue ? "bad" : "good");
}
const need = D.dims.reduce((s, d) => s + d.min, 0), tt = $("#pts_n"); tt.textContent = `${total} ✓`; tt.className = "pill " + (total >= need ? "good" : "");
}
function render() {
document.documentElement.lang = lang === "zh" ? "zh-CN" : "en"; document.title = t("title").replace(/\*/g, "");
$("#title").innerHTML = esc(t("title")).replace(/\*(.+?)\*/, "$1");
const home = D.links.find(([k]) => k === "l_home"); if (home) $("#brand").href = home[1];
$$("#lang button").forEach(b => { b.classList.toggle("on", b.dataset.lang === lang); b.setAttribute("aria-pressed", b.dataset.lang === lang); });
$("#links").innerHTML = D.links.filter(([k]) => k !== "l_home").map(([k, url]) => `${t(k)}`).join("");
for (const id of ["#ex_tabs", "#exf_tabs"]) $(id).innerHTML = D.examples.map((e, k) => ``).join("");
renderFiles(); renderStrip();
$$("#ex_tabs button, #exf_tabs button").forEach(b => b.onclick = () => { exTab = +b.dataset.i; renderExample(); });
renderExample();
for (const el of $$("[data-t]")) el.textContent = t(el.dataset.t);
for (const el of $$("[data-ph]")) el.placeholder = t(el.dataset.ph);
options($("#genres"), "genres", "checkbox", "genres"); renderHours();
options($("#modding"), "modding", "radio", "modding"); options($("#category"), "category", "radio", "categories");
options($("#license"), "license", "radio", "licenses"); options($("#new_help"), "new_help", "radio", "new_help");
fillGames(); showMod(); labelRows(); $("#notes").innerHTML = D.notes[lang]; renderAuth(); counters();
if (verdictShown) showVerdict();
$("#result").innerHTML = ""; $("#result").className = ""; stale();
}
const stale = () => { $("#submit").disabled = true; };
// ---------------------------------------------------------------- actions
function doScreen() {
const s = showVerdict(); verdictShown = true;
screenState = s.ok ? {genres: genreHours(), genre_other: val("genre_other").slice(0, 200), modding: radio("modding"), profile: val("profile").slice(0, 300), games: s.games} : null;
if (s.ok) fillGames();
const was = $("#form").hidden; $("#form").hidden = !s.ok;
if (s.ok && (was || !radio("game"))) $("#s2").scrollIntoView({behavior: "smooth", block: "start"});
}
function resync() { // the kinds or hours changed after the form was opened: the target-game list follows at once
if (!screenState) return;
const s = screen(genreHours(), radio("modding"));
if (s.ok) { screenState = {...screenState, genres: genreHours(), modding: radio("modding"), games: s.games}; fillGames(); showVerdict(); }
}
async function doCheck() {
const v = form(), r = await check(v), box = $("#result");
if (r.errors.length) { box.className = "bad"; box.innerHTML = `