Created
September 20, 2012 06:19
-
-
Save pokle/3754241 to your computer and use it in GitHub Desktop.
How to display your tweets without a plugin
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Just the latest tweet</title> | |
</head> | |
<body> | |
<script> | |
// From http://twitter.com/javascripts/blogger.js | |
function tweettweet(twitters) { | |
var statusHTML = []; | |
for (var i = 0; i < twitters.length; i++) { | |
var username = twitters[i].user.screen_name; | |
var status = twitters[i].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) { | |
return '<a href="' + url + '">' + url + '</a>'; | |
}).replace(/\B@([_a-z0-9]+)/ig, function(reply) { | |
return reply.charAt(0) + '<a href="http://twitter.com/' + reply.substring(1) + '">' + reply.substring(1) + '</a>'; | |
}); | |
statusHTML.push('<li><span>' + status + '</span> <a style="font-size:85%" href="http://twitter.com/' + username + '/statuses/' + twitters[i].id_str + '">' + (twitters[i].created_at) + '</a></li>'); | |
} | |
document.getElementById('twitter_update_list').innerHTML = statusHTML.join(''); | |
} | |
</script> | |
<div id="twitter_update_list"></div> | |
<script type="text/javascript" src="//twitter.com/statuses/user_timeline/tusharpokle.json?callback=tweettweet&count=1"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh, and replace 'tusharpokle' with your own twitter id.