Last active
December 15, 2015 05:29
-
-
Save alexanderk23/5209578 to your computer and use it in GitHub Desktop.
Pure JS solution
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
| <html> | |
| <head> | |
| <script src="https://raw.github.com/remy/twitterlib/master/twitterlib.min.js"></script> | |
| <script src="https://raw.github.com/timrwood/moment/2.0.0/min/moment.min.js"></script> | |
| </head> | |
| <body> | |
| <div id="tweet" data-username="bountify"></div> | |
| <script> | |
| var tweet = document.getElementById('tweet'); | |
| var username = tweet.getAttribute('data-username'); | |
| twitterlib.timeline(username, { limit: 3 }, function(tweets) { | |
| for(var i = 0; i < tweets.length; i++) { | |
| var newItem = document.createElement("DIV"); | |
| var ts = moment(tweets[i].created_at).fromNow(); | |
| newItem.innerHTML = this.ify.clean(tweets[i].text) + ' <small>(' + ts + ')</small>'; | |
| tweet.appendChild(newItem); | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment