Skip to content

Commit

Permalink
Add support for multiple searching, using '&' as a separator.
Browse files Browse the repository at this point in the history
  • Loading branch information
eigood committed Sep 9, 2024
1 parent d6007e2 commit e4b18b9
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,6 @@ function filterDisplay(search) {
const iwwcAppNode = document.querySelector('#iwwc-app')
if (agentSearch) {
if (!iwwcAppNode.classList.contains('searching')) iwwcAppNode.classList.add('searching')
const searchStyleNode = document.querySelector('#search-style')
searchStyleNode.textContent = `
#iwwc-app.searching .stat-row:not([data-agent*='${agentSearch}' i]) {
height:0;
visibility:collapse;
}
`
} else {
iwwcAppNode.classList.remove('searching')
}
Expand Down Expand Up @@ -402,8 +395,11 @@ function handleCustom(result) {
if (searchTerm) {
const searchTermLower = searchTerm.toLowerCase()
if (page.search.term === searchTermLower) return
const searchTerms = searchTermLower.split('&')
page.search.start = 0
page.search.rowInfos = rowInfos.filter(({ agentNameLower }) => agentNameLower.indexOf(searchTermLower) !== -1)
page.search.rowInfos = rowInfos.filter(({ agentNameLower }) => {
return searchTerms.filter(searchTerm => searchTerm.length && agentNameLower.indexOf(searchTerm) !== -1).length
})
page.current = page.search
updatePage()
} else {
Expand Down

0 comments on commit e4b18b9

Please sign in to comment.