diff --git a/manuscript.html b/manuscript.html index 2a51855..2340915 100644 --- a/manuscript.html +++ b/manuscript.html @@ -70,9 +70,26 @@
How the chapter divides into scenes for filming: which paragraphs each covers, and so which pages. Recorded as yours.
+ + + +Key changes in this chapter, who made them, and how. For internal records.
+ + +The standing choices that shape the whole adaptation, in your own words. Each is dated and kept in the record. Anything drafted for you is drafted from these.
@@ -114,6 +131,7 @@ navBar("book"); if (!Session.get()) { location.href = "/register.html?next=" + encodeURIComponent(location.pathname + location.search); return; } var Q = new URLSearchParams(location.search); + var PLATES = [], SCENES = [], EDITION = ""; var AID = Q.get("book") || "", AD = null, TOC = [], DEC = [], CH = null, PARAS = [], REFS = [], PAGE = 1, SEL = null, LOGCHAP = true, POLL = null; function $(id) { return document.getElementById(id); } function msg(t, kind) { var m = $("msg"); m.className = "msg " + (kind || "err"); m.textContent = t; if (!t) m.className = "msg"; } @@ -162,7 +180,7 @@ async function openChapter(n, page) { var r = await api("adapt_chapter", { adaptation_id: AID, chapter: n }); if (!r.ok) { msg(r.error || "That chapter did not load."); return; } - CH = r.chapter; PARAS = r.paragraphs || []; REFS = r.refs || []; DEC = r.decisions || DEC; + CH = r.chapter; PARAS = r.paragraphs || []; REFS = r.refs || []; DEC = r.decisions || DEC; PLATES = r.plates || []; SCENES = r.scenes || []; EDITION = r.edition || ""; PAGE = Math.max(1, Math.min(page || PAGE || 1, CH.pages)); SEL = null; history.replaceState(null, "", "?book=" + encodeURIComponent(AID) + "&ch=" + n + "&p=" + PAGE); paintToc(); paintChapter(); @@ -187,7 +205,7 @@ + 'page ' + PAGE + '/' + CH.pages + ' of this chapter · ' + bookPage + '/' + total + ' of the book · ' + (CH.pages - PAGE) + ' left in the chapter' + '' + ''; - $("pagebar").innerHTML = bar; $("pagebar2").innerHTML = bar; + $("pagebar2").innerHTML = bar; var open = REFS.filter(function (r) { return r.status === "open"; }).length; $("chtools").innerHTML = (CH.refs_state === "working" ? 'Reading the chapter for references to ' + esc(AD.written || "its own time") + '…' @@ -195,9 +213,14 @@ + (REFS.length ? '' + REFS.length + ' found · ' + open + ' for you to decide · yellow = undecided, green = rewritten by you, grey = kept as written. Click one.' : '') + (/^failed/.test(CH.refs_state || "") ? '' + esc(CH.refs_state) + '' : ''); var here = PARAS.filter(function (p) { return p.page === PAGE; }); - $("paras").innerHTML = here.map(function (p) { + var pp = here.map(function (p) { return p.print_page; }).filter(Boolean); + var printSpan = pp.length ? ' · first edition p. ' + Math.min.apply(null, pp) + (Math.max.apply(null, pp) > Math.min.apply(null, pp) ? '–' + Math.max.apply(null, pp) : '') : ''; + $("pagebar").innerHTML = bar.replace('left in the chapter', 'left in the chapter' + printSpan + ''); + var platesHere = PLATES.filter(function (x) { return pp.length && x.pg >= Math.min.apply(null, pp) && x.pg <= Math.max.apply(null, pp); }); + var sceneOf = function (i) { var sc = SCENES.find(function (x) { return i >= x.from && i <= x.to; }); return sc ? 'Scene ' + sc.n + (sc.title ? ' · ' + esc(sc.title) : '') + '' : ''; }; + $("paras").innerHTML = (platesHere.length ? '' : '') + here.map(function (p) { var changed = p.text !== p.original; - return 'Nothing on this page.
'; } @@ -226,8 +249,10 @@ var t = ev.target, el, r; if ((el = t.closest("[data-tab]"))) { document.querySelectorAll(".tabs2 button").forEach(function (b) { b.classList.toggle("on", b === el); }); - ["read", "decisions", "log"].forEach(function (k) { $("tab-" + k).style.display = el.getAttribute("data-tab") === k ? "" : "none"; }); + ["read", "decisions", "log", "scenes", "report"].forEach(function (k) { $("tab-" + k).style.display = el.getAttribute("data-tab") === k ? "" : "none"; }); if (el.getAttribute("data-tab") === "log") loadLog(); + if (el.getAttribute("data-tab") === "scenes") paintScenes(); + if (el.getAttribute("data-tab") === "report") loadReport(); return; } if ((el = t.closest("[data-ch]"))) { ev.preventDefault(); openChapter(parseInt(el.getAttribute("data-ch"), 10), 1); window.scrollTo(0, 0); return; } @@ -289,13 +314,43 @@ } }); + function paintScenes() { + $("scenelist").innerHTML = SCENES.length ? 'No scenes yet for this chapter.
'; + $("scenesjson").value = SCENES.length ? JSON.stringify(SCENES.map(function (x) { return { title: x.title, from: x.from, to: x.to, place: x.place, note: x.note }; }), null, 1) : ""; + } + var REPORT = null; + async function loadReport() { + var r = await api("adapt_report", { adaptation_id: AID, chapter: CH.n }); + if (!r.ok) { msg(r.error); return; } + REPORT = r; + var people = Object.keys(r.by_person || {}).map(function (k) { var v = r.by_person[k]; return '' + esc(r.adaptation.title) + ' by ' + esc(r.adaptation.author) + ' · ' + esc(r.adaptation.source) + (r.adaptation.edition ? '
' + esc(r.adaptation.edition) + '' : '') + '
source fingerprint ' + esc(r.adaptation.source_sha256) + ' · record chain ' + (r.chain_ok ? 'intact' : 'BROKEN at ' + r.chain_broken_at) + ' · made ' + esc(when(r.made_at)) + '
' + r.chapter.changed + ' of ' + r.chapter.paragraphs + ' paragraphs changed · ' + r.chapter.words_original + ' words in the source, ' + r.chapter.words_final + ' now
' + + 'Direction: ' + c.directions.map(esc).join(' / ') + '
' : '') + 'Source: ' + esc(c.original) + '
Now: ' + esc(c.final) + '