]> git.mxchange.org Git - friendica.git/commitdiff
Make Hashtag autocomplete case-insensitive
authorHypolite Petovan <mrpetovan@gmail.com>
Thu, 29 Mar 2018 04:47:27 +0000 (00:47 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Thu, 29 Mar 2018 04:47:27 +0000 (00:47 -0400)
view/js/autocomplete.js

index eb9d5efbea9bdccd99c1614592d1afdb1ed27ee5..885c38d6da8ef6d5e99151f13f79184a69c09471 100644 (file)
@@ -220,7 +220,15 @@ function string2bb(element) {
                tags = {
                        match: /(^|\s)(\#)([^ \n]{2,})$/,
                        index: 3,
-                       search: function(term, callback) { $.getJSON(baseurl + '/hashtag/' + '?f=&t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.indexOf(term) === 0 ? entry : null; })); }); },
+                       search: function(term, callback) {
+                               $.getJSON(baseurl + '/hashtag/' + '?f=&t=' + term)
+                               .done(function(data) {
+                                       callback($.map(data, function(entry) {
+                                               // .toLowerCase() enables case-insensitive search
+                                               return entry.text.toLowerCase().indexOf(term.toLowerCase()) === 0 ? entry : null;
+                                       }));
+                               });
+                       },
                        replace: function(item) { return "$1$2" + item.text + ' '; },
                        template: tag_format
                };