Skip to content

Instantly share code, notes, and snippets.

@Aufree
Last active August 29, 2015 14:07
Show Gist options
  • Save Aufree/421ccfee7bbaa43958d1 to your computer and use it in GitHub Desktop.
Save Aufree/421ccfee7bbaa43958d1 to your computer and use it in GitHub Desktop.
The basic configuration of easy-emoji
$(function(){
emojify.setConfig({
img_dir: '/images/emoji',
ignored_tags: {
'SCRIPT': 1,
'TEXTAREA': 1,
'A': 1,
'PRE': 1,
'CODE': 1
}
});
emojify.run();
$('textarea').textcomplete([{ // emoji strategy
match: /\B:([\-+\w]*)$/,
search: function(term, callback) {
callback($.map(emojies, function(emoji) {
return emoji.indexOf(term) === 0 ? emoji : null;
}));
},
template: function(value) {
return '<img src="/images/emoji/' + value + '.png" class="emoji"></img>' + value;
},
replace: function(value) {
return ':' + value + ': ';
},
index: 1,
maxCount: 5
}]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment