blob: fce62e0e2913e0e6d4ff933a0775ef6937720e7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
(async function(){
const res = await fetch('data.json');
const versions = await res.json();
const input = document.getElementById('search');
input.addEventListener('input', (e) => {
const query = e.target.value;
for (const [key, data] of Object.entries(versions)) {
const results = Object.values(data.features).filter(
feat => feat.title.toLowerCase().replaceAll('`', '').includes(query.toLowerCase())
);
const ul = document.createElement('ul');
for (const feat of results) {
const li = document.createElement('li');
const a = document.createElement('a');
a.textContent = feat.title;
a.innerHTML = a.innerHTML.replaceAll(/`(.+?)`/g, (_, x) => `<code>${x}</code>`);
a.href = feat.url;
li.appendChild(a);
ul.appendChild(li);
}
document.getElementById(key + '-list').replaceChildren(...ul.children);
}
});
})();
|