diff options
author | Andrew Manning <tamanning@zoho.com> | 2018-03-10 15:10:09 -0500 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2018-03-10 15:10:09 -0500 |
commit | a4de63ca923583b77cf2a4ad60f4893e006f90e4 (patch) | |
tree | 31406e7dffabc54d2b49879272598236949793c7 /view/js/autocomplete.js | |
parent | 9b13db1c4896e6a8b0a55195530f5449999e811d (diff) | |
parent | 78040330b6be3681dd0d6fdd1d3d0960fd88bc06 (diff) | |
download | volse-hubzilla-a4de63ca923583b77cf2a4ad60f4893e006f90e4.tar.gz volse-hubzilla-a4de63ca923583b77cf2a4ad60f4893e006f90e4.tar.bz2 volse-hubzilla-a4de63ca923583b77cf2a4ad60f4893e006f90e4.zip |
Merge branch 'dev' into oauth2
Diffstat (limited to 'view/js/autocomplete.js')
-rw-r--r-- | view/js/autocomplete.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 01def9900..2d017db18 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -74,6 +74,10 @@ function bbco_format(item) { return "<div class='dropdown-item'>" + item + "</div>"; } +function tag_format(item) { + return "<div class='dropdown-item'>" + '#' + item.text + "</div>"; +} + function editor_replace(item) { if(typeof item.replace !== 'undefined') { return '$1$2' + item.replace; @@ -202,6 +206,16 @@ function string2bb(element) { }; + // Autocomplete hashtags + tags = { + match: /(^|\s)(\#)([^ \n]{2,})$/, + index: 3, + search: function(term, callback) { $.getJSON('/hashtags/' + '$f=&t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.indexOf(term) === 0 ? entry : null; })); }); }, + replace: function(item) { return "$1$2" + item.text + ' '; }, + template: tag_format + }; + + smilies = { match: /(^|\s)(:[a-z_:]{2,})$/, index: 2, @@ -211,7 +225,7 @@ function string2bb(element) { template: smiley_format }; this.attr('autocomplete','off'); - this.textcomplete([contacts,forums,smilies], {className:'acpopup', zIndex:1020}); + this.textcomplete([contacts,forums,smilies,tags], {className:'acpopup', zIndex:1020}); }; })( jQuery ); |