From 637c8f125abc8fa318eed38ad189505633147b18 Mon Sep 17 00:00:00 2001 From: gator Date: Tue, 22 Sep 2026 11:33:32 +0000 Subject: [PATCH] Cast page: the character's description is editable and saved to every draft of the chapter --- looks.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/looks.html b/looks.html index e831dfa..f53c736 100644 --- a/looks.html +++ b/looks.html @@ -44,6 +44,11 @@
+

Who they are (the words every picture is drawn from)

+ + +
+
@@ -112,6 +117,7 @@ + '
'; var lc = C.look_candidates || {}; if (!$("looks").innerHTML) { + $("appearance").value = C.appearance || ""; $("wardrobe").value = C.wardrobe || ""; var start = lc.looks && lc.looks.length ? lc.looks : (/dorothy/i.test(C.id + " " + C.name) ? DOROTHY : [{ name: "As written", wear: C.wardrobe || "", setting: "" }, { name: "", wear: "", setting: "" }]); $("looks").innerHTML = lookHtml(0, start[0] || {}) + lookHtml(1, start[1] || {}); cost(); @@ -143,10 +149,21 @@ } document.addEventListener("input", function (e) { if (e.target.closest("#form")) cost(); }); + async function saveWho() { + var ap = $("appearance").value.trim(), wd = $("wardrobe").value.trim(); + if (ap === (C.appearance || "") && wd === (C.wardrobe || "")) return true; + var r = await api("set_character", { draft_id: DID, character_id: CID, appearance: ap, wardrobe: wd }); + if (!r.ok) { msg(r.error || "The description did not save."); return false; } + C.appearance = ap; C.wardrobe = wd; + $("saved").textContent = "Saved to " + r.drafts + " drafts of this chapter."; + return true; + } + $("save").addEventListener("click", saveWho); $("draw").addEventListener("click", async function () { var looks = readLooks(); if (!looks.length) { msg("Say what they wear in at least one look."); return; } msg(""); + if (!(await saveWho())) return; $("draw").disabled = true; var r = await api("look_candidates", { draft_id: DID, character_id: CID, looks: looks, n: parseInt($("n").value, 10) || 2 }); if (!r.ok) { msg(r.error || "That did not start."); $("draw").disabled = false; return; }