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":"Tue Jun 02 07:28:17 +0000 2009","geo":null,"coordinates":null,"in_reply_to_screen_name":null,"truncated":false,"retweeted":false,"source":"web","favorited":false,"contributors":null,"place":null,"in_reply_to_user_id":null,"user":{"listed_count":322,"friends_count":2731,"description":"Secr\u00e9taire G\u00e9n. CTF T\u00e9l\u00e9s francophones publiques de France, Belgique, Suisse, Canada-Qu\u00e9bec. Chroniqueur RTBF.be (m\u00e9diaTIC/interM\u00e9dias) Columnist De Standaard.","lang":"fr","statuses_count":2590,"profile_background_tile":true,"created_at":"Mon Mar 10 21:25:51 +0000 2008","profile_link_color":"34b9ea","location":"Belgium","show_all_inline_media":false,"favourites_count":0,"contributors_enabled":false,"notifications":null,"profile_sidebar_fill_color":"DDFFCC","following":null,"geo_enabled":false,"profile_image_url":"http://a3.twimg.com/profile_images/859925219/11834_175905714222_620544222_2721443_3426328_n_normal.jpg","profile_sidebar_border_color":"BDDCAD","verified":false,"screen_name":"AlainGerlache","follow_request_sent":null,"protected":false,"profile_use_background_image":true,"time_zone":"Brussels","profile_background_color":"9AE4E8","name":"Alain Gerlache","followers_count":3185,"id":14117639,"profile_background_image_url":"http://a3.twimg.com/profile_background_images/139044603/twilk_background_4c725a04a195c.jpg","utc_offset":3600,"profile_text_color":"333333","url":"http://www.alaingerlache.be"},"retweet_count":null,"id":2001309254,"text":"Sondages : quelle validit\u00e9 pour les commentaires \"journalistiques\" ou les grands titres qui ne tiennent pas compte de la marge d'erreur?"});