Use smart case for filters
This commit is contained in:
parent
aba01d54e8
commit
de4d984ded
2
TODO.md
2
TODO.md
|
@ -1,7 +1,5 @@
|
|||
- Refactoring
|
||||
- Don't show the highlight rectangle sliding when clicking room
|
||||
- Make room loading faster
|
||||
- Filter smart case
|
||||
- Make all icon SVG files white/black, since we can now use ColorOverlay
|
||||
- Make the icon blue in EditAccount when hovering and no avatar set
|
||||
|
||||
|
|
|
@ -74,12 +74,15 @@ function processedEventText(ev) {
|
|||
|
||||
|
||||
function filterMatches(filter, text) {
|
||||
filter = filter.toLowerCase()
|
||||
text = text.toLowerCase()
|
||||
let filter_lower = filter.toLowerCase()
|
||||
|
||||
let words = filter.split(" ")
|
||||
if (filter_lower == filter) {
|
||||
// Consider case only if filter isn't all lowercase (smart case)
|
||||
filter = filter_lower
|
||||
text = text.toLowerCase()
|
||||
}
|
||||
|
||||
for (let word of words) {
|
||||
for (let word of filter.split(" ")) {
|
||||
if (word && ! text.includes(word)) {
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user