From 7b30aa2135c672ac3dc723f5bdeac216e815e518 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 22 Jul 2025 16:21:16 +0200 Subject: Layer selection panel: Show a switch not a checkbox when type: 'switch'. --- main.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 30a1d9c..18163cb 100644 --- a/main.js +++ b/main.js @@ -3435,7 +3435,7 @@ const infoMetadataAccordions = []; elem._legend.classList.add('d-none'); } } - if (elem.children !== undefined && elem.children.length > 0) { + if (elem.children != null && elem.children.length > 0) { setIndeterminateAndChecked(elem.children); } }); @@ -3591,8 +3591,14 @@ const infoMetadataAccordions = []; const text0 = document.createTextNode(x.text); label0.appendChild(text0); - if (x.children === undefined || x.children.length === 0) { - item.replaceChild(span0, header); + if (x.children == null || x.children.length === 0) { + span0.removeAttribute('data-bs-toggle'); + span0.removeAttribute('data-bs-target'); + item.replaceChildren(span0); + if (x.type === 'switch') { + span0.classList.add('form-switch'); + input0.setAttribute('role', 'switch'); + } } else { const body = document.createElement('div'); collapse.appendChild(body); -- cgit v1.2.3