diff options
author | mrjive <mrjive@mrjive.it> | 2018-04-19 09:51:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-19 09:51:58 +0200 |
commit | c8ff773b9609f723217712f0faf451238d41327d (patch) | |
tree | 4127afeee7d8a3b710863d9ad022fed2b82a8ebc /view/js | |
parent | 283e5d3a5c9557195a640de5f0acefc884e904bb (diff) | |
parent | 92b08f1f07a25976342dc885331ecb1531e256aa (diff) | |
download | volse-hubzilla-c8ff773b9609f723217712f0faf451238d41327d.tar.gz volse-hubzilla-c8ff773b9609f723217712f0faf451238d41327d.tar.bz2 volse-hubzilla-c8ff773b9609f723217712f0faf451238d41327d.zip |
Merge pull request #9 from redmatrix/dev
Dev
Diffstat (limited to 'view/js')
-rw-r--r-- | view/js/autocomplete.js | 11 |
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 ); |