aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2025-07-22 16:21:16 +0200
committerGuilhem Moulin <guilhem@fripost.org>2025-07-22 16:21:16 +0200
commit7b30aa2135c672ac3dc723f5bdeac216e815e518 (patch)
tree32b53bcf16530f8f12806f07654ea3bd36bcb679
parent6804b169a1b744a4bcb983b075ec4280a9b83af6 (diff)
Layer selection panel: Show a switch not a checkbox when type: 'switch'.
-rw-r--r--main.js12
1 files 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);