Reopen a closed vote until its results are shown; check mark in the center mark and on the phone; vote title during enrollment; projector opens in a window
This commit is contained in:
+26
-1
@@ -192,9 +192,34 @@ function enrolled() {
|
||||
stopScanner();
|
||||
lsSet(DONE_KEY, "1");
|
||||
navigator.vibrate?.([40, 60, 40]);
|
||||
celebrate("Inscription validée");
|
||||
boot();
|
||||
}
|
||||
|
||||
// the projector's center mark with its check, drawn in, held a moment, then gone
|
||||
const MARK_NS = "http://www.w3.org/2000/svg";
|
||||
function celebrate(text) {
|
||||
const svg = document.createElementNS(MARK_NS, "svg");
|
||||
svg.setAttribute("viewBox", "0 0 32 32");
|
||||
svg.setAttribute("aria-hidden", "true");
|
||||
const g = document.createElementNS(MARK_NS, "g");
|
||||
g.setAttribute("transform", "rotate(-90 16 16)");
|
||||
for (const [stroke, dash] of [["currentColor", "4.52 7"], ["#ffcc00", "4.52 64.6"]]) {
|
||||
const c = document.createElementNS(MARK_NS, "circle");
|
||||
for (const [k, v] of Object.entries({ cx: 16, cy: 16, r: 11, fill: "none", stroke, "stroke-width": 5,
|
||||
"stroke-linecap": "round", "stroke-dasharray": dash, "stroke-dashoffset": -3.5 })) c.setAttribute(k, v);
|
||||
g.append(c);
|
||||
}
|
||||
const tick = document.createElementNS(MARK_NS, "path");
|
||||
for (const [k, v] of Object.entries({ d: "M12.8 16.15l2.3 2.3 4.25-4.75", fill: "none", stroke: "currentColor", "stroke-width": 2.4,
|
||||
"stroke-linecap": "round", "stroke-linejoin": "round", pathLength: 1, class: "tick" })) tick.setAttribute(k, v);
|
||||
svg.append(g, tick);
|
||||
const el = h("div", { class: "celebrate", role: "status" }, svg, h("p", {}, text));
|
||||
document.body.append(el);
|
||||
setTimeout(() => el.classList.add("out"), 1300);
|
||||
setTimeout(() => el.remove(), 1700);
|
||||
}
|
||||
|
||||
$("#start-cam").addEventListener("click", startScanner);
|
||||
|
||||
$("#no-cam").addEventListener("click", () => { stopScanner(); show("#v-rescue"); $("#rescue-code").focus(); });
|
||||
@@ -321,7 +346,7 @@ async function confirmVote(q) {
|
||||
try {
|
||||
await api("POST", `${apiBase}/vote`, { question_id: q.id, choices: s.blank ? [] : choices, presence });
|
||||
selections.delete(q.id);
|
||||
toast("Vote enregistré", "ok");
|
||||
celebrate("Vote enregistré");
|
||||
navigator.vibrate?.(60);
|
||||
} catch (e) {
|
||||
const m = { already_voted: "Déjà voté.", not_open: "Vote clos.", not_enrolled: "Appareil non inscrit.",
|
||||
|
||||
Reference in New Issue
Block a user