mirror of
https://github.com/ipfs/awesome-ipfs.git
synced 2024-08-22 02:05:56 +00:00
feat: improved search
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
This commit is contained in:
parent
330e0c7a35
commit
257c578feb
@ -43,13 +43,17 @@ if (search) {
|
|||||||
const input = search.querySelector('input')
|
const input = search.querySelector('input')
|
||||||
|
|
||||||
input.addEventListener('keyup', () => {
|
input.addEventListener('keyup', () => {
|
||||||
const search = input.value
|
let search = input.value
|
||||||
|
|
||||||
if (search === '') {
|
if (search === '') {
|
||||||
cards.forEach((c) => c.classList.remove('dn'))
|
cards.forEach((c) => c.classList.remove('dn'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!search.endsWith('*')) {
|
||||||
|
search = `${search} ${search}*`
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
update(idx.search(search).map(s => s.ref))
|
update(idx.search(search).map(s => s.ref))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user