(function(a){a.fn.tweet=function(b){function d(a){var b=Date.parse(a),c=arguments.length>1?arguments[1]:new Date,d=parseInt((c.getTime()-b)/1e3);return d<60?"less than a minute ago":d<120?"about a minute ago":d<2700?parseInt(d/60).toString()+" minutes ago":d<5400?"about an hour ago":d<86400?"about "+parseInt(d/3600).toString()+" hours ago":d<172800?"1 day ago":parseInt(d/86400).toString()+" days ago"}var c={username:["seaofclouds"],avatar_size:null,count:3,intro_text:null,outro_text:null,join_text:null,auto_join_text_default:"i said,",auto_join_text_ed:"i",auto_join_text_ing:"i am",auto_join_text_reply:"i replied to",auto_join_text_url:"i was looking at",loading_text:null,query:null};return a.fn.extend({linkUrl:function(){var b=[],c=/((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;return this.each(function(){b.push(this.replace(c,'<a href="$1">$1</a>'))}),a(b)},linkUser:function(){var b=[],c=/[\@]+([A-Za-z0-9-_]+)/gi;return this.each(function(){b.push(this.replace(c,'<a href="http://twitter.com/$1">@$1</a>'))}),a(b)},linkHash:function(){var b=[],d=/ [\#]+([A-Za-z0-9-_]+)/gi;return this.each(function(){b.push(this.replace(d,' <a href="http://search.twitter.com/search?q=&tag=$1&lang=all&from='+c.username.join("%2BOR%2B")+'">#$1</a>'))}),a(b)},capAwesome:function(){var b=[];return this.each(function(){b.push(this.replace(/(a|A)wesome/gi,"AWESOME"))}),a(b)},capEpic:function(){var b=[];return this.each(function(){b.push(this.replace(/(e|E)pic/gi,"EPIC"))}),a(b)},makeHeart:function(){var b=[];return this.each(function(){b.push(this.replace(/[&lt;]+[3]/gi,"<tt class='heart'>&#x2665;</tt>"))}),a(b)}}),b&&a.extend(c,b),this.each(function(){var b=a('<ul class="tweet_list">').appendTo(this),e='<p class="tweet_intro">'+c.intro_text+"</p>",f='<p class="tweet_outro">'+c.outro_text+"</p>",g=a('<p class="loading">'+c.loading_text+"</p>");typeof c.username=="string"&&(c.username=[c.username]);var h="";c.query&&(h+="q="+c.query),h+="&q=from:"+c.username.join("%20OR%20from:");var i="http://search.twitter.com/search.json?&"+h+"&rpp="+c.count+"&callback=?";c.loading_text&&a(this).append(g),a.getJSON(i,function(h){c.loading_text&&g.remove(),c.intro_text&&b.before(e),a.each(h.results,function(e,f){if(c.join_text=="auto")if(f.text.match(/^(@([A-Za-z0-9-_]+)) .*/i))var g=c.auto_join_text_reply;else if(f.text.match(/(^\w+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+) .*/i))var g=c.auto_join_text_url;else if(f.text.match(/^((\w+ed)|just) .*/im))var g=c.auto_join_text_ed;else if(f.text.match(/^(\w*ing) .*/i))var g=c.auto_join_text_ing;else var g=c.auto_join_text_default;else var g=c.join_text;var h='<span class="tweet_join"> '+g+" </span>",i=c.join_text?h:" ",j='<a class="tweet_avatar" href="http://twitter.com/'+f.from_user+'"><img src="'+f.profile_image_url+'" height="'+c.avatar_size+'" width="'+c.avatar_size+'" alt="'+f.from_user+'\'s avatar" border="0"/></a>',k=c.avatar_size?j:"",l='<a href="http://twitter.com/'+f.from_user+"/statuses/"+f.id+'" title="view tweet on twitter">'+d(f.created_at)+"</a>",m='<span class="tweet_text">'+a([f.text]).linkUrl().linkUser().linkHash().makeHeart().capAwesome().capEpic()[0]+"</span>";b.append("<li>"+k+l+i+m+"</li>"),b.children("li:first").addClass("tweet_first"),b.children("li:odd").addClass("tweet_even"),b.children("li:even").addClass("tweet_odd")}),c.outro_text&&b.after(f)})})}})(jQuery)
