var stream = [{"id":"q5slr","type":"jpg","message":"Twitter+EyeTV mashup to provide a backchannel during live TV broadcasts. I watch digital TV on a flat screen TV hooked up to a Mac Mini. I am sure there are ways of implementing this kind of thing in many different systems.","timestamp":"1258674634"},{"id":"pr6jx","type":"jpg","message":"I wish it were more obvious if a person followed me or not. Like this . . .","timestamp":"1258382766"}];
function twitpicBuildBadge() {
document.write("
");
var statusHTML = "";
for (var i=0; i'+stream[i].message+' '+relative_time(stream[i].timestamp)+'')
}
document.getElementById('twitpic_badge_container_v1').innerHTML = 'Twitpic Updates
' + statusHTML + 'View my photos';
}
function relative_time(time_value) {
var parsed_date = time_value;
//var relative_to = new Date();
//var delta = parseInt((relative_to.getTime() / 1000) - parsed_date);
var delta = parseInt((1258802882) - parsed_date);
//delta = delta + (relative_to.getTimezoneOffset() * 60);
if (delta < 60) {
return 'less than a minute ago';
} else if(delta < 120) {
return 'about a minute ago';
} else if(delta < (60*60)) {
return (parseInt(delta / 60)).toString() + ' minutes ago';
} else if(delta < (120*60)) {
return 'about an hour ago';
} else if(delta < (24*60*60)) {
return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';
} else if(delta < (48*60*60)) {
return '1 day ago';
} else {
return (parseInt(delta / 86400)).toString() + ' days ago';
}
}
twitpicBuildBadge();