diff options
author | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-10-11 07:10:35 +0200 |
---|---|---|
committer | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2023-10-11 07:10:35 +0200 |
commit | 2f7182bf7545e0ecab3f0f98741bfbd0ac172994 (patch) | |
tree | 69c60eb79bb9b9ddd09c1a1e1a89ef149c4acdf5 | |
parent | c12c5baa8ee887b98d9400273353aba9b25d9083 (diff) | |
download | algeria-2f7182bf7545e0ecab3f0f98741bfbd0ac172994.tar.gz |
hide empty supply panels
-rw-r--r-- | play.js | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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) { |