Created
July 22, 2015 15:11
-
-
Save kyle-ssg/00d183fe4af854a5e1b5 to your computer and use it in GitHub Desktop.
Parse posts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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