This file contains hidden or 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
// parses the text in a tweet and adds links to users, hash tags and urls | |
parseTweet: function (text) { | |
// parse urls | |
text = text.replace(/[A-Za-z]+:\/\/[A-Za-z0-9_-]+\.[A-Za-z0-9_:%&~\?\/.=-]+/g, function(url) { | |
return url.link(url) | |
}) | |
// parse usernames | |
text = text.replace(/[@]+[A-Za-z0-9_-]+/g, function(u) { | |
var username = u.replace("@","") | |
return u.link("http://twitter.com/"+username) |
NewerOlder