From 88003a2c9f460ffa5f0a0d5efaec83bc4ca1907f Mon Sep 17 00:00:00 2001 From: tueddy Date: Sun, 5 Jan 2025 22:01:14 +0100 Subject: [PATCH] bugfix dynamic list of control leds. Co-authored-by @trainbird , thanks! --- html/management.html | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/html/management.html b/html/management.html index 010cc76b..4dd85728 100644 --- a/html/management.html +++ b/html/management.html @@ -1143,7 +1143,10 @@
:

- +
+
+   +
:

:
@@ -2127,18 +2130,20 @@ // list the LED control colors function listControlColors(numControlColor, data) { console.log(data); - var list = document.getElementById("ControlColorList"); - var h = ""; - var color = 0xffffff; - for (var i = 0; i < numControlColor; i++) { - if (data) { - color = data[i]; + const list = $("#controlColorList"); + list.toggleClass("d-none", numControlColor <= 0).empty(); + if (numControlColor > 0) { + const t = $("#controlColorTemp"); + for (let i = 0; i < numControlColor; i++) { + const ledN = t.clone().removeClass("d-none"); + const input = $("input", ledN).attr("id", `controlColor${i}`); + $(".ledNumber", ledN).text(i + 1); + if (data) { + input.val(getHexColor(data[i])); + } + list.append(ledN); } - h += '
' + i18next.t("settingsex.led.controlled") + ' ' + (i + 1) + ': 

'; } - h += "
"; - list.innerHTML = h; - list.style.display = numControlColor > 0 ? null : "none"; } async function fillSettings(settings) {