diff options
-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..e62959a6c 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('/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 "$1"+item['text'] + ' '; }, + } + this.textcomplete([contacts,smilies],{}); }; })( jQuery ); |