diff --git a/script.html b/script.html index e117965..b857f35 100644 --- a/script.html +++ b/script.html @@ -817,7 +817,29 @@ async function loadTakes() { + 'style="width:100%;aspect-ratio:9/16;border-radius:9px;border:1px solid var(--line);background:#000;display:block">' + '
' + esc(when(v.at) || "earlier") + (v.voice_name ? ' · ' + esc(v.voice_name) : '') - + (v.cost_usd ? ' · + + (v.cost_usd ? ' · $' + Number(v.cost_usd).toFixed(2) : '') + '
' + + (v.note ? '
' + esc(v.note) + '
' : '') + + '' + + ''; + }).join("") + + ''; + [].forEach.call(el.querySelectorAll("[data-restore]"), function (b) { + b.onclick = async function () { + if (!confirm("Bring that take back as the current video? The one you are leaving is kept.")) return; + b.disabled = true; b.textContent = "Restoring…"; + var s = await api("restore_version", { email: email, project_id: pid, + index: parseInt(b.getAttribute("data-restore"), 10) }); + if (!s.ok) { b.disabled = false; b.textContent = "Use this one"; showMsg("msg", s.error || "Could not restore that."); return; } + showMsg("msg", s.status_text || "Restored.", "ok"); + load(); + }; + }); +} + +function bindPost() { + loadTakes(); + // The editing bay is opt-in. Most people want to watch the thing and leave. var eo = document.getElementById("edlopen"); if (eo) eo.onclick = function () { var w = document.getElementById("edlwrap");