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;
}
Warning: file_get_contents(http://twitter.com/statuses/show/2263097875.json?callback=tweetagCallback) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/tweetag/tweetag.com/widgets/status.php on line 82