mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-19 07:32:05 +00:00
feat: custom genre/tags search
This commit is contained in:
parent
76e79e6eaa
commit
9a8deb0786
1 changed files with 2 additions and 2 deletions
|
|
@ -304,8 +304,8 @@
|
|||
const searchKey = type === 'tag' ? 'tag' : 'genre'
|
||||
const inputValue = event.target.value
|
||||
let bestMatch = list.find(item => item.toLowerCase() === inputValue.toLowerCase())
|
||||
if (!bestMatch) {
|
||||
bestMatch = list.find(item => item.toLowerCase().startsWith(inputValue.toLowerCase()))
|
||||
if (!bestMatch || inputValue.endsWith('*')) {
|
||||
bestMatch = (inputValue.endsWith('*') && inputValue.slice(0, -1)) || list.find(item => item.toLowerCase().startsWith(inputValue.toLowerCase())) || list.find(item => item.toLowerCase().endsWith(inputValue.toLowerCase()))
|
||||
}
|
||||
if (bestMatch && (!search[searchKey] || !search[searchKey].includes(bestMatch))) {
|
||||
search[searchKey] = search[searchKey] ? [...search[searchKey], bestMatch] : [bestMatch]
|
||||
|
|
|
|||
Loading…
Reference in a new issue