From 80f6555e537438bbc50b37f4cdf44e13e9ed5c8f Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Fri, 15 Jan 2021 16:23:10 +1100 Subject: [PATCH] Hide loss to fraction in JS report if all zero --- html/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/html/index.js b/html/index.js index 5af1eff..446053e 100644 --- a/html/index.js +++ b/html/index.js @@ -250,8 +250,10 @@ async function clickCount() { // Loss to fraction row trLTF1 = document.createElement('tr'); trLTF1.classList.add('info'); + trLTF1.style.display = 'none'; trLTF2 = document.createElement('tr'); trLTF2.classList.add('info'); + trLTF2.style.display = 'none'; elTd = document.createElement('td'); elTd.setAttribute('rowspan', '2'); @@ -388,9 +390,15 @@ async function clickCount() { elTd = document.createElement('td'); elTd.classList.add('count'); - elTd.innerHTML = ppVotes(result.loss_fraction.votes); + let ppLTF = ppVotes(result.loss_fraction.votes); + elTd.innerHTML = ppLTF; trLTF2.appendChild(elTd); + if (ppLTF !== ' ') { + trLTF1.style.display = 'table-row'; + trLTF2.style.display = 'table-row'; + } + // Display total elTd = document.createElement('td'); elTd.classList.add('count');