mirror of
https://github.com/ForkAwesome/Fork-Awesome.git
synced 2024-12-28 06:21:32 +08:00
Icon search now strips ending 's' from search queries.
This commit is contained in:
parent
276b5a1bf0
commit
c1768c1f8a
@ -32,13 +32,18 @@ $(function() {
|
|||||||
|
|
||||||
var resultsCount = 0;
|
var resultsCount = 0;
|
||||||
$icons.each(function() {
|
$icons.each(function() {
|
||||||
var show = $(this).attr('data-filter').match(' '+val);
|
var filter = $(this).attr('data-filter')
|
||||||
if( show ) resultsCount++;
|
var show = filter.match(' '+val);
|
||||||
|
if (!show) {
|
||||||
|
if (val.slice(-1) === 's') {
|
||||||
|
// Try to be smart. Make plural terms singular.
|
||||||
|
show = filter.match(' '+val.slice(0, -1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (show) resultsCount++;
|
||||||
$(this).toggle(!!show);
|
$(this).toggle(!!show);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(resultsCount);
|
|
||||||
|
|
||||||
if( resultsCount == 0 && val.length != 0 ) {
|
if( resultsCount == 0 && val.length != 0 ) {
|
||||||
$no_results.find('span').text(val);
|
$no_results.find('span').text(val);
|
||||||
$no_results.show();
|
$no_results.show();
|
||||||
|
Loading…
Reference in New Issue
Block a user