Created
March 15, 2009 22:35
-
-
Save camwest/79565 to your computer and use it in GitHub Desktop.
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
var Tweet = Class.create({ | |
initialize: function(data) { | |
this.date = data.created_at; | |
this.fromUser = data.from_user; | |
this.text = data.text; | |
this.imageSource = data.profile_image_url; | |
this.id = data.id; | |
}, | |
toElement: function() { | |
return new Element("div", { className: "tweet" }).insert( | |
new Element("img", { src: this.imageSource }) | |
).insert( | |
new Element("p").insert( | |
new Element("a", { href: "http://twitter.com/" + this.fromUser }).update(this.fromUser) | |
).insert(" " + this.text + ", ").insert( | |
new Element("a", { href: "http://twitter.com/" + this.fromUser + "/statuses/" + this.id }).update("#") | |
) | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment