diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-03-08 08:55:25 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-03-08 08:55:25 +0100 |
commit | f3a753bda603595fcff25a8e4fa9131e56872f57 (patch) | |
tree | 318837a058d3594c974e101c93af04cc6155a52b /view/js | |
parent | 17c102ebe115bd8272da830bf9523b691ce115ee (diff) | |
parent | 1700aedbed9050ca2eee621c04c29e5b34150bc5 (diff) | |
download | volse-hubzilla-f3a753bda603595fcff25a8e4fa9131e56872f57.tar.gz volse-hubzilla-f3a753bda603595fcff25a8e4fa9131e56872f57.tar.bz2 volse-hubzilla-f3a753bda603595fcff25a8e4fa9131e56872f57.zip |
Merge remote-tracking branch 'mike/master' into dev
Diffstat (limited to 'view/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 ); |