Skip to content

Instantly share code, notes, and snippets.

@kyle-ssg
Created July 22, 2015 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyle-ssg/00d183fe4af854a5e1b5 to your computer and use it in GitHub Desktop.
Save kyle-ssg/00d183fe4af854a5e1b5 to your computer and use it in GitHub Desktop.
Parse posts
this.content = Autolinker.link( content, {
replaceFn: function (autolinker, match) {
switch (match.getType()) {
case 'url' :
if (match.url.match(/\.(jpeg|jpg|gif|png)$/) != null) {
image = match.url;
if (image.indexOf('http') !=0) {
image = 'http://'+image;
}
} else if (Modernizr.video && match.url.match(/\.(mp4|webm)$/) != null) {
video = match.url;
if (video.indexOf('http') !=0) {
video = 'http://'+video;
}
}
return true;
case 'email' :
console.log('email', match);
return true;
case 'phone' :
console.log('phone', match);
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment