JSFiddle - React, Tailwind, and code Playground
HTML
<div id="twitter-widget"></div>
CSS
.twitStream{
font-family: verdana;
font-size: 11px;
}
.twitStream a{
font-family: verdana;
font-size: 11px;
}
.tweet{
display: block;
padding: .4em;
margin: .4em 0;
}
.tweet-left{
float: left;
margin-right: 1em;
}
.tweet-left img{
border: 2px solid #000000;
}
.tweet p.text{
margin: 0;
padding: 0;
}
JavaScript
/**
* JQUERY4U
*
* Displays the latest tweets.
*
* @author Sam Deering
* @copyright Copyright (c) 2012 JQUERY4U Pty Ltd
* @license http://jquery4u.com/license/
* @since Version 1.0
* @filesource js/jquery4u.widgets.twitter.js
*
*/
var twitter = {
init: function(wid) {
//helper functions
String.prototype.linkify = function() {
return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&;\?\/.=]+/g, function(m) {
return m.link(m);
});
};
String.prototype.linkuser = function() {
return this.replace(/[@]+[A-Za-z0-9-_]+/g, function(u) {
return u.link("http://twitter.com/" + u.replace("@", ""));
});
};
String.prototype.linktag = function() {
return this.replace(/[]+[A-Za-z0-9-_]+/, function(t) {
return t;
});
};
//get the tweets from Twitter API
//$.getJSON("http://search.twitter.com/search.json?q=jquery4u&rpp=5&callback=?", function(data) {
$.getJSON("http://search.twitter.com/search.json?q=pytohn%20OR%20pyhton%20OR%20pyhotn%20OR%20pyothn%20OR%20pyohtn%20OR%20ptyhon%20OR%20ptyohn%20OR%20pthyon%20OR%20pthoyn%20OR%20ptoyhn%20OR%20ptohyn%20OR%20phyton%20OR%20phyotn%20OR%20phtyon%20OR%20phtoyn%20OR%20phoytn%20OR%20photyn%20OR%20poythn%20OR%20poyhtn%20OR%20potyhn%20OR%20pothyn%20OR%20pohytn%20OR%20pohtyn&rpp=25&callback=?", function(data) {
// console.log(data.items.length);
$(data.results).each(function(i, v) {
var tTime = new Date(Date.parse(this.created_at));
var cTime = new Date();
var sinceMin = Math.round((cTime - tTime) / 60000);
if (sinceMin == 0) {
var sinceSec = Math.round((cTime - tTime) / 1000);
if (sinceSec < 10) var since = 'less than 10 seconds ago';
else if (sinceSec...