From: Scott Worley Date: Sat, 19 Nov 2022 11:11:41 +0000 (-0800) Subject: Update vote counts to reflect local votes X-Git-Tag: v0.2.0~2 X-Git-Url: http://git.scottworley.com/voter/commitdiff_plain/6ae24e6d4f2ba3aa6c804f59f3d56a88393c9e07?ds=sidebyside Update vote counts to reflect local votes --- diff --git a/src/main.rs b/src/main.rs index a12f73a..528a230 100644 --- a/src/main.rs +++ b/src/main.rs @@ -130,6 +130,9 @@ const HTML_HEADER: &str = " cb.parentElement.removeChild(cb.previousElementSibling) if (req.status == 200) { cb.style.display = '' + const delta = cb.checked ? 1 : -1 + const count_td = cb.parentElement.previousElementSibling + count_td.textContent = parseInt(count_td.textContent) + delta } else { cb.parentElement.insertBefore(document.createTextNode('❗'), cb) }