summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-27 10:50:56 +0100
committerMartin Fischer <martin@push-f.com>2021-11-27 12:54:12 +0100
commit68224ab860f92aec2325ccc1745703779964c240 (patch)
treef5afe3d34bf00bad84f6b638879148a98523c21c
parentd2eeb1d48dbeced8b3d1d1796dbc908511bc2a2f (diff)
search: make search hide empty versions
-rw-r--r--script.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/script.js b/script.js
index fce62e0..4279561 100644
--- a/script.js
+++ b/script.js
@@ -6,6 +6,12 @@
input.addEventListener('input', (e) => {
const query = e.target.value;
for (const [key, data] of Object.entries(versions)) {
+ const heading = document.getElementById(key);
+
+ if (data.features == undefined) {
+ heading.hidden = query.length != 0;
+ continue;
+ }
const results = Object.values(data.features).filter(
feat => feat.title.toLowerCase().replaceAll('`', '').includes(query.toLowerCase())
);
@@ -19,7 +25,10 @@
li.appendChild(a);
ul.appendChild(li);
}
- document.getElementById(key + '-list').replaceChildren(...ul.children);
+ const list = document.getElementById(key + '-list');
+ list.replaceChildren(...ul.children);
+ list.hidden = results.length == 0;
+ heading.hidden = results.length == 0;
}
});
})();