INNER CODE UNIT · JavaScript
setRunState
LeyckerS/moondownloader · web/app.js:405
function setRunState(state) {
// applyLang() calls this with the state it already has, to relabel; comparing
// first is what keeps that from re-firing the end-of-run panel.
const prev = ui.runState;
ui.runState = state;
const pillKey = { idle: "IDLE", running: "RUNNING", stopping: "STOPPING", done: "DONE" }[state] || "IDLE";
const btnKey = { idle: "start", running: "stop", stopping: "stopping", done: "start" }[state] || "start";
$("#statePill").dataset.state = state;
$("#stateLabel").textContent = T(pillKey);
const b = $("#btnStart");
b.dataset.state = state;
$("#startLabel").textContent = T(btnKey);
if (state === "done" && prev !== "done") showSummary();
}
function phaseText(m) {
const parts = [];
if (m.stage === "idle") parts.push(T("ph_idle"));