]> git.ipfire.org Git - thirdparty/Font-Awesome.git/commitdiff
Icon search now strips ending 's' from search queries.
authorWilliam Boman <william@redwill.se>
Mon, 20 Oct 2014 23:47:07 +0000 (01:47 +0200)
committerWilliam Boman <william@redwill.se>
Tue, 9 Dec 2014 11:59:42 +0000 (12:59 +0100)
src/assets/js/site.js

index 4e0a9be388faf24e1d6ecd5245304c1d9f69273c..3e5cf475668f44847b1a69c524e2253fc8953295 100644 (file)
@@ -32,13 +32,18 @@ $(function() {
 
       var resultsCount = 0;
       $icons.each(function() {
-        var show = $(this).attr('data-filter').match(' '+val);
-        if( show ) resultsCount++;
+        var filter = $(this).attr('data-filter')
+        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);
       });
 
-      console.log(resultsCount);
-
       if( resultsCount == 0 && val.length != 0 ) {
         $no_results.find('span').text(val);
         $no_results.show();