aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
Diffstat (limited to 'view')
-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 );