From 2f7182bf7545e0ecab3f0f98741bfbd0ac172994 Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Wed, 11 Oct 2023 07:10:35 +0200 Subject: hide empty supply panels --- play.js | 8 ++++++++ 1 file changed, 8 insertions(+) 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) { -- cgit v1.2.3