diff --git a/script.html b/script.html index cbd5f97..7bddb0a 100644 --- a/script.html +++ b/script.html @@ -507,12 +507,54 @@ async function bindFilm(p) { function bindPost() { var sb = document.getElementById("seams"); + function paintSeams(r) { + var el = document.getElementById("seamout"); + if (!el) return; + el.innerHTML = '
' + esc(r.status_text || "") + '
' + + (r.seams || []).map(function (x) { + var col = x.verdict === "smooth" ? "var(--good)" + : (x.verdict === "visible" ? "var(--accent2)" : "var(--bad)"); + return '' + esc(r.status_text || "Measuring…") + '
'; + var waited = 0; + var t = setInterval(async function () { + waited += 4; + var g = await api("seam_report", { email: email, project_id: pid }); + if (g.ok && !g.pending) { + clearInterval(t); + sb.disabled = false; sb.textContent = "Measure the joins"; + paintSeams(g); + return; + } + if (waited > 180) { + clearInterval(t); + sb.disabled = false; sb.textContent = "Measure the joins"; + showMsg("msg", "Measuring is taking unusually long."); + } + }, 4000); + return; + } + sb.disabled = false; sb.textContent = "Measure the joins"; if (!r.seams || !r.seams.length) { el.innerHTML = '' + esc(r.status_text || "Nothing to measure.") + '
'; return;