Some writing by Trek

& archive, twitter, github

Quick Tip: Auto-urling

by Trek on

If you’d like to add auto urling (including links to @trek-style twitter accounts) to an html element try:

// status area
var status = $('.tweet .status');
// add hrefs to twitter accounts and links
if (status.length) {
  status.html(status.html().replace(/(https?:\/\/[\w\d\.\/]+\b)/g, "<a href='$1'><a>"));
  status.html(status.html().replace(/@(\b[\w\d]+\b)/g, "<a href='http://www.twitter.com/$1'>@$1</a>"));
}
blog comments powered by Disqus