Skip to content

Instantly share code, notes, and snippets.

@bruno-c
Created June 1, 2011 13:59
Show Gist options
  • Save bruno-c/1002338 to your computer and use it in GitHub Desktop.
Save bruno-c/1002338 to your computer and use it in GitHub Desktop.
f7u12 faces plugin for talker
/* Written by @vincentsimard */
/*
Converts f7u12 faces code into images
See http://www.reddit.com/r/fffffffuuuuuuuuuuuu/comments/ecnd4/every_fffffffuuuuuuuuuuu_face_a_reference_guide for reference
Does not support titles, or any other cool features
Type [/code] to use the face in Talker.
*/
plugin.F7U12Faces = function(matcher){
this.matcher = matcher;
this.replacementString = ' <a href="DEEEEEEEEEERP" title="" ></a> ';
$('head').append('<link href="http://vincentsimard.com/f7u12.css" rel="stylesheet" type="text/css" media="all" />');
}
// plugin.f7u12Faces = [new plugin.F7U12Faces(/\[\]\((.*?)\)/)];
plugin.f7u12Faces = [new plugin.F7U12Faces(/\[(\/.*?)\]/)];
plugin.onMessageInsertion = function(event) {
var element = Talker.getLastInsertion();
_.each(plugin.f7u12Faces, function(face) {
element.replace(face.matcher, function(match) {
match = match.substr(1, match.length - 2);
// console.log(match);
var replacementStringuuuuuuu = face.replacementString;
replacementStringuuuuuuu = replacementStringuuuuuuu.replace('DEEEEEEEEEERP', match);
return replacementStringuuuuuuu;
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment