Skip to content

Instantly share code, notes, and snippets.

@ded
Created September 17, 2010 20:03
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 ded/584848 to your computer and use it in GitHub Desktop.
Save ded/584848 to your computer and use it in GitHub Desktop.
/*----------------------- OMG TWITTER -------------------------------------*/
twttr.mediaType('twttr.media.types.Twitter')
.matcher(/\b(?:(?:https?\:\/\/)?(?:www\.)?)?twitter\.com\/(?:(?:#|#!)\/)?(?:\w{1,20})\/status\/(\S+)/gi)
.icon("generic")
.favicon("http://twitter.com/phoenix/favicon.ico")
.url('http://twitter.com')
.process(function(slug, cb) {
var that = this;
twttr.API.Status.find(slug.replace(/\/$/, ''), function(status) {
that.data["tweet"] = status;
cb();
});
})
.methods({
html: function(cb) {
var tweetHtml = new twttr.views.LatestTweet(this.data["tweet"]).html();
cb(tweetHtml);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment