summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-10-11 07:10:35 +0200
committerMischa Untaga <99098079+MischaU8@users.noreply.github.com>2023-10-11 07:10:35 +0200
commit2f7182bf7545e0ecab3f0f98741bfbd0ac172994 (patch)
tree69c60eb79bb9b9ddd09c1a1e1a89ef149c4acdf5
parentc12c5baa8ee887b98d9400273353aba9b25d9083 (diff)
downloadalgeria-2f7182bf7545e0ecab3f0f98741bfbd0ac172994.tar.gz
hide empty supply panels
-rw-r--r--play.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/play.js b/play.js
index 069fa43..0d5845e 100644
--- a/play.js
+++ b/play.js
@@ -77,6 +77,9 @@ let ui = {
zones: [],
units: [],
units_holder: document.getElementById("units"),
+ fln_supply_panel: document.getElementById("fln_supply_panel"),
+ gov_supply_panel: document.getElementById("gov_supply_panel"),
+ eliminated_panel: document.getElementById("eliminated_panel"),
fln_supply: document.getElementById("fln_supply"),
gov_supply: document.getElementById("gov_supply"),
eliminated: document.getElementById("eliminated"),
@@ -465,6 +468,11 @@ function update_map() {
}
}
+ // Hide supply panels when empty
+ ui.fln_supply_panel.classList.toggle("hide", !(ui.fln_supply.childNodes.length - 1))
+ ui.gov_supply_panel.classList.toggle("hide", !(ui.gov_supply.childNodes.length - 1))
+ ui.eliminated_panel.classList.toggle("hide", !(ui.eliminated.childNodes.length - 1))
+
for (let i = 0; i < ui.areas.length; ++i) {
let e = ui.areas[i]
if (e) {