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 Jul 14 13:05:44 +0000 2009","geo":null,"coordinates":null,"in_reply_to_screen_name":null,"truncated":false,"retweeted":false,"source":"TweetDeck","favorited":false,"contributors":null,"place":null,"in_reply_to_user_id":null,"user":{"description":"City is not a jungle. It's a zoo.","lang":"fr","profile_background_tile":false,"created_at":"Sat Nov 22 12:24:56 +0000 2008","profile_link_color":"1F98C7","location":"Brussels","listed_count":66,"followers_count":457,"statuses_count":3741,"notifications":null,"profile_sidebar_fill_color":"DAECF4","show_all_inline_media":false,"following":null,"friends_count":385,"profile_image_url":"http://a2.twimg.com/profile_images/276200926/bonheur_normal.jpg","contributors_enabled":false,"profile_sidebar_border_color":"C6E2EE","favourites_count":25,"screen_name":"vertbruxelles","protected":false,"geo_enabled":false,"profile_use_background_image":true,"time_zone":"Brussels","profile_background_color":"C6E2EE","name":"Baptiste","follow_request_sent":null,"id":17556507,"verified":false,"profile_background_image_url":"http://s.twimg.com/a/1281738360/images/themes/theme2/bg.gif","utc_offset":3600,"profile_text_color":"663B12","url":"http://enattendantlafindumonde.blogspot.com"},"retweet_count":null,"id":2631727229,"text":"(les joueurs de djemb\u00e9 sont de nouveau de retour place Flagey. J'h\u00e9site entre les boules Qui\u00e8s ou le fusil \u00e0 lunette)"});