Skip to content

Instantly share code, notes, and snippets.

@dshaw
Created June 1, 2010 04:32
Show Gist options
  • Save dshaw/420563 to your computer and use it in GitHub Desktop.
Save dshaw/420563 to your computer and use it in GitHub Desktop.
Non-templated JS/JSON Code Sample
function render(tweet) {
var html = '<li><div class="tweet">';
html += '<div class="vcard"><a href="http://twitter.com/' + tweet.user.screen_name + '" class="url"><img style="height: 48px; width: 48px;" alt="' + tweet.user.name + '" class="photo fn" height="48" src="' + tweet.user.profile_image_url + '" width="48" /></a></div>';
html += '<div class="hentry"><strong><a href="http://twitter.com/';
html += tweet.user.screen_name + '" ';
html += 'title="' + tweet.user.name + '">' + tweet.user.screen_name + '</a></strong> ';
html += '<span class="entry-content">';
html += container[twitterlib].ify.clean(tweet.text);
html += '</span> <span class="meta entry-meta"><a href="http://twitter.com/' + tweet.user.screen_name;
html += '/status/' + tweet.id + '" class="entry-date" rel="bookmark"><span class="published" title="';
html += tweet.created_at + '">' + container[twitterlib].time.datetime(tweet.created_at) + '</span></a>';
if (tweet.source) html += ' <span>from ' + tweet.source + '</span>';
html += '</span></div></div></li>';
return html;
}
@dshaw
Copy link
Author

dshaw commented Jun 1, 2010

Props to @Rem for his useful TwitterLib, which this is sampled from.
http://github.com/remy/twitterlib/blob/master/twitterlib.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment