function replaceURLWithHTMLLinks(text) {
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/i;
return text.replace(exp,"$1");
}
function tweetagCallback(json)
{
html = "";
html += "
";
html += "";
html += "";
html += ""+json.user.screen_name+"";
html += "";
html += "
";
html += ""+time_since(Date.parse(json.created_at))+"";
html += "View on Twitter";
document.write("");
}
function time_since(original) {
var foo = new Date; // Generic JS date object
var unixtime_ms = foo.getTime(); // Returns milliseconds since the epoch
var today = Math.floor(unixtime_ms / 1000); /* Current unix time */
// original = original - 12*3600;
original = original.toString().substr(0,10);
// console.info("unix time: %i tweet time: %i - difference: %i",today,original,(today-original));
var since = today - original;
//console.debug(since);
if(window.console)
console.info("epoch: %s - %s = %s",today,original,since);
var toprint="",days,hours,minutes;
if(since>(24*3600))
{
days = Math.floor(since/(3600*24));
toprint += days+" day";
if(days>1)
toprint += "s";
toprint += " ";
since = since%(24*3600);
}
if(since>3600)
{
hours = Math.floor(since/3600);
toprint += hours+" hour";
if(hours>1)
toprint += "s";
toprint += " ";
since = since%3600;
}
if(since>60)
{
minutes = Math.floor(since/60);
toprint += minutes+" minute";
if(minutes>1)
toprint += "s";
toprint += " ";
since = since%60;
}
else
toprint = "less than a minute";
// toprint += since+" seconds";
toprint += " ago";
return toprint;
}
tweetagCallback({"in_reply_to_status_id":null,"created_at":"Thu Jul 02 06:25:38 +0000 2009","geo":null,"coordinates":null,"in_reply_to_screen_name":null,"truncated":false,"retweeted":false,"source":"Echofon","favorited":false,"contributors":null,"place":null,"in_reply_to_user_id":null,"user":{"geo_enabled":false,"description":"Journaliste, Publisher of CBS Interactive France: ZDNet.fr, CNETFrance.fr, Gamekult.com","lang":"fr","profile_background_tile":false,"created_at":"Tue Jun 12 22:30:15 +0000 2007","profile_link_color":"97c9d8","location":"Paris (France)","verified":false,"follow_request_sent":null,"notifications":null,"profile_sidebar_fill_color":"252429","following":null,"profile_image_url":"http://a2.twimg.com/profile_images/251940698/ecosphere-128_normal.jpg","profile_sidebar_border_color":"181A1E","followers_count":1961,"screen_name":"eparody","listed_count":184,"friends_count":166,"protected":false,"statuses_count":1313,"profile_use_background_image":true,"time_zone":"Paris","profile_background_color":"1A1B1F","name":"Emmanuel Parody","show_all_inline_media":false,"favourites_count":2,"id":6777512,"contributors_enabled":false,"profile_background_image_url":"http://s.twimg.com/a/1282328015/images/themes/theme1/bg.png","utc_offset":3600,"profile_text_color":"666666","url":"http://www.cbsinteractive.fr"},"retweet_count":null,"id":2433376413,"text":"Demarrer la journ\u00e9e avec un Twitt de @EricScherer c'est aussi poilant que de voir une mouche se d\u00e9battre dans son bol de lait... ;-)"});