Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions desktop/js/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,23 @@ if (!jeeFrontEnd.log) {

//searching
document.getElementById('in_searchLogFilter')?.addEventListener('keyup', function(event) {
var search = event.target.value
if (search == '') {
var raw = event.target.value
if (raw == '') {
jeeP.logListButtons.seen()
return
}
var not = search.startsWith(":not(")
if (not) {
search = search.replace(':not(', '')
}
search = jeedomUtils.normTextLower(search)

var terms = raw.split(',').map(t => t.trim()).filter(t => t.length > 0)

jeeP.logListButtons.unseen()
var match, text
jeeP.logListButtons.forEach(_bt => {
match = false
text = jeedomUtils.normTextLower(_bt.textContent)
if (text.includes(search)) {
match = true
}
if (not) match = !match
if (match) {
_bt.seen()
}
var text = jeedomUtils.normTextLower(_bt.textContent)
var match = terms.some(term => {
var not = term.startsWith(':not(')
var search = jeedomUtils.normTextLower(not ? term.slice(5, -1) : term)
return not ? !text.includes(search) : text.includes(search)
})
if (match) _bt.seen()
})
})

Expand Down
Loading