function time_ago(dateString){var blah=1;var rightNow=new Date();var then=new Date(dateString);if($.browser.msie){then=Date.parse(dateString.replace(/( \+)/,' UTC$1'));}
var diff=rightNow- then;var second=1000,minute=second*60,hour=minute*60,day=hour*24,week=day*7;if(isNaN(diff)||diff<0){return"";}
if(diff<second*2){return"just now";}
if(diff<minute){return Math.floor(diff/second)+" seconds ago";}
if(diff<minute*2){return"1 minute ago";}
if(diff<hour){return Math.floor(diff/minute)+" minutes ago";}
if(diff<hour*2){return"1 hour ago";}
if(diff<day){return Math.floor(diff/hour)+" hours ago";}
if(diff>day&&diff<day*2){return"yesterday";}
if(diff<day*365){return Math.floor(diff/day)+" days ago";}
else{return"over a year ago";}}
$(function(){$('time').each(function(){$(this).html(time_ago($(this).attr('datetime')));});});JQTWEET={user:'kanyetothe',numTweets:6,appendTo:'.tweets',loadTweets:function(){$.ajax({url:'http://api.twitter.com/1/statuses/user_timeline.json/',type:'GET',dataType:'jsonp',data:{screen_name:JQTWEET.user,include_rts:true,count:JQTWEET.numTweets,include_entities:true},success:function(data,textStatus,xhr){var html='<li>_TWEET_TEXT_ <time datetime="_TIME_" pubdate>_AGO_</time></li>';for(var i=0;i<data.length;i++){$(JQTWEET.appendTo).append(html.replace('_TWEET_TEXT_',JQTWEET.ify.clean(data[i].text)).replace(/_USER_/g,data[i].user.screen_name).replace('_TIME_',data[i].created_at).replace('_AGO_',time_ago(data[i].created_at)).replace(/_ID_/g,data[i].id_str));}}});},ify:{link:function(tweet){return tweet.replace(/\b(((https*\:\/\/)|www\.)[^\"\']+?)(([!?,.\)]+)?(\s|$))/g,function(link,m1,m2,m3,m4){var http=m2.match(/w/)?'http://':'';return'<a class="twtr-hyperlink" target="_blank" href="'+ http+ m1+'">'+((m1.length>25)?m1.substr(0,24)+'...':m1)+'</a>'+ m4;});},at:function(tweet){return tweet.replace(/\B[@＠]([a-zA-Z0-9_]{1,20})/g,function(m,username){return'<a target="_blank" class="twtr-atreply" href="http://twitter.com/intent/user?screen_name='+ username+'">@'+ username+'</a>';});},list:function(tweet){return tweet.replace(/\B[@＠]([a-zA-Z0-9_]{1,20}\/\w+)/g,function(m,userlist){return'<a target="_blank" class="twtr-atreply" href="http://twitter.com/'+ userlist+'">@'+ userlist+'</a>';});},hash:function(tweet){return tweet.replace(/(^|\s+)#(\w+)/gi,function(m,before,hash){return before+'<a target="_blank" class="hashtag" href="http://twitter.com/search?q=%23'+ hash+'">#'+ hash+'</a>';});},clean:function(tweet){return this.hash(this.at(this.list(this.link(tweet))));}}};$(document).ready(function(){JQTWEET.loadTweets();});$(document).ready(function(){Meteor.hostid=Math.floor(Math.random()*1000000);Meteor.host="live.kanyetothe.com";Meteor.registerEventCallback("process",receive);Meteor.joinChannel('latest',0);Meteor.mode='smartpoll';Meteor.connect();lftf=$('#live-from-the-forum ul');function receive(datastr){stuff=datastr.split(':/:');msgid=stuff[2];subject=stuff[3];lftf.append('<li id="msg-'+msgid+'"><a href="/forum/index.php?msg='+msgid+'">'+subject.replace('Re: ','')+'</a></li>');}
ls=function(){if(!lftf.hasClass('hovering'))
lftf.animate({scrollLeft:lftf.attr('scrollLeft')+1},20,ls);}
ls();lftf.hover(function(){$(this).addClass('hovering');},function(){$(this).removeClass('hovering');ls();});});
