aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/autocomplete.js
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-04-16 17:37:38 -0700
committerzotlabs <mike@macgirvin.com>2018-04-16 17:37:38 -0700
commit04abfdd5a64b016f2c94db5d52ff35e2d552d6d0 (patch)
tree6c38a7252c5bfc97234ee60538577c1c75603e0e /view/js/autocomplete.js
parent1662f76f03e8f12adeaeb91ee1745aa070f317fe (diff)
downloadvolse-hubzilla-04abfdd5a64b016f2c94db5d52ff35e2d552d6d0.tar.gz
volse-hubzilla-04abfdd5a64b016f2c94db5d52ff35e2d552d6d0.tar.bz2
volse-hubzilla-04abfdd5a64b016f2c94db5d52ff35e2d552d6d0.zip
update the search js
Diffstat (limited to 'view/js/autocomplete.js')
-rw-r--r--view/js/autocomplete.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index 69ccd1fe5..e92de17c4 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -253,9 +253,18 @@ function string2bb(element) {
template: contact_format
};
+ // Autocomplete hashtags
+ tags = {
+ match: /(^\#)([^ \n]{3,})$/,
+ index: 2,
+ search: function(term, callback) { $.getJSON('/hashtags/' + '$f=&t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.toLowerCase().indexOf(term.toLowerCase()) === 0 ? entry : null; })); }); },
+ replace: function(item) { return "$1" + item.text + ' '; },
+ context: function(text) { return text.toLowerCase(); },
+ template: tag_format
+ };
this.attr('autocomplete', 'off');
- var a = this.textcomplete([contacts,forums], {className:'acpopup', maxCount:100, zIndex: 1020, appendTo:'nav'});
+ var a = this.textcomplete([contacts,forums,tags], {className:'acpopup', maxCount:100, zIndex: 1020, appendTo:'nav'});
a.on('textComplete:select', function(e, value, strategy) { submit_form(this); });
};
})( jQuery );