Skip to content

Commit

Permalink
Add shortcut to optimize performance when clearing searches.
Browse files Browse the repository at this point in the history
  • Loading branch information
BusterNeece committed May 10, 2024
1 parent 2ca486c commit a253a9b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions backend/templates/dashboard/skills.twig
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@
}
function doFilter(filter, selector) {
$(selector).each(function() {
const talentName = $(this).find('h2').first().text();
if (!talentName.toUpperCase().includes(filter)) {
$(this).addClass('d-none');
} else {
$(this).removeClass('d-none');
}
});
if (filter === '') {
$(selector).removeClass('d-none');
} else {
$(selector).each(function() {
const talentName = $(this).find('h2').first().text();
if (!talentName.toUpperCase().includes(filter)) {
$(this).addClass('d-none');
} else {
$(this).removeClass('d-none');
}
});
}
}
document.querySelector('#searchMySkills').addEventListener('load', filterMySkills, false);
Expand Down

0 comments on commit a253a9b

Please sign in to comment.