Array.prototype.inArray=function(b){var a;for(a=0;a<this.length;a++){if(this[a]===b){return true}}return false};function LinkedList(){}LinkedList.prototype={length:0,first:null,last:null};LinkedList.Circular=function(){};LinkedList.Circular.prototype=new LinkedList();LinkedList.Circular.prototype.append=function(a){if(this.first===null){a.prev=a;a.next=a;this.first=a;this.last=a}else{a.prev=this.last;a.next=this.first;this.first.prev=a;this.last.next=a;this.last=a}this.length++};LinkedList.Circular.prototype.prepend=function(a){if(this.last===null){a.prev=a;a.next=a;this.first=a;this.last=a}else{a.prev=this.last;a.next=this.first;this.last.next=a;this.first.prev=a;this.first=a}this.length++};LinkedList.Circular.prototype.insertAfter=function(b,a){a.prev=b;a.next=b.next;b.next.prev=a;b.next=a;if(a.prev==this.last){this.last=a}this.length++};LinkedList.Circular.prototype.remove=function(a){if(this.length>1){a.prev.next=a.next;a.next.prev=a.prev;if(a==this.first){this.first=a.next}if(a==this.last){this.last=a.prev}}else{this.first=null;this.last=null}a.prev=null;a.next=null;this.length--};var trend="",timer=0,queuestatus=0,customsearches=0,state="a";var instant=function(b){b.removeClass("post-hidden")};var fall=function(b){b.removeClass("post-hidden").css("margin-bottom",0-b.height()).css("top",-170).animate({top:"0px",marginBottom:"0px"},"slow")};var animate=instant;var add=function(){return true};var cleanup=function(){return true};var tweetQueue=new LinkedList.Circular();var rollingids=new Array(50);$(document).ready(function(){doSinglePrep();Hydrometeor.path="/hm1backend";Hydrometeor.registerEventCallback("process","newInsert");Hydrometeor.joinChannel(channelToJoin,15);Hydrometeor.connect();$("#updates").mouseover(function(a){timelineMouseover(a)});waitForBacktrack()});function doSinglePrep(){$("#page").html('<div id="updates"><div id="timeline_body"></div></div>');add=function(e,a,b,d,c){$("#timeline_body").prepend(constructUpdate(e,a,b,d,c))};cleanup=function(){$(".post:not(.post-hidden):gt(25)",$("#timeline_body")).fadeOut("slow",function(){$(this).remove()})}}function doDoublePrep(){$("#page").html('<div id="updates"><div class="updates" id="a"></div><div class="updates" id="b"></div></div>');add=function(e,a,b,d,c){$("#"+state).prepend(constructUpdate(e,a,b,d,c+" smaller"));state=="a"?state="b":state="a"};cleanup=function(){$(".post:not(.post-hidden):gt(25)",$("#a")).fadeOut("slow",function(){$(this).remove()});$(".post:not(.post-hidden):gt(25)",$("#b")).fadeOut("slow",function(){$(this).remove()})}}function waitForBacktrack(){if(Hydrometeor.status==1){setTimeout("initialDequeue()",1000)}else{setTimeout("waitForBacktrack()",200)}}function initialDequeue(){$("#updates").dequeue();if($("#updates").queue("fx").length==0){animate=fall;restartQueue()}else{initialDequeue()}}function pauseQueue(){if(queuestatus==1){clearInterval(timer);queuestatus=0}}function restartQueue(a){if(queuestatus==0){timer=setInterval("processQueue()",1750);queuestatus=1}}function processQueue(){$("#updates").dequeue()}function parseText(a){var a=a.replace(/(?:(?:http:\/\/)|(www\.))(.*?)(\s|$|,|\. |\.$|\"|\))/g,'<a href="http://$1$2" target="_blank">http://$1$2</a>$3');var a=a.replace(/(\s|^)\@([0-9a-zA-Z_]+)/g,'$1<a href="http://twitter.com/$2" class="twitter-link" target="_blank">@$2</a>');return a}function newInsert(d){var c=/id{([0-9]+?)}username{(.+?)}avatar{(.+?)}text{(.+?)}type{(.+?)}lang{(.*?)}channel{(.*?)}/;var b=d.match(c);if(rollingids.inArray(b[1])==false){var e=parseText(b[4]);var a={id:b[1],user:b[2],avatar:b[3],text:e,type:b[5],channel:b[7]};tweetQueue.append(a);addQueueItem();addToQueue(b[1],rollingids)}}function constructUpdate(e,a,b,d,c){var d='<div class="post '+c+' post-hidden" id="'+e+'"><table cellspacing="0" cellpadding="0"><tr><td class="username"><a href="http://twitter.com/'+a+'" target="_blank"><img width="48" height="48" src="'+b+'" alt="'+a+'" /></a></td><td class="status-body"><p><a class="the-username" href="http://twitter.com/'+a+'" target="_blank">'+a+'</a> <span class="the-message">'+d+"</span></p></td></tr></table></div>";return d}function addQueueItem(){if($("#updates").queue("fx").length==0){$("#updates").queue(function(){})}$("#updates").queue(function(){var b=tweetQueue.first;add(b.id,b.user,b.avatar,b.text,b.type);var a=$("#"+b.id);animate(a);cleanup();tweetQueue.remove(b);$(".post:gt(25)",$("#updates")).fadeOut("slow",function(){$(this).remove()})})}function uid(){var a=new Date;return a.getTime()}function timelineMouseover(d){var b=$(d.target);var a=d.target.tagName.toLowerCase();if(b.parents("div").hasClass("post")){var c=b.parents("div").filter(".post");$("#updates").unbind("mouseover");pauseQueue();c.addClass("highlight").mouseleave(function(){$("#updates").mouseover(function(f){timelineMouseover(f)});restartQueue();$(this).unbind("mouseleave").removeClass("highlight")})}}function addToQueue(c,a){var b=a||rollingids;b.pop();b.unshift(c)};