Skip to content

Commit

Permalink
Features search (#9097)
Browse files Browse the repository at this point in the history
Fixes #9044
  • Loading branch information
agriffard authored Apr 8, 2021
1 parent bf48619 commit 46bad76
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,25 @@
// On ESC, clear the search box and display all features
if (e.keyCode == 27 || search == '') {
searchBox.val('');
elementsToFilter.toggle(true);
}
else {
elementsToFilter.removeClass("d-none first-child-visible last-child-visible");
} else {
elementsToFilter.each(function () {
var text = $(this).data('filter-value').toLowerCase();
var found = text.indexOf(search) > -1;
$(this).toggle(found);
if (found)
{
$(this).removeClass("d-none first-child-visible last-child-visible");
}
else
{
$(this).addClass("d-none");
}
});
$('ul.list-group').each(function () {
$(this).find('li').filter(":not(.d-none)").first().addClass("first-child-visible");
$(this).find('li').filter(":not(.d-none)").last().addClass("last-child-visible");
});
var visible = $('.list-group > li:visible');
Expand Down

0 comments on commit 46bad76

Please sign in to comment.