summaryrefslogtreecommitdiff
path: root/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'script.js')
-rw-r--r--script.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/script.js b/script.js
index a631288..0e2491e 100644
--- a/script.js
+++ b/script.js
@@ -6,32 +6,32 @@
input.focus();
input.addEventListener('input', (e) => {
const query = e.target.value.toLowerCase();
- for (const [key, data] of Object.entries(versions)) {
- const heading = document.getElementById(key);
+ for (const version of versions) {
+ const heading = document.getElementById(version.name);
- if (data.features == undefined) {
+ if (version.lib.length == 0 && version.non_lib.length == 0) {
heading.hidden = query.length != 0;
continue;
}
- const nonLibResults = search(data.features.non_lib_features, query);
- const libResults = search(data.features.lib_features, query);
+ const nonLibResults = search(version.non_lib, query);
+ const libResults = search(version.lib, query);
const totalResultCount = nonLibResults.length + libResults.length;
// so that release notes don't get in the way when <Tab>ing through results
document.body.classList.toggle('hide-release-notes', totalResultCount == 0);
- let list = document.getElementById(key + '-non-lib-list');
+ let list = document.getElementById(version.name + '-non-lib-list');
if (list) {
list.replaceChildren(...renderList(nonLibResults).children);
list.hidden = nonLibResults.length == 0;
}
- list = document.getElementById(key + '-lib-list');
+ list = document.getElementById(version.name + '-lib-list');
if (list) {
list.replaceChildren(...renderList(libResults).children);
list.hidden = libResults.length == 0;
- document.getElementById(key + '-lib').hidden = libResults.length == 0;
+ document.getElementById(version.name + '-lib-heading').hidden = libResults.length == 0;
}
heading.hidden = totalResultCount == 0;
@@ -40,7 +40,7 @@
})();
function search(features, query) {
- return Object.values(features).filter((feat) => {
+ return features.filter((feat) => {
if (feat.title.toLowerCase().replaceAll('`', '').includes(query)) {
return true;
}