(function(c){var b={limit:5,username:"jeresig",timeout:2000,html_before:"<ul>",html_tweets:"<li>{text}<br>{date}</li>",html_after:"</ul>",loading_text:"loading...",format_date:function(e){return c.fn.livetweet("format_date",e)},error_text:"an error has occurred!"};var a={init:function(d){var e=this;if(d){c.extend(b,d)}c.ajax({beforeSend:e.html('<span class="livetweet-loading">'+b.loading_text+"</span>"),url:"http://search.twitter.com/search.json?q=+from%3Aenergieleben",type:"GET",dataType:"jsonp",timeout:b.timeout,error:function(){e.html('<span class="livetweet-error">'+b.error+"</span>")},success:function(f){e.find(".livetweet-loading").remove();sizer=f.results.length>b.limit?b.limit:f.results.length;rt=b.html_before;tweets="";for(i=0;i<sizer;i++){text=b.html_tweets.replace("{text}",c.fn.livetweet("format_links",f.results[i].text));tweets+=text.replace("{date}",b.format_date(new Date(Date.parse(new Date(Date.parse(f.results[i].created_at.replace(/(\+\S+) (.*)/,"$2 $1")))))))}rt+=tweets+b.html_after;return e.each(function(){c(this).append(rt)})}})},format_links:function(e){var d=/((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;var g=/[\@]+([A-Za-z0-9-_]+)/gi;var f=/ [\#]+([A-Za-z0-9-_]+)/gi;e=e.replace(d,'<a target="_blank" href="$1">$1</a>');e=e.replace(g,'<a target="_blank" href="http://twitter.com/$1">@$1</a>');e=e.replace(f,'<a target="_blank" href=""http://search.twitter.com/search?q=&tag=$1&lang=all">#$1</a>');return e},format_date:function(f){var e=new Array("GEN","FEB","MAR","APR","MAG","GIU","LUG","AGO","SET","OTT","NOV","DIC");var g=new Array("Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato");min=f.getMinutes()<10?"0"+f.getMinutes():f.getMinutes();return f.getDate()+"."+f.getMonth()+"."+f.getFullYear()+" "+f.getHours()+"."+min}};c.fn.livetweet=function(d){if(a[d]){return a[d].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof d==="object"||!d){return a.init.apply(this,arguments)}else{c.error("Method "+d+" does not exist on jQuery.livetweet")}}}})(jQuery);
