Skip to content

Commit

Permalink
Update atwho_autocomplete.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jywarren authored Jan 16, 2019
1 parent 3142a6d commit 73ea40d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/assets/javascripts/atwho_autocomplete.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
(function() {

# settings at https://github.com/ichord/At.js/wiki/Base-Document#settings
var at_config = {
at: "@",
delay: 400,
callbacks: {
remoteFilter: function(query, callback) {
$.getJSON("/api/srch/profiles?query=" + query + "&sort_by=recent&field=username", {}, function(data) {
Expand All @@ -15,6 +17,7 @@
},
hashtags_config = {
at: "#",
delay: 400,
callbacks: {
remoteFilter: function(query, callback) {
if (query != ''){
Expand All @@ -28,11 +31,16 @@
},
emojis_config = {
at: ':',
delay: 400,
data: Object.keys(emoji).map(function(name){ return {'name': name, 'value': emoji[name]}}),
displayTpl: "<li>${value} ${name}</li>",
insertTpl: ":${name}:",
limit: 100
}

$('textarea#text-input').atwho(at_config).atwho(hashtags_config).atwho(emojis_config);
})();
$('textarea#text-input')
.atwho(at_config)
.atwho(hashtags_config)
.atwho(emojis_config);

})();

0 comments on commit 73ea40d

Please sign in to comment.