Skip to content

Instantly share code, notes, and snippets.

@jrom
Created March 7, 2012 11:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrom/1992651 to your computer and use it in GitHub Desktop.
Save jrom/1992651 to your computer and use it in GitHub Desktop.
Emoji plugin for Talker
plugin.onMessageInsertion = function (event) {
var content;
content = Talker.getLastInsertion().replace(/:[\w_+]+:/g, function (match) {
var emoji = match,
filename = (emoji == ':+1:' ? ':plus1:' : emoji).replace(/:/g, '');
return "<img class=\"emoji\" title=\"" + emoji + "\" alt=\"" + emoji + "\" height=\"20\" width=\"20\" align=\"absmiddle\" src=\"https://teambox.com/assets/emojis/" + filename + ".png\">"
});
return content;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment