X-Git-Url: http://git.scottworley.com/voter/blobdiff_plain/3a49148b2736feb552620b329abd0729a9192bfb..6ae24e6d4f2ba3aa6c804f59f3d56a88393c9e07:/src/main.rs diff --git a/src/main.rs b/src/main.rs index 9f536ed..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) } @@ -146,6 +149,7 @@ const HTML_HEADER: &str = " + "; @@ -177,6 +181,10 @@ fn prompt_for_vote(dir: PathBuf, request: cgi::Request) -> Result Result + "
Count Vote Candidate
{count} {c}