diff options
author | Stefan Parviainen <saparvia@caterva.eu> | 2014-12-20 17:32:50 +0100 |
---|---|---|
committer | Stefan Parviainen <saparvia@caterva.eu> | 2014-12-20 17:32:50 +0100 |
commit | d1f53511921afce820d73eb2d2924e2a4aa8ba14 (patch) | |
tree | 749d53232106876e97d9ed8efe35f5e642db0ffa /view/js/autocomplete.js | |
parent | 92a46c34c7d66415ab2bcd7a03dcc42fc6391af4 (diff) | |
download | volse-hubzilla-d1f53511921afce820d73eb2d2924e2a4aa8ba14.tar.gz volse-hubzilla-d1f53511921afce820d73eb2d2924e2a4aa8ba14.tar.bz2 volse-hubzilla-d1f53511921afce820d73eb2d2924e2a4aa8ba14.zip |
Autocomplete smilies
Diffstat (limited to 'view/js/autocomplete.js')
-rw-r--r-- | view/js/autocomplete.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 31d693c7b..fa293fdfd 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -46,6 +46,14 @@ function replace(item) { replace: replace, template: format, } - this.textcomplete([contacts],{}); + + smilies = { + match: /(^|\s)(:[a-z]{2,})$/, + index: 2, + search: function(term, callback) { $.getJSON('https://caterva.eu/smilies/json').done(function(data) { callback($.map(data, function(entry) { return entry['text'].indexOf(term) === 0 ? entry : null })) }) }, + template: function(item) { return item['icon'] + item['text'] }, + replace: function(item) { return item['text'] + ' '; }, + } + this.textcomplete([contacts,smilies],{}); }; })( jQuery ); |