From baec51bd357fda06659e52117cfd5c5c07811d5f Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sat, 5 Jun 2021 23:29:31 +1000 Subject: [PATCH] Highlight names of elected candidates in web UI --- html/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/html/index.js b/html/index.js index ddb02f4..08e0183 100644 --- a/html/index.js +++ b/html/index.js @@ -48,7 +48,18 @@ worker.onmessage = function(evt) { } else if (evt.data.type === 'updateResultsTable') { for (let i = 0; i < evt.data.result.length; i++) { - tblResult.rows[i].insertAdjacentHTML('beforeend', evt.data.result[i]); + if (evt.data.result[i]) { + tblResult.rows[i].insertAdjacentHTML('beforeend', evt.data.result[i]); + + // Update candidate status + if (i >= 3 && i % 2 == 1) { + if (tblResult.rows[i].lastElementChild.classList.contains('elected')) { + tblResult.rows[i].cells[0].classList.add('elected'); + } else { + tblResult.rows[i].cells[0].classList.remove('elected'); + } + } + } } } else if (evt.data.type === 'updateStageComments') {