jQuery.fn.reverse=Array.prototype.reverse; String.prototype.linkify=function() {return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/g,function(m) {return m.link(m); }); }; String.prototype.linkuser=function() {return this.replace(/[@]+[A-Za-z0-9-_]+/g,function(u) {var username=u.replace("@","") return u.link("http://twitter.com/"+username); }); }; String.prototype.linktag=function() {return this.replace(/[#]+[A-Za-z0-9-_]+/,function(t) {var tag=t.replace("#","%23") return t.link("http://search.twitter.com/search?q="+tag); }); }; function fetch_tweets(elem) {elem=$(elem); input=elem.attr('title'); lang=elem.attr('lang'); if(input!=window.monitter['text-'+input]) {window.monitter['last_id'+input]=0; window.monitter['text-'+input]=input; window.monitter['count-'+input]=12; ;} if(window.monitter['count-'+input]>10) {elem.prepend('
'); window.monitter['count-'+input]=0; } var url="http://search.twitter.com/search.json?q="+input+"&lang="+lang+"&rpp="+rrp+"&since_id="+window.monitter['last_id'+input]+"&callback=?"; $.getJSON(url,function(json) {$('div.tweet:gt('+window.monitter['limit']+')',elem).each(function(){$(this).fadeOut('slow')}); $(json.results).reverse().each(function() {if($('#tw'+this.id,elem).length==0) {window.monitter['count-'+input]++; var rightNow = new Date(); var thedate = new Date(Date.parse(this.created_at) - (rightNow.getTimezoneOffset() * 60000)); var thedatehours = (thedate.getHours() < 12) ? thedate.getHours() : thedate.getHours() - 12; var thedateminutes = (thedate.getMinutes() < 10) ? '0' + thedate.getMinutes() : thedate.getMinutes(); var thedatemeridian = (thedate.getHours() < 12) ? 'am' : 'pm'; var thedatedate = ((thedate.getMonth()+thedate.getDate())!=(rightNow.getMonth()+rightNow.getDate())) ? ' '+thedate.getMonth()+'/'+thedate.getDate() : '' ; var thedatestr = thedatehours+':'+thedateminutes+thedatemeridian+thedatedate; var divstr=''+this.text.linkify().linkuser().linktag()+'
'+this.from_user+' - '+thedatestr+'