Skip to content

Instantly share code, notes, and snippets.

@steve-ayerhart
Created February 3, 2012 21:11
Show Gist options
  • Save steve-ayerhart/1732634 to your computer and use it in GitHub Desktop.
Save steve-ayerhart/1732634 to your computer and use it in GitHub Desktop.
plugin.EmoticonPlus = function(matcher, image) {
this.matcher = matcher;
this.image = image;
this.getImage = function() {
var img = ['<img src="', image, '" />'];
return img.join('');
}
}
plugin.emoticons = [
new plugin.EmoticonPlus (/\(poolparty\)/, "http://factoryjoe.s3.amazonaws.com/emoticons/emoticon-0182-poolparty.gif")
];
plugin.onMessageInsertion = function(talkerEvent){
// to replace pasted text as well, change .find(".line") to .find(".line,pre")
var element = Talker.getLastRow().find(".line");
_.each(plugin.emoticons, function(emoticon) {
element.replace(emoticon.matcher, emoticon.getImage());
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment