From: Hypolite Petovan Date: Thu, 29 Mar 2018 04:47:27 +0000 (-0400) Subject: Make Hashtag autocomplete case-insensitive X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=84b4ff58b68da2ddbd716d4b54297447db6d1975;p=friendica.git Make Hashtag autocomplete case-insensitive --- diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index eb9d5efbea..885c38d6da 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -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 };