From a8846449b66ad5fa26ae00b2a2131421a03b9127 Mon Sep 17 00:00:00 2001 From: ge-ku Date: Thu, 31 May 2018 23:31:44 +0300 Subject: [PATCH] fixed displaying +/- days multiple times --- gcpd730.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gcpd730.js b/gcpd730.js index 12623ca..9460c07 100644 --- a/gcpd730.js +++ b/gcpd730.js @@ -265,21 +265,26 @@ const checkBans = (players) => { banStats.vacBans++; } if (player.NumberOfGameBans > 0) { - if (verdict) verdict += ' & '; + if (verdict) verdict += ' &\n'; verdict += 'Game'; banStats.gameBans++; } - if (verdict && daySinceLastMatch > player.DaysSinceLastBan) banStats.recentBans++; + if (verdict) { + const daysAfter = daySinceLastMatch - player.DaysSinceLastBan; + if (daySinceLastMatch > player.DaysSinceLastBan) { + banStats.recentBans++; + verdict += '+' + daysAfter; + } else { + verdict += daysAfter; + } + } playerEls.forEach(playerEl => { playerEl.classList.add('banchecker-checked'); verdictEl = playerEl.querySelector('.banchecker-bans'); if (verdict) { - let daysAfter = daySinceLastMatch - player.DaysSinceLastBan; if (daySinceLastMatch > player.DaysSinceLastBan) { - verdict += '+' + (daysAfter); verdictEl.style.color = 'red'; } else { - verdict += '-' + (Math.abs(daysAfter)); verdictEl.style.color = 'grey'; } verdictEl.style.cursor = 'help'; @@ -324,6 +329,7 @@ const checkLoadedMatchesForBans = () => { if (i === 0) { const bansHeader = document.createElement('th'); bansHeader.textContent = 'Bans'; + bansHeader.style.minWidth = '5.6em'; tr.appendChild(bansHeader); } else if (tr.childElementCount > 3) { const bansPlaceholder = document.createElement('td');