From f9506c5484552ddd0331ae19494debc22a5b34a3 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 12 Sep 2021 10:21:34 +0300 Subject: [PATCH] Autofix issues Signed-off-by: XhmikosR --- scripts/pi-hole/js/footer.js | 6 +--- scripts/pi-hole/js/ip-address-sorting.js | 46 ++++++++++++++++-------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js index ffbf6844..c14495bd 100644 --- a/scripts/pi-hole/js/footer.js +++ b/scripts/pi-hole/js/footer.js @@ -287,11 +287,7 @@ if (sessionvalidity > 0) { seconds = "0" + seconds; } - if (totalseconds > 0) { - sessionTimerCounter.textContent = minutes + ":" + seconds; - } else { - sessionTimerCounter.textContent = "-- : --"; - } + sessionTimerCounter.textContent = totalseconds > 0 ? minutes + ":" + seconds : "-- : --"; }, 1000); } else { document.getElementById("sessiontimer").style.display = "none"; diff --git a/scripts/pi-hole/js/ip-address-sorting.js b/scripts/pi-hole/js/ip-address-sorting.js index ecc3aa5f..e4f487b4 100644 --- a/scripts/pi-hole/js/ip-address-sorting.js +++ b/scripts/pi-hole/js/ip-address-sorting.js @@ -59,20 +59,38 @@ $.extend($.fn.dataTableExt.oSort, { xa += ":"; } - if (item.length === 0) { - count += 0; - } else if (item.length === 1) { - xa += "000" + item; - count += 4; - } else if (item.length === 2) { - xa += "00" + item; - count += 4; - } else if (item.length === 3) { - xa += "0" + item; - count += 4; - } else { - xa += item; - count += 4; + switch (item.length) { + case 0: { + count += 0; + + break; + } + + case 1: { + xa += "000" + item; + count += 4; + + break; + } + + case 2: { + xa += "00" + item; + count += 4; + + break; + } + + case 3: { + xa += "0" + item; + count += 4; + + break; + } + + default: { + xa += item; + count += 4; + } } }