diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2025-07-22 16:21:16 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2025-07-22 16:21:16 +0200 |
commit | 7b30aa2135c672ac3dc723f5bdeac216e815e518 (patch) | |
tree | 32b53bcf16530f8f12806f07654ea3bd36bcb679 | |
parent | 6804b169a1b744a4bcb983b075ec4280a9b83af6 (diff) |
Layer selection panel: Show a switch not a checkbox when type: 'switch'.
-rw-r--r-- | main.js | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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); |