function LinkedList(){}LinkedList.prototype={length:0,first:null,last:null};LinkedList.Circular=function(){};LinkedList.Circular.prototype=new LinkedList();function TrieNode(){}TrieNode=function(){this.wordCount=0;this.prefixCount=0;this.children=[]};var prefs={data:{},data2:{},load:function(){var l;if(!$.localStorage.supported||!$.localStorage.getItem("useStorage")||window.location.host.indexOf("svn.")==0){try{l=JSON.parse(unescape($.cookie("twitterfall")));if(l){this.data=l}}catch(h){var i="twitterfall",g=i+"=",k=document.cookie.split(""),j,c;for(c=0;c<k.length;c+=1){j=k[c];while(j.charAt(0)==" "){j=j.substring(1,j.length)}if(j.indexOf(g)==0){try{this.data=JSON.parse(unescape(j.substring(g.length,j.length)));return this.data}catch(h){}}}return null}try{l=JSON.parse(unescape($.cookie("twitterfall2")));if(l){this.data2=l}}catch(h){}}else{this.data=$.localStorage.getItem("data");this.data2=$.localStorage.getItem("data2")}},save:function(){if(!$.localStorage.supported){this.saveCookie()}else{this.saveStorage();if(window.location.host.indexOf("svn.")==0){this.saveCookie()}}},saveCookie:function(){var a=new Date(2010,12,31);$.cookie("twitterfall",escape(JSON.stringify(this.data)),{expires:a,path:"/",domain:"twitterfall.com"});$.cookie("twitterfall2",escape(JSON.stringify(this.data2)),{expires:a,path:"/",domain:"twitterfall.com"})},saveStorage:function(){$.localStorage.setItem("useStorage",true);$.localStorage.setItem("data",this.data);$.localStorage.setItem("data2",this.data2)},lastId:false,loadLast:function(){if($.localStorage.getItem("lastId")){this.lastId=$.localStorage.getItem("lastId")}},saveLast:function(){if(!trends&&$.localStorage.supported){$.localStorage.setItem("lastId",this.thislastId)}}},colours={colourarray:new Array("#42166c","#1F3547","#280A5A","#322337","#864C19","#492505","#621848","#301E1B","#36332C","#353343","#3B3524","#8A4135","#555555","#444444","#79485C","#154D7C"),colourcounter:0,defaultcustomcolor:function(){return this.colourarray[7]},getMeAColor:function(){this.colourcounter+=1;if(this.colourcounter==this.colourarray.length){this.colourcounter=0}return this.colourarray[this.colourcounter]}},lastId={lastTimeline:0,lastMentions:0,lastDirctMsg:0,lastSearchArray:{},lastListArray:{}},blurcounters={ihazfocus:true,numbersinceblur:0,trendssinceblur:0,customsinceblur:0,listssinceblur:0,mentionssinceblur:0,timelinesinceblur:0,tipssinceblur:0,resetCounters:function(){window.document.title="Twitterfall";this.numbersinceblur=0;this.trendssinceblur=0;this.mentionssinceblur=0;this.timelinesinceblur=0;this.customsinceblur=0;this.listssinceblur=0;this.tipssinceblur=0;this.ihazfocus=true},createTitle:function(){var a="Twitterfall ("+this.numbersinceblur+") - ";if(this.trendssinceblur){a+="Trends: ("+this.trendssinceblur+")  "}if(this.customsinceblur){a+="Searches: ("+this.customsinceblur+")  "}if(this.listssinceblur){a+="Lists: ("+this.listssinceblur+")  "}if(this.timelinesinceblur){a+="Timeline: ("+this.timelinesinceblur+")  "}if(this.mentionssinceblur){a+="Mentions: ("+this.mentionssinceblur+")  "}if(this.tipssinceblur){a+="Tips: ("+this.tipssinceblur+")"}document.title=a}},startobject={errortimer:0,activitytimer:0,p:false,errorIntervalCreate:function(){startobject.p=$("#popuploading");startobject.p.data("doing","loading");this.errortimer=setInterval(this.errorCheck,15000)},setWelcome:function(){this.p.css("padding-bottom","").addClass("textNow").data("doing","welcoming");this.activityIntervalCreate()},activityIntervalCreate:function(){this.activitytimer=setInterval(this.activityCheck,500);clearInterval(this.errortimer)},activityCheck:function(){if($("#timeline_body > div").length>0){clearInterval(this.activitytimer);startobject.p.fadeOut("slow",function(){$(this).remove()})}},errorCheck:function(){if(startobject.p.data("doing")=="loading"){setErrorAndTimeOut("There appears to have been a problem. Refreshing the page may fix it.");clearInterval(this.errortimer)}else{clearInterval(this.errortimer)}}},speedController={customtimerinterval:15,customtimerminimum:15,searchessincelift:10,shrinkAndContinue:function(){if(this.customtimerinterval>this.customtimerminimum){this.searchessincelift-=1;if(this.searchessincelift==0){this.customtimerinterval-=1;this.refreshCustomTimer();this.searchessincelift=10}}},growAndContinue:function(){if(this.customtimerinterval>25){setErrorAndTimeOut("We've had to scale your custom searches back quite considerably to stop you from being rate limited. Please consider merging searches or removing unnecessary searches.")}this.customtimerinterval+=1;this.refreshCustomTimer()},refreshCustomTimer:function(){timerBlock.customTimer=0;timerBlock.customTimer=this.customtimerinterval*1000}},geolocation={active:false,location:false,map:false,geocoder:false,dataonpage:false,init:function(){try{this.map=new google.maps.Map2(document.getElementById("map_canvas"),{size:new GSize(200,200)});this.geocoder=new google.maps.ClientGeocoder();this.dataonpage=$("#custom-geodata");this.dataonpage.data("value","-geodata");this.dataonpage.data("colour",colours.defaultcustomcolor());this.dataonpage.data("id",0)}catch(a){$("#geoPanel > .contents").text("Google Maps failed to load :(")}},setAddress:function(a,b){this.geocoder.getLocations(a,function(f){if(!f||f.Status.code!=200){setErrorAndTimeOut('"'+a+'" not found')}else{geolocation.map.clearOverlays();$("#geolocform").find("button").text("Disable");$("#map_canvas").fadeIn();var e=f.Placemark[0],c=new google.maps.LatLng(e.Point.coordinates[1],e.Point.coordinates[0]),d;geolocation.map.setCenter(c,5);d=new google.maps.Marker(c);geolocation.map.addOverlay(d);geolocation.location={lat:e.Point.coordinates[1],lon:e.Point.coordinates[0],distance:$("#distance").val(),unit:$("#unit").val()};geolocation.active=true;b()}})},clearAddress:function(a){this.active=false;$("#map_canvas").fadeOut(function(){geolocation.map.clearOverlays();geolocation.location=false;$("#location").val("");delete prefs.data.geoloc;prefs.save();a()})},getURL:function(a){if(this.active!=false){return a+"geocode="+this.location.lat+","+this.location.lon+","+this.location.distance+this.location.unit}else{return""}}},timerBlock={counter:0,timelineTimer:0,dmTimer:0,queueTimer:0,mentionsTimer:0,customTimer:0,listsTimer:120000,pauseTimer:0,testThem:function(){timerBlock.counter+=1;var a=timerBlock.counter*250;if(((a%timerBlock.queueTimer)==0)&&(a/timerBlock.queueTimer)){processQueue()}if(((a%timerBlock.customTimer)==0)&&(a/timerBlock.customTimer)){processCustom()}if(((a%timerBlock.listsTimer)==0)&&(a/timerBlock.listsTimer)){processList();logElement.append("Lists<br />")}if(((a%timerBlock.timelineTimer)==0)&&(a/timerBlock.timelineTimer)){doAPICall("gettimeline");logElement.append("Timeline<br />")}if(((a%timerBlock.dmTimer)==0)&&(a/timerBlock.dmTimer)){doAPICall("getdm");logElement.append("DMs<br />")}if(((a%timerBlock.mentionsTimer)==0)&&(a/timerBlock.mentionsTimer)){doAPICall("getmentions");logElement.append("Mentions<br />")}}},rollingids=new Array(200),constructarray=new Array(),stringexclusions=new TrieNode(),fromexclusions=new TrieNode(),serviceexclusions=new TrieNode(),superTimer=0,queuestatus=0,trends=true,retweets=true,mapcounts=0,customcounter=1,listcounter=1,tweetssincetip=0,language="any",logElement=0,tweetQueue=new LinkedList.Circular(),animations={fall:function(a){a.css("margin-bottom",0-a.height()).css("top",-170).animate({top:"0px",marginBottom:"0px"},"slow")},fade:function(a){a.addClass("dontshowme").fadeIn("slow",function(){$(this).removeClass("dontshowme")})},none:function(a){},set:false},safariorie=$.browser.msie||$.browser.webkit;animations.set=animations.fall;constructarray[0]='<div id="';constructarray[2]='" class="post ';constructarray[4]='">';constructarray[5]='<table cellspacing="0" cellpadding="0"><tr><td class="username"><a href="http://twitter.com/';constructarray[7]='" target="_blank"><img class="userimage" width="48" height="48" src="';constructarray[9]='" alt="';constructarray[11]='" /></a></td><td class="status-body"><div class="postinner">';constructarray[12]="";constructarray[13]='<div class="removethis">Remove</div>';constructarray[14]='<div class="time">';constructarray[16]='</div><p><a class="the-username" href="http://twitter.com/';constructarray[18]='" target="_blank">';constructarray[20]="</a>";constructarray[22]=' <span class="the-message">';constructarray[24]='</span></p></div></td><td class="createMenu"><div class="chevronCell"></div><div class="radialMenu"><img src="overlay.gif" width="100" height="187" usemap="#radialmenumap';constructarray[26]='"><map id="radialmenumap';constructarray[28]='" name="radialmenumap';constructarray[30]='"><area shape="poly" coords="14,112,11,121,59,169,77,146" class="reportthis" alt="Report"><area shape="poly" coords="15,104,15,111,78,143,87,117" class="retweet" alt="Retweet"><area shape="poly" coords="14,96,14,102,87,104,88,84" class="reply" alt="Reply"><area shape="poly" coords="14,93,86,80,78,54,14,87" class="favtweet" alt="Favourite"><area shape="poly" coords="4,77,10,78,57,27,34,11" class="dm" alt="DM"><area shape="poly" coords="14,78,15,83,75,52,59,30" class="follow" alt="Follow"><area shape="poly" coords="10,121,57,171,35,188,3,122" class="viewtweet" href="http://twitter.com/';constructarray[32]="/statuses/";constructarray[34]='" target="_blank" alt="View"><!--<area shape="poly" coords="2,122,34,188,1,187,1,122" class="trans" alt="Translate">--></map></td></tr></table><div class="conversation"></div><div class="retweetsbox"></div><div class="replybox"><form><table><tr><td><div class="count">140</div><span class="box-header"></span><a class="shorten-box">Shorten URLs</a></td></tr><tr><td><textarea class="message" cols="80"></textarea></td><td class="button"><button class="replysubmit" type="button">Send</button><br /><button type="reset" class="cancelbutton">Cancel</button></td></tr></table></form></div></div>';prefs.load();$(document).ready(function(){logElement=$("#loghere");$("#popuploading p.initial").html("Loading Trends&hellip;");if($.browser.mozilla){$("div.NSPanel").addClass("firefox")}else{if($.browser.opera){$("div.NSPanel").addClass("opera")}}logElement.append("Started<br />");function a(d){$("#updates").removeClass();if(d>1500){$("#updates").addClass("supersize")}else{if(d>1150){$("#updates").addClass("larger")}}}a($(document).width());$(window).unload(function(){prefs.saveLast()});$(window).resize(function(){if(!($("#updates").hasClass("fullwidth"))){a($(document).width())}});startobject.errorIntervalCreate();$([window,document]).bind("focus",function(){blurcounters.resetCounters()}).bind("blur",function(){blurcounters.ihazfocus=false});if(location.href!=top.location.href){top.location.href=location.href}prefs.data.trends=new Array();$("#settings > select").each(function(){var d=$(this).attr("id"),e=$(this).val();prefs.data[d]=e});prefs.data.oauth_request_token=prefs.data.oauth_request_token_secret=prefs.data.oauth_access_token=prefs.data.oauth_access_token_secret="";prefs.data.timeline=prefs.data.dm=prefs.data.mentions="";Meteor.hostid=(new Date).getTime();Meteor.host="data"+[3,3,3,4,4,4,2][Math.floor(Math.random()*6)]+".twitterfall.com";Meteor.registerEventCallback("process",trendTweets);Meteor.joinChannel("control");Meteor.joinChannel("twf-trends",1);Meteor.mode="stream";Meteor.connect();geolocation.init();$("#timeline_body").click(function(h){var k=$(h.target),n=h.target.tagName.toLowerCase(),j,m,f,i,d,g;if(n=="area"){switch(k.attr("class")){case"reply":l(k,"Reply");break;case"follow":if(prefs.data.oauth_access_token==""){notLoggedIn()}else{g=k.parents("tr").find("td.status-body").find("a.the-username").text();j=confirm("Do you want to follow "+g+"?");if(j){doTwitter("follow",{user:g})}}break;case"trans":m=k.parents("div.post");f=m.find("span.the-message").text();setBarAndShow("Translating&hellip;",true);if(language=="any"){i="en"}else{i=language}google.language.translate(f,"",i,function(e){if(!e.error){setBarAndShow(e.translation,true)}else{setBarAndShow("There was a problem translating this text.",false)}});break;case"retweet":l(k,"Retweet");break;case"dm":l(k,"Direct Message to "+k.parents("tr").find("td.status-body").find("a.the-username").text());break;case"favtweet":if(prefs.data.oauth_access_token==""){notLoggedIn()}else{d=k.parents("div.post").attr("id");doTwitter("favourite",{id:d})}break}}function l(q,p){var t=q.parents("div.post"),o=t.find("td.status-body"),e=t.find("div.replybox"),s=e.find("textarea.message"),v=e.find("span.box-header"),r,u;if(e.hasClass("replybox-active")){if(v.text()!=p+":"){e.slideUp(function(){v.text("");e.find("textarea.message").val("").unbind("keydown");q.click()}).removeClass("replybox-active")}else{queuestatus=0;e.slideUp(function(){v.text("");e.find("textarea.message").val("").unbind("keydown")}).removeClass("replybox-active")}}else{$("div.replybox-active",$("#timeline_body")).slideUp().removeClass("replybox-active");pauseQueue();queuestatus=3;g=o.find("a.the-username").text();v.text(p+":");r=e.find("textarea.message");r.bind("keydown",function(w){if((w.keyCode=="13")&&(w.shiftKey)){w.preventDefault();$(this).unbind("keydown");e.find("button.replysubmit").click()}});if(q.hasClass("reply")){r.val("@"+g+" ");e.find("div.count").text(137-g.length)}else{if(q.hasClass("retweet")){u=t.data("original")||t.find("span.the-message").text();u=t.data("retweet")?u:"RT @"+g+": "+u;r.val(u).one("keyup",function(){$(this).parents("div.replybox").data("unmodifiedretweet",0)});e.find("div.count").text("");e.data("unmodifiedretweet",1)}else{if(q.hasClass("dm")){u="";r.val("");e.find("div.count").text(140)}}}e.slideDown().addClass("replybox-active");s.focus()}}});$("#timeline_body").mouseover(function(h){if(!$(this).hasClass("hoveredTimeline")){var d=$(h.target),g=d.parents("div.post"),f;if(g.data("time")){f=$.timeago(g.data("time"))}else{f=""}if(g.length!=0){$("#timeline_body").addClass("hoveredTimeline");pauseQueue();g.find("div.time").html(f).end().addClass("highlight").mouseleave(function(){$("#timeline_body").removeClass("hoveredTimeline");restartQueue();$(this).unbind("mouseleave").removeClass("highlight")})}}});$("#trendlist > table.trend").live("click",function(){if($(this).hasClass("active")){leave($(this).text(),"normal");makeInactive($(this));redoSaveLink();$(this).mouseenter(function(){$(this).addClass("hovering")}).mouseleave(function(){$(this).removeClass("hovering")})}else{var d=$("#trendlist > table.trend:first");if(d.hasClass("active")){leave("All Terms","normal");makeInactive(d)}join($(this).text(),"normal");makeActive($(this));redoSaveLink()}});$("img.infoicon").live("click",function(){$("#trendinfo").slideUp("normal");if(!($(this).hasClass("alreadydown"))){var d=$(this).parents("table.trend").text();$(this).addClass("alreadydown");$("#trendPanel div.header").addClass("loading");$.getJSON("http://www.whatthetrend.com/api/trend/getByName/"+d.replace("#","%23")+"/jsonp/callback=?",function(e){$("#trendinfo").html("<p id='blurbtext'>"+e.api.trend.blurb.text+"</p><a href='http://whatthetrend.com/trend/"+d.replace("#","%23").replace(" ","+")+"' target='_blank'>Source</a><br /><a id='hideblurb'>Hide Blurb</a>").slideDown("normal");$("#trendPanel div.header").removeClass("loading")})}else{$(this).removeClass("alreadydown")}return false});$("#hideblurb").live("click",function(){$("img.infoicon.alreadydown").removeClass("alreadydown");$("#trendinfo").slideUp("normal",function(){$("#trendinfo").empty()})});$("td.searchname, table.customsearch :checkbox",$("#customSearchPanel")).live("click",function(){var e=$(this).parents("table"),d;if(e.hasClass("active")){leave(e.find("td.searchname").text(),"custom");makeInactive(e);redoSaveLink()}else{d=$("table.customsearch:first",$("#customSearchPanel"));if(d.hasClass("active")){leave("All Searches","custom");makeInactive(d)}join(e.find("td.searchname").text(),"custom");makeActive(e);redoSaveLink()}});$("td.listname, table.aList :checkbox",$("#listPanel")).live("click",function(){var e=$(this).parents("table"),d;if(e.hasClass("active")){leave(e.find("td.listname").text(),"list");makeInactive(e);redoSaveLink()}else{d=$("table.aList:first",$("#listPanel"));if(d.hasClass("active")){leave("All Lists","list");makeInactive(d)}join(e.find("td.listname").text(),"list");makeActive(e);redoSaveLink()}});$("#center").mouseenter(function(){pauseQueue()}).mouseleave(function(){restartQueue()});$("#speed").change(function(){pauseQueue();restartQueue()});$("#customform").submit(function(){if($("#customsearch").val()!=""){addCustomSearchToList($("#customsearch").val());$("#customsearch").val("");redoSaveLink();processCustom()}return false});$("#listform").submit(function(){if($("#listadd").val()!=""){if(addListoList($("#listadd").val())){$("#listadd").val("");redoSaveLink()}}return false});$("img.remove",$("#customlist")).live("click",function(){var d=$(this).parents("table.customsearch");leave(d.find("td.searchname").text(),"custom");d.remove();redoSaveLink();return false});$("img.remove",$("#listlist")).live("click",function(){var d=$(this).parents("table.aList");leave(d.find("td.listname").text(),"list");d.remove();redoSaveLink();return false});$("#excludeform").submit(function(){var d=$("#excludeterm").val().stripScripts().stripTags();if(d!=""){addToExclusions(d,true);reQueue();$("#excludeterm").val("");redoSaveLink()}return false});$("img.remove",$("#excludelist")).live("click",function(){$(this).parents("tr.excluderow").remove();fromexclusions=new TrieNode();serviceexclusions=new TrieNode();stringexclusions=new TrieNode();$("#excludelist").find("tr.excluderow").each(function(){addToExclusions($(this).find("td.excludetext").text(),false)});redoSaveLink()});$("#presentationtext").dblclick(function(){var f=$(this).text(),e,g,d;$(this).html('<input id="bigtextedit" type="text" style="width: 80%; font-size: 1.2em;" length="20" value="'+f+'" />');e=$(this).find("#bigtextedit");e.focus();$(e).keypress(function(h){if(h.keyCode==13){g=$("#bigtextedit").val().stripScripts().stripTags();if(g.indexOf("http://")==0){$("#presentationtext").empty();d=new Image();$(d).load(function(){$("#presentationtext").append($(d));$("#updates").css("padding-top",($("#presentationimage").height()+10)+"px")}).attr("src",g).attr("id","presentationimage")}else{$("#presentationtext").empty().text(g);$("#updates").css("padding-top","")}}}).blur(function(){$("#presentationtext").empty().text(f)})});$("img.edit",$("#customlist")).live("click",function(){var f=$(this).parents("table.customsearch"),e=f.find("div.hidingdiv"),g=e.text(),d,h;e.html('<input id="searchfieldedit" type="text" style="width: 105px;" length="140" value="'+g+'" />').css("overflow-x","visible");d=f.find("#searchfieldedit");d.focus();$(d).keypress(function(i){if(i.keyCode==13){h=$("#searchfieldedit").val();e.text(h).css("overflow-x","hidden");processCustom();redoSaveLink()}}).blur(function(){e.text(g).css("overflow-x","hidden")})});$("a.popupOpen").click(function(){var d=$(this).attr("id").match(/popup(.+?)Open/);if($("#popup"+d[1]+" > p").length<1){$.get("popup"+d[1]+".html",function(e){$("#popup"+d[1]).prepend(e)},"html")}pauseQueue();$("#backgroundPopup, #popup"+d[1]).fadeIn();$(document).keypress(function(f){if(f.keyCode==27&&popupStatus){c();$(document).unbind("keypress")}})});$("a.popupClose, #backgroundPopup").click(function(){c();$(document).unbind("keypress")});function c(){restartQueue();$("#backgroundPopup, div.popup").fadeOut()}$("#popupWidgetsOpen").click(function(){$("#widgetlink").html('<img src="/Twitterfall.wdgt.png" alt="Twitterfall Dashboard Widgets" />');$("#gadgetlink").html('<img src="/Twitterfall.gadget.png" alt="Twitterfall Desktop Gadget" />')});$("#hashtagsToAdd > input").blur(function(){var e=$("#hashtagsToAdd > input").val(),d=$("textarea.newMessage",$("#newTweetBottom")).val();if(d.length>0){e=" "+e}$("textarea.newMessage",$("#newTweetBottom")).val(d+e);$("div.newTweetCount",$("#newTweetBottom")).text(140-d.length-e.length)});$("#hidepanels").click(function(){hidePanels(false)});$("button.replysubmit").live("click",function(){if(prefs.data.oauth_access_token==""){notLoggedIn()}else{var f=$(this).parents("div.post"),i=f.find("textarea.message").val(),g=$(this).parents("div.replybox"),h=g.find("span.box-header"),d=f.find("td.status-body").find("a.the-username").text(),e,j;if(h.text()=="Reply:"){e=f.attr("id");doTwitter("sendreply",{status_text:i,status_id:e},function(){g.slideUp().removeClass("replybox-active")});return false}else{if(h.text()=="Direct Message to "+d+":"){setBarAndShow("Checking Follow Status&hellip;",true);$.ajax({type:"POST",url:"post.php",data:"f=candm&findname="+d+"&oauth_access_token="+prefs.data.oauth_access_token+"&oauth_access_token_secret="+prefs.data.oauth_access_token_secret,success:function(k){if(k==="true"){doTwitter("dupdate",{status_text:"d "+d+" "+i},function(){g.slideUp().removeClass("replybox-active")})}else{setBarAndShow("This user does not currently follow you, therefore you cannot Direct Message this user",false);g.slideUp().removeClass("replybox-active");queuestatus=0;restartQueue()}},dataType:"text"})}else{if(h.text()=="Retweet:"){if(g.data("unmodifiedretweet")==1){g.data("unmodifiedretweet",0);j=f.attr("id");doTwitter("retweet",{id:j},function(){g.slideUp().removeClass("replybox-active")})}else{doTwitter("update",{status_text:i},function(){g.slideUp().removeClass("replybox-active")})}return false}else{setErrorAndTimeOut("Unrecognised operation. Sending tweet anyway");doTwitter("update",{status_text:i},function(){g.slideUp().removeClass("replybox-active")});return false}}}}return false});$("button.cancelbutton").live("click",function(){$("div.replybox").slideUp().removeClass("replybox-active").find("textarea.message").unbind("keydown");queuestatus=0});$("#tweetthis").click(function(){if(prefs.data.oauth_access_token==""){window.open("http://twitter.com/?status=I'm checking out realtime tweets of popular trends on http://twitterfall.com!")}else{doTwitter("update",{status_text:"I'm checking out realtime tweets of popular trends on http://twitterfall.com"})}});$("textarea.message").live("keyup",function(){var d=$(this);d.parents("div.replybox").find("div.count").text(140-d.val().length)});$("textarea.newMessage").keyup(function(){var d=$(this).parents("div");$("div.newTweetCount",d).text(140-$(this).val().length)}).keydown(function(d){if((d.keyCode=="13")&&(d.shiftKey)){d.preventDefault();$("form",$(this).parents("div")).submit()}});$("#newTweet > form, #newTweetBottom > form").submit(function(){var d=$(this).parents("div"),e;if($("textarea.newMessage",d).val().indexOf("twitterfall-log")>-1){$("#logpanel").removeClass("dontshowme");$("#newTweet").animate({top:"-180px"},"slow",function(){$("textarea.newMessage",$("#newTweet")).val("");$("div.newTweetCount",$("#newTweet")).text(140)});return false}if(prefs.data.oauth_access_token==""){notLoggedIn()}else{e=$("textarea.newMessage",d).val();if(e!=""){doTwitter("update",{status_text:e},function(){if(d.attr("id")=="newTweet"){$("#newTweet").animate({top:"-180px"},"slow",function(){$("textarea.newMessage",$("#newTweet")).val("");$("div.newTweetCount",$("#newTweet")).text(140)})}else{var f=$("#hashtagsToAdd > input").val();$("textarea.newMessage",$("#newTweetBottom")).val(f);$("div.newTweetCount",$("#newTweetBottom")).text(140-f.length)}})}}return false});$("#myLocation").click(function(){if(geo_position_js.init()){setBarAndShow("Locating&hellip;",true);geo_position_js.getCurrentPosition(e,d,{enableHighAccuracy:true})}else{setErrorAndTimeOut("Sorry, your browser does not support geolocation services.")}function e(f){geolocation.currentLocation={};geolocation.currentLocation.set=true;geolocation.currentLocation.lat=f.coords.latitude.toFixed(1);geolocation.currentLocation.lon=f.coords.longitude.toFixed(1);$("#myLocation").text("Update Location");$("#clearLocation").fadeIn();setBarAndShow("Your location has been found and saved.",false,1500)}function d(f){setBarAndShow("Sorry, your browser can't work out where you are.",false,1500)}});$("#clearLocation").click(function(){geolocation.currentLocation={};$("#clearLocation").fadeOut();$("#myLocation").text("Add Location")});$("#emptyqueue").click(function(){d(function(){$("#timeline_body").children(":gt("+prefs.data.size+")").remove()});function d(k){var f=tweetQueue.length;if(f==0){return false}var h=0,e=tweetQueue.last,g=$("#size").val(),j=$("#timeline_body");while(h<g){if(e.prev===tweetQueue.last){break}e=e.prev;h+=1}e.prev=tweetQueue.last;tweetQueue.first=e;tweetQueue.length=h+1;reQueue();animations.set=animations.none;setTimeout(function(){if(j.queue("fx").length>25){for(var l=0;l<25;l+=1){processQueue()}setTimeout(arguments.callee,10)}else{$("#timeline_body").children().removeClass("dontshowme");while(j.queue("fx").length>1){processQueue()}$("#timeline_body").children().fadeIn("slow",function(){$(this).removeClass("dontshowme")});animations.set=animations.fall;k()}},50)}});$("#closepresent").click(function(){$("#updates").css("padding-top","");$("#exitpresentation, #presentationtext, #poweredbylink").addClass("dontshowme");$("#center").removeClass("dontshowme");hidePanels(true);$("#timeline_body").removeClass("epictext")});$("#presentmode").click(function(){hidePanels(true);$("#updates").addClass("fullwidth");$("#timeline_body").addClass("epictext");$("#center").addClass("dontshowme");$("#exitpresentation, #presentationtext, #poweredbylink").removeClass("dontshowme");if($("#presentationimage").length==1){$("#updates").css("padding-top",($("#presentationimage").height()+10)+"px")}});$("#fullwidthmode").click(function(){hidePanels(true);$("#updates").addClass("fullwidth")});$("#textsize").change(function(){$("#timeline_body").removeClass().addClass($(this).val())});$("#geolocform > form").submit(function(){var d=$(this).find("button");if(d.text()=="Enable"){geolocation.setAddress($("#location").val(),function(){d.text("Disable");redoSaveLink();speedController.refreshCustomTimer();processCustom()})}else{geolocation.clearAddress(function(){d.text("Enable");redoSaveLink()})}return false});$("#location").focus(function(){if($(this).val()=="Search Location"){$(this).val("")}}).keyup(function(){$("#geolocform").find("button").text("Enable")}).blur(function(){if($(this).val()==""){$(this).val("Search Location")}});$("#distance, #unit").change(function(){$("#geolocform").find("button").text("Enable")});$("img.geoImage").live("click",function(f){var d=$(this).attr("alt").split(" ");if($("#the-location").hasClass("showme")){queuestatus=0;$("#the-location").removeClass("showme").fadeOut(function(){$("#locationMap").empty()})}else{queuestatus=3;$("#the-location").addClass("showme").css({left:(f.pageX+15)+"px",top:(f.pageY+15)+"px"}).fadeIn(function(){var e=new GMap2(document.getElementById("locationMap"));e.setCenter(new GLatLng(d[0],d[1]),12);e.addOverlay(new GMarker(new GLatLng(d[0],d[1])));e.addControl(new GSmallMapControl())})}});$("#locationClose").click(function(){$("img.geoImage:eq(0)").click()});$("div.header").click(function(){if($(this).hasClass("open")){$(this).addClass("closed").removeClass("open");$(this).siblings("div.contents").slideUp().removeClass("open").addClass("closed")}else{$(this).addClass("open").removeClass("closed");$(this).siblings("div.contents").slideDown().addClass("open").removeClass("closed")}if(!trends){redoSaveLink()}return false});$("#newTweetLink").click(function(){queuestatus=3;$("div.newTweetCount",$("#newTweet")).text(140);$("#newTweet").animate({top:"0px"},"slow");$("#newTweet textarea.newMessage").focus()});$("#newTweetClose").click(function(){queuestatus=0;restartQueue();$("#newTweet").animate({top:"-180px"},"slow")});$("#newTweetBottomClose").click(function(){$("#hashtagsToAdd > input").val("");$("#newTweetBottom").animate({bottom:"-155px"},"slow")});$("#makeNewTweetBottom").click(function(){$("div.newTweetCount",$("#newTweetBottom")).text(140);$("#newTweetClose").click();$("#newTweetBottom").css("display","block").animate({bottom:"0px"},"slow")});$("#toggleQueue").click(function(){if($(this).text()=="Pause Tweets"){$(this).text("Resume Tweets");queuestatus=3}else{$(this).text("Pause Tweets");queuestatus=0}});$("a.hashtag").live("click",function(){var f=$(this).text(),e=$("#trendlist > table.trend").filter(function(){return $(this).text().toLowerCase()==f.toLowerCase()}),d=$("td.searchname").filter(function(){return $(this).text().toLowerCase()==f.toLowerCase()});if(e.length==1){join(e.text(),"normal");makeActive(e)}else{if(d.length==1){}else{addCustomSearchToList(f)}}});$("area").live("mouseover",function(){var f=$(this).parents(".radialMenu"),d={dm:0,follow:1,favtweet:2,reply:3,retweet:4,reportthis:5,viewtweet:6,trans:7},e=-106-(98*d[$(this).attr("class")]);if(!$.browser.mozilla){f.css("background-position-x",e+"px")}else{e+=8;f.css("background-position",e+"px 0")}}).live("mouseout",function(){if(!$.browser.mozilla){$(this).parents(".radialMenu").css("background-position-x","-8px")}else{$(this).parents(".radialMenu").css("background-position","0 0")}});$("div.post td.createMenu").live("mouseover",function(){var g=$(this).children(".chevronCell").position(),f=$(this).children(".radialMenu"),e,d;if($("#center").hasClass("firefox")||$("#center").hasClass("opera")){e=g.top-69;d=$(this).parents("div.post").width()-18}else{e=g.top-78;d=$(this).parents("div.post").width()-12}f.addClass("showme").css("top",e).css("left",d)}).live("mouseout",function(){$(this).children(".radialMenu").removeClass("showme")});$("a.twitpic",$("#timeline_body")).live("mouseover",function(){$("#twitpic").empty().css({width:"42px",height:"42px"}).show();function e(g){$("#twitpic").data("val",g);var h=new Image();$(h).load(function(){$("#twitpic").css({width:"auto",height:"auto"});if($("#twitpic").html()==""){if($("#twitpic").data("val")==g){$("#twitpic").append($(h))}}}).attr("src",g)}var f=this.href,d;if(f.match(/flic\.kr/)){d=f.replace("http://flic.kr/p/","");$.ajax({url:"post.php",data:{f:"getflickr",code:d},success:function(g){e(g)},type:"POST",error:function(){setErrorAndTimeOut("There was a problem with your request. Please try again. If you keep getting this message, contact @twfall",10000)}})}else{f=f.replace("http://tweetphoto.com/","http://tweetphotoapi.com/api/TPAPI.svc/imagefromurl?size=thumbnail&url=http://tweetphoto.com/");f=f.replace("http://pic.gd/","http://tweetphotoapi.com/api/TPAPI.svc/imagefromurl?size=thumbnail&url=http://pic.gd/");f=f.replace("twitgoo.com/","twitgoo.com/show/thumb/");f=f.replace("twitpic.com/","twitpic.com/show/thumb/");f=f.replace("mobypicture.com","api.mobypicture.com?t=http://mobypicture.com");f=f.replace("moby.to/","api.mobypicture.com?t=http://moby.to/");if(f.match(/mobypicture\.com/)){f=f+"&s=small&k=tw1tt3rfa11x5315&format=plain"}if(f.match(/yfrog\.com/)){f=f+".th.jpg"}e(f)}$(this).mousemove(function(g){$("#twitpic").css({left:(g.pageX+5)+"px",top:(g.pageY+5)+"px"})})}).live("mouseout",function(){$("#twitpic").hide().empty();$(this).unbind("mousemove")});$("a.the-username, a.twitter-link",$("#timeline_body")).live("mouseover",function(h){var i=$(this).attr("href").match(/twitter\.com\/(.*)$/),f=$("#updates").hasClass("fullwidth")||true,g,d;if(f){$("#the-username").html('<img style="width: 42px; height: 42px;" src="throbber.gif" alt="Loading" />').data("val",i).css({left:(h.pageX+5)+"px",top:(h.pageY+5)+"px"}).show()}else{g=$(this).parents("div.post");d=g.offset();$('<div class="usernameBlock"><img src="throbber.gif" alt="Loading" /></div>').css({left:d.left,top:d.top,height:g.height()-20}).attr("id","ub"+g.attr("id")).appendTo("body").animate({left:"-=201"},"swing")}$.getJSON("http://api.twitter.com/1/users/show/"+i[1]+".json?callback=?",function(j){var e='<table><tr><th colspan="2">';e+=i[1];e+="</th></tr><tr><td>Name</td><td>";e+=j.name;if(j.location!=""){e+="</td></tr><tr><td>Location</td><td>";e+=j.location}e+="</td></tr><tr><td>Followers</td><td>";e+=j.followers_count;e+="</td></tr><tr><td>Following</td><td>";e+=j.friends_count;e+="</td></tr><tr><td>Updates</td><td>";e+=j.statuses_count;e+="</td></tr></table>";if(f){$("#the-username").html(e)}else{$("#ub"+g.attr("id")).html(e).css("height","auto").children("table").fadeIn()}})}).live("mouseout",function(){$("#the-username").hide().empty();$("div.usernameBlock").animate({left:"+=182"},"swing",function(){$(this).remove()})});$("a.list-link",$("#timeline_body")).live("click",function(){addListoList($(this).text());return false});$("#clearPage").click(function(){$("#timeline_body > div.post").fadeOut(function(){$(this).remove()});rollingids=new Array(200)});$("#language").change(function(){if($(this).val()!="any"){$("#timeline_body").queue("fx",[]);updateQueueCount()}language=$(this).val()});$("a.shorturl",$("td.status-body")).live("mouseover",function(){var d=$(this).parents("div.post"),e=$(this),f=$(this).text();if(!d.data("original")){d.data("original",d.find("span.the-message").text())}$(this).addClass("linkworking").removeClass("shorturl");$.ajax({type:"POST",url:"post.php",data:{f:"geturl",tinyurl:f},success:function(g){if(g.length>65){e.text(g.substring(0,65)+"...")}else{if(g.length==0){e.text($(this).text())}else{e.text(g)}}e.removeClass("linkworking")},error:function(){setErrorAndTimeOut("There was a problem with your request. Please try again. If you keep getting this message, contact @twfall",10000)},dataType:"text"})});$("#forget").click(function(){$.cookie("twitterfall",{},{path:"/",domain:"twitterfall.com"});$.cookie("twitterfall2",{},{path:"/",domain:"twitterfall.com"});$.localStorage.clear();document.location="/"});$("area.reportthis").live("click",function(){if(confirm("You are about to report this user to Twitter for spamming. Please be aware that your username is associated with this reporting.")){if(prefs.data.oauth_access_token==""){notLoggedIn()}else{var d=$(this).parents("div.post"),f=d.find("a.the-username").text(),e={f:"reportuser",friendname:f,oauth_access_token:prefs.data.oauth_access_token,oauth_access_token_secret:prefs.data.oauth_access_token_secret};$.post("post.php",e)}}return false});$("div.removethis").live("click",function(){$(this).parents("div.post").mouseleave().remove()});$("#logout").click(function(){timerBlock.timelineTimer=0;timerBlock.mentionsTimer=0;timerBlock.dmTimer=0;$("#loginwrap div#login").show();$("#loginwrap div#loggedIn").hide();$("div.login",$("#left-wrapper")).text("Login to Twitter");prefs.data.oauth_request_token=prefs.data.oauth_request_token_secret=prefs.data.oauth_access_token=prefs.data.oauth_access_token_secret="";prefs.save();loginBindings()});$("#size").change(function(){$("div.post:gt("+($(this).val()-1)+")",$("#timeline_body")).mouseleave().remove()});$("#settings > select").change(function(){var d=$(this).attr("id");prefs.data[d]=$(this).val();prefs.save()});$("#popupError, #popupReply").click(function(){$(this).fadeOut()});$("#retweets").change(function(){if($(this).val()=="yes"){retweets=true}else{retweets=false;reQueue()}});$("input.colour",$("#customlist")).live("change",function(){var d=$(this).parents("table.customsearch"),e=d.data("value");$("div.custom"+e).css("background-color",$(this).val());d.data("colour",$(this).val());redoSaveLink()});$("input.colour",$("#listlist")).live("change",function(){var d=$(this).parents("table.aList"),e=d.data("value");$("div.list"+e).css("background-color",$(this).val());d.data("colour",$(this).val());if(!trends){redoSaveLink()}});$("span.conversationshow").live("click",function(){function e(j,h,i){function f(){if(h){h.parents("div.post").find("span.conversationshow").html('<img src="user_convo.png" alt="See conversation" />');if(h.find("div.ctweet").length>0){h.append('<div class="conversationhide"><a>Hide Conversation</a></div>');h.find("div.conversationhide").slideDown()}}else{$("#"+j).find("span.conversationshow").remove()}i()}var g={f:"getreply",id:j};if(prefs.data.oauth_access_token&&prefs.data.oauth_access_token_secret){g.oauth_access_token=prefs.data.oauth_access_token;g.oauth_access_token_secret=prefs.data.oauth_access_token_secret}$.ajax({type:"POST",url:"post.php",data:g,success:function(l){if(l){if(l.error){setErrorAndTimeOut("There was a problem getting tweets in this conversation.<br /><br />Maybe one user is protected and you do not have permission to view them? Or Twitter is overloaded",10000);f()}else{if(h==false){h=$("#"+j).find("div.conversation")}var k=l.user.screen_name,m=parseText(l.text);h.append('<div class="ctweet"><div class="ccontent"><a class="the-username" href="http://twitter.com/'+k+'" target="_blank">'+k+"</a> "+m+"</div></div>");h.find("div.ctweet:last").slideDown(function(){e(l.id,h,i)})}}else{f()}},error:function(k){f()},dataType:"json"})}var d=$(this).parents("div.post").find("div.ctweet, div.conversationhide");if(d.length!=0){d.slideDown()}else{if(!$(this).hasClass("doing")){$(this).addClass("doing").html('<img src="user_convo_load.png" alt="" />');e($(this).parents("div.post").attr("id"),false,function(){$(this).removeClass("doing")})}}return false});$("div.conversationhide").live("click",function(){var d=$(this).parents("div.post");d.find("div.conversation").slideUp(function(){$(this).find("div.ctweet, div.conversationhide").hide();$(this).show();d.find("span.conversationshow").html('<img src="user_convo.png" alt="Show Conversation" />')})});$("#shortentop, #shortenbottom, a.shorten-box").live("click",function(){var e=$(this),d;e.html('<img src="throbber-shorten.gif" alt="Shortening..." />');if($(this).attr("id")=="shortenbottom"){d=$(this).parents("#newTweetBottom").find("textarea")}else{d=$(this).parents("form").find("textarea")}b(d.val(),function(f){if(f!=""){if(/http:\/\/is\.gd\/.+$/.exec(f)[0]==f){$.ajax({type:"POST",url:"post.php",data:{f:"title",message:d.val()},timeout:3000,success:function(g){if(g){f="'"+g+"' "+f}d.val(f);d.keyup();e.html("Shorten URLs")},error:function(){setErrorAndTimeOut("There was a problem with your request. Please try again. If you keep getting this message, contact @twfall",10000)}})}else{d.val(f);d.keyup();e.html("Shorten URLs")}}else{e.html("Shorten URLs")}});return false});function b(e,d,h){h=h||"";if(e==""){d(h)}else{var g=e.search(/(http[s]?\:\/\/)|(www\.[^\s])/),f;if(g==-1){b("",d,h+e.slice(0,e.length))}else{h+=e.slice(0,g);e=e.slice(g,e.length);g=e.search(/(\s|$|,|\. |\.$|\"|\)|\!|\? )/);f=e.slice(0,g);$.ajax({type:"POST",url:"post.php",data:({f:"shorten",message:f}),success:function(i){if(i.search(/^Error/)!=-1){setErrorAndTimeOut(i.slice(0,i.length-1)+": "+f);h+=f;b(e.slice(g,e.length),d,h)}else{h+=i;b(e.slice(g,e.length),d,h)}},error:function(i){setErrorAndTimeOut("There was an error shortening your URLs: "+i);d("")}})}}}loginBindings();superTimer=setInterval(timerBlock.testThem,250);restartQueue();speedController.refreshCustomTimer()});function hidePanels(c){var a=$("div.left"),e=$("div.right"),b=$("#updates"),d;if($("#hidepanels").text()=="Hide Panels"){a.animate({left:"-185px"},1000,function(){$("#hidepanels").text("Show Panels")});e.animate({right:"-185px"},1000);if(c){b.animate({width:"90%"},1000,function(){b.addClass("hidepanels").css("width","")})}}else{a.animate({left:"0px"},1000,function(){$("#hidepanels").text("Hide Panels")});e.animate({right:"0px"},1000);d="550px";if(b.hasClass("larger")){d="680px"}if(b.hasClass("supersize")){d="950px"}if(b.hasClass("fullwidth")){b.animate({width:d},1000,function(){b.removeClass("fullwidth").removeClass("hidepanels").css("width","")})}else{if(c){b.animate({width:d},1000,function(){b.removeClass("hidepanels").css("width","")})}}}}function pauseQueue(){if(queuestatus==1){timerBlock.queueTimer=0;clearInterval(timerBlock.pauseTimer);queuestatus=0;$("#queuedtweetstext").text("Paused:")}}function restartQueue(b){if(queuestatus==0){timerBlock.queueTimer=$("#speed").val();queuestatus=1;function a(){$("#queuedtweetstext").text("Queued Tweets:")}timerBlock.pauseTimer=setTimeout(a,250)}}function processQueue(){$("#timeline_body").dequeue()}function reQueue(){var d=$("#timeline_body"),c=0,a=tweetQueue.first,e=/(?:RT|via:)/,b=retweets;d.queue("fx",[]);d.queue(function(){});while(a!=null){if(!b){if(e.exec(a.text)==null){if(isExcluded(a.origtext,a.user,a.service)==false){addQueueItem()}else{tweetQueue.remove(a)}}else{tweetQueue.remove(a)}}else{if(isExcluded(a.origtext,a.user,a.service)==false){addQueueItem()}else{tweetQueue.remove(a)}}c+=1;if(c>=tweetQueue.length){updateQueueCount();return true}else{a=tweetQueue.first}}updateQueueCount()}function isExcluded(e,c,f){f=f||"";var b=e.toLowerCase(),d=c.toLowerCase(),a=f.toLowerCase();if(g(serviceexclusions,a)||g(fromexclusions,d)||g(stringexclusions,b)){return true}else{return false}function g(q,m){var p=q,o="",l=m.split(""),h=0,k,n;while(1){for(k=h;k<l.length;k+=1){n=p.hasChild(l[k]);if(n){o+=l[k];p=n;if(q.getWordCount(o)!=0){return true}}else{p=q;k=k-o.length;o=""}}if(o==""){return false}else{p=q;h=k-o.length+1;o=""}}}}function processCustom(){$("#customSearchPanel div.header").addClass("loading");if($("#customlist > table:first").hasClass("active")){$("#customlist > table:gt(0)").each(function(){a($(this))});if($("#customlist > table:gt(0)").length==0){$("#customSearchPanel div.header").removeClass("loading")}}else{$("#customlist > table.active").each(function(){a($(this))})}if(($("#customlist > table:gt(0)").length==0)&&geolocation.active!=false){a($("#custom-geodata"))}function a(d){var g=d.find("td.searchname").text(),c=lastId.lastSearchArray[g]||0,f,e,b;if(language=="any"){f=""}else{f="lang="+language+"&"}if(g){e="q="+encodeURIComponent(g)+"&"}else{e=""}if(c!=0){b="http://search.twitter.com/search.json?"+e+f+"since_id="+c+"&rpp=100"}else{if($("#timeline_body > div.post").length==0){b="http://search.twitter.com/search.json?"+e+f+"rpp=20"}else{b="http://search.twitter.com/search.json?"+e+f+"since_id="+c+"&rpp=100"}}b+=geolocation.getURL("&");b+="&callback=?";$.getJSON(b,function(k){if(k.error=="please chillax."){speedController.growAndContinue()}var n=language,h=retweets,j,m,i,l;if(k.results.length>0){logElement.append("Searches")}$.each(k.results.reverse(),function(){if(this.id<=c){return false}j=d.data("value");m=d.data("colour");i=this.to_user_id?"yes":"no";l=this.geo?this.geo.coordinates[0]+" "+this.geo.coordinates[1]:undefined;newInsert({id:this.id,username:this.from_user,avatar:this.profile_image_url,text:this.text,type:"custom custom"+j,lang:n,channel:g,time:this.created_at,colour:m,reply:i,geo:l,service:this.source.stripTags(),entities:this.entities||undefined},n,h);logElement.append(".");lastId.lastSearchArray[g]=this.id});if(k.results.length>0){logElement.append("<br />")}$("#customSearchPanel div.header").removeClass("loading")})}}function processList(){$("#listPanel div.header").addClass("loading");if($("#listlist > table:first").hasClass("active")){$("#listlist > table:gt(0)").each(function(){a($(this))});if($("#listlist > table:gt(0)").length==0){$("#listPanel div.header").removeClass("loading")}}else{$("#listlist > table.active").each(function(){a($(this))})}function a(b){var h=b.find("td.listname").text(),g=b.data("colour"),d=b.data("value"),c=lastId.lastListArray[h]||0,f=h.match(/@?([\w-_]+)\/([\w_-]+)/),i=f[1],e=f[2];if(b.find("td.listname").css("color")=="red"){return true}query={f:"getList",username:i,listname:e};if(c!=0){query.sinceid=c}query.oauth_access_token=prefs.data.oauth_access_token;query.oauth_access_token_secret=prefs.data.oauth_access_token_secret;$.ajax({url:"post.php",type:"POST",data:query,success:function(l){var n=language,j=retweets,k,m;$.each(l.reverse(),function(){k=this.in_reply_to_status_id?"yes":"no";m=this.geo?this.geo.coordinates[0]+" "+this.geo.coordinates[1]:undefined;service=this.service?this.service.stripTags():"";newInsert({id:this.id,username:this.user.screen_name,avatar:this.user.profile_image_url,text:this.text,type:"list list"+d,lang:n,channel:h,time:this.created_at,colour:g,reply:k,geo:m,service:service,entities:this.entities||undefined},n,j);lastId.lastListArray[h]=this.id})},error:function(j){if(j.status==404){b.find("td.listname").css("color","red");setErrorAndTimeOut("One of your lists does not exist, Twitterfall has coloured it in red for you and will not try to fetch it again.",5000)}else{setErrorAndTimeOut("There was an error fetching your list tweets. If you keep getting this message, contact @twfall",5000)}},dataType:"json",complete:function(){$("#listPanel div.header").removeClass("loading")}})}}function doAPICall(e){$("#accountPanel div.header").addClass("loading");var a,c,b,d;if(e=="getmentions"){a=lastId.lastMentions;c="twittermentions";b="mentions"}else{if(e=="gettimeline"){a=lastId.lastTimeline;c="twittertimeline";b="timeline"}else{if(e=="getdm"){a=lastId.lastDirctMsg;c="twitterdm";b="dm"}}}if(a>0){d={f:e,sinceid:a}}else{d={f:e}}d.oauth_access_token=prefs.data.oauth_access_token;d.oauth_access_token_secret=prefs.data.oauth_access_token_secret;$.ajax({type:"POST",url:"post.php",data:d,success:function(h){var j=language,f=retweets,g,i;$.each(h.reverse(),function(){g=this.in_reply_to_status_id?"yes":"no";i=this.geo?this.geo.coordinates[0]+" "+this.geo.coordinates[1]:undefined;var k={id:this.id,type:b,lang:j,channel:c,time:this.created_at,reply:g,geo:i,entities:this.entities||undefined};k.service=this.service?this.service.stripTags():"";if(this.sender){k.username=this.sender.screen_name;k.avatar=this.sender.profile_image_url}else{k.username=this.user.screen_name;k.avatar=this.user.profile_image_url}if(this.retweeted_status){k.text="RT @"+this.retweeted_status.user.screen_name+": "+this.retweeted_status.text;k.retweet=true}else{k.text=this.text;k.retweet=false}if(e=="getmentions"){lastId.lastMentions=this.id;newInsert(k,j,f)}else{if(e=="gettimeline"){lastId.lastTimeline=this.id;newInsert(k,j,f)}else{if(e=="getdm"){lastId.lastDirctMsg=this.id;newInsert(k,j,f)}}}});$("#accountPanel div.header").removeClass("loading")},dataType:"json"})}function escapeHTML(c){var b=c,a=[[/&/g,"&amp;"],[/</g,"&lt;"],[/>/g,"&gt;"],[/\"/g,"&quot;"]];$.each(a,function(d,e){b=b.replace(e[0],e[1])});return b}function parseText(h,f){if(f){var g={},j="",c=0,e=0,a,d,b;$.each(f.urls,function(k,l){g[l.indices[0]]=[l.indices[1],function(){var m=l.expanded_url?l.expanded_url:l.url,i=escapeHTML(l.url)+"'";if(m.match(/http:\/\/(?:www\.)?(bit\.ly|is\.gd|snipurl|tinyurl|twurl|sn\.im|snipr|snurl|ff\.im|tr\.im|goo\.gl)/)){i+=" class='shorturl'"}else{if(m.match(/http:\/\/(?:www\.)?(twitpic\.com|mobypicture\.com|yfrog\.com|flic\.kr|moby\.to|tweetphoto\.com|pic\.gd|twitgoo\.com)/)){i+=" class='twitpic'"}}return"<a href='"+i+" target='_blank'>"+escapeHTML(m)+"</a>"}]});$.each(f.hashtags,function(k,l){g[l.indices[0]]=[l.indices[1],function(){return"<a class='hashtag'>#"+escapeHTML(l.text)+"</a>"}]});$.each(f.user_mentions,function(k,l){g[l.indices[0]]=[l.indices[1],function(i){var m="twitter-link";if(i=="/"){m="list-link"}return"@<a class='"+m+"' href='http://twitter.com/"+escapeHTML(l.screen_name)+"' target='_blank'>"+escapeHTML(l.screen_name)+"</a>"}]});for(e=0;e<h.length;e++){a=g[e];if(a){d=a[0];b=a[1];if(e>c){j+=escapeHTML(h.substring(c,e))}j+=b(h[d]);e=d-1;c=d}}if(e>c){j+=escapeHTML(h.substring(c,e))}h=j;h=h.replace(/<a class='list-link'(.*?)>(.*?)<\/a>([\/][0-9a-zA-Z_-]+)(?![\w])/g,"<a class='list-link'$1>$2$3</a>")}else{h=h.replace(/((?:http[s]?\:\/\/)|(www\.))(\w.+?)(\s|$|,|\. |\.$|\"|\)|\!)/g,'<a href="http://$2$3" target="_blank">$1$3</a>$4');h=h.replace(/(?:^| )#([\-\w]+)/ig,' <a class="hashtag">#$1</a>');h=h.replace(/(^|[^\w])\@([0-9a-zA-Z_]+)(?![\/]|[\w])/g,'$1@<a href="http://twitter.com/$2" class="twitter-link" target="_blank">$2</a>');h=h.replace(/(^|[^\w])\@([0-9a-zA-Z_]+[\/][0-9a-zA-Z_-]+)(?![\w])/g,'$1@<a href="http://twitter.com/$2" class="list-link">$2</a>');h=h.replace(/<a (.*?)>http:\/\/(?:www\.)?(bit\.ly|is\.gd|snipurl|tinyurl|twurl|sn\.im|snipr|snurl|ff\.im|tr\.im|goo\.gl)/g,'<a class="shorturl" $1>http://$2');h=h.replace(/<a (.*?)>http:\/\/(?:www\.)?(twitpic\.com|mobypicture\.com|yfrog\.com|flic\.kr|moby\.to|tweetphoto\.com|pic\.gd|twitgoo\.com)/g,'<a class="twitpic" $1>http://$2')}return h}function newInsert(d,a,b){if(d.id&&(rollingids.inArray(d.id)==false)){if(b==false){if(/(?:RT|via:)/.exec(d.text)){return true}}if(isExcluded(d.text,d.username,d.service.stripTags())){return true}if(d.channel=="Tips"){if(tweetssincetip<40){return true}else{tweetssincetip=0}}if(d.lang==""){d.lang="any"}if(d.type!=="dm"&&d.type!=="error"&&d.text.indexOf("@"+prefs.data.screen_name)>-1){d.type="mentions"}if(d.lang==a||a=="any"){var c={id:d.id,user:d.username,avatar:d.avatar,text:parseText(d.text,d.entities),type:d.type,channel:d.channel,time:d.time||"",colour:d.colour||"",reply:d.reply||"",origtext:d.text,geo:d.geo||"",service:d.service.stripTags(),entities:d.entities||"",retweet:d.retweet||""};tweetQueue.append(c);d.id&&e(d.id);addQueueItem();updateQueueCount()}}function e(h,f){var g=f||rollingids;g.pop();g.unshift(h)}}function trendTweets(c){if(c.match(/^{"Trends":/)){function e(){logElement.append("Got Trends<br />");var g=window.location.href,j=/twitterfall\.com\/\?(.+)$/;if(j.exec(g)){if($.query.has("present")){setTimeout(function(){$("#presentmode").click()},800);$("#presentationtext").text(decodeURIComponent($.query.get("present")).stripScripts().stripTags())}if($.query.has("oauth_token")){prefs.load();if(prefs.data.oauth_access_token!=$.query.get("oauth_token")){twitterLogin($.query.get("oauth_token"))}}else{h()}}else{j=/twitterfall\.com\/(.+)$/;if(j.exec(g)){f(j.exec(g)[1])}}i();function h(){var p=false,m=false,l,o,n;if($.query.has("trend")){p=$.query.get("trend")}if($.query.has("geoloc")){m=$.query.get("geoloc");o=$.query.get("distance");n=$.query.get("unit")}if(p){if(!(k(p))){l=new Array();l.push(p);p=l}processListOfTrends(p)}if(m){addInGeolocation(m,o,n)}else{processCustom()}function k(q){if(q.constructor.toString().indexOf("Array")==-1){return false}else{return true}}}function i(){var p=/twitterfall\.com\/(.+)$/,n=/^\?oauth_token/,s,k,m,l;try{if($("#listlist > table:gt(0)").length!=prefs.data2.lists.length){for(l=0;l<prefs.data2.lists.length;l+=1){m=unescape(prefs.data2.lists[l]).match(/(.+)\!(\#.+)?$/);if(m){s=m[1]||prefs.data2.lists[l];k=m[2]||colours.defaultcustomcolor()}addListoList(s);$("#listlist > table:last").data("colour",k);try{$("#listlist > table:last").find("input.colour").val(k).change()}catch(o){}}}if($("#excludetable td.excludetext").length!=prefs.data2.exclusions.length){for(l=0;l<prefs.data2.exclusions.length;l+=1){addToExclusions(decodeURIComponent(prefs.data2.exclusions[l]),true)}$("#excPanel > div.header").click()}}catch(r){}try{for(l in prefs.data2.panels){if(!$("#"+l+" > div.header").hasClass(prefs.data2.panels[l])){$("#"+l+" > div.header").click()}}}catch(r){}prefs.load();m=p.exec(window.location.href);if(m==null&&!prefs.data.oauth_access_token&&(prefs.data.trends.length==0)&&!prefs.data.geoloc){startobject.setWelcome()}else{startobject.p.remove()}if(m==null||n.test(m[1])||$.query.has("present")){processListOfTrends(prefs.data.trends);if(prefs.data.geoloc){addInGeolocation(prefs.data.geoloc,prefs.data.distance,prefs.data.unit)}processCustom()}$("#settings > select").each(function(){var t=$(this).attr("id");if(prefs.data[t]){$(this).val(prefs.data[t]);$(this).change()}});if(prefs.data.oauth_access_token!=""){var q={f:"verify",oauth_access_token:prefs.data.oauth_access_token,oauth_access_token_secret:prefs.data.oauth_access_token_secret};$.ajax({type:"POST",url:"post.php",data:q,success:function(t){if(t.statuses_count){loggedInUI();prefs.data.geo_enabled=t.geo_enabled;if(!t.geo_enabled&&false){$("#geoloctweet").css("display","block")}prefs.data.screen_name=t.screen_name}},error:function(t){setErrorAndTimeOut("There was a problem verifying your login with Twitter, Twitter may be overloaded. Please refresh and try again",10000)},dataType:"json"});redoSaveLink()}else{if(!($.query.has("oauth_token"))){$("#loginwrap div#login").show();$("#loginwrap div#loggedIn").hide();$("div.login",$("#left-wrapper")).text("Login to Twitter");loginBindings()}}$("#customlist > table").mouseenter(function(){$(this).addClass("hovering")});$("#customlist > table:not(.active)").mouseleave(function(){$(this).removeClass("hovering")});redoSaveLink()}function f(k){k=unescape(k).replace(/(<([^>]+)>)/ig,"");var l=$("#trendlist > table.trend").filter(function(){return $(this).text().toLowerCase()==k.toLowerCase()});if(l.length==1){join(l.text(),"normal");makeActive(l)}else{makeInactive($("#customlist > table"));addCustomSearchToList(k);makeActive($("#customlist > table:last"));processCustom()}}}function d(h){$("#trendPanel div.header").addClass("loading");var i=new Array(),f,g;$("#trendlist > table.trend.active").each(function(){i.push($(this).text())});$.each(h.Trends,function(j,k){$("#trendlist > table.trend:last").remove();f='<table class="trend"><tr><td><div class="actualtrend">';f+=k;f+='</div></td><td class="trend-checkbox-outer"><input type="checkbox" class="trend-checkbox" /></td><td>';if(k!=="All Terms"){f+='<img class="infoicon" src="infoicon.png" />'}f+="</td></tr></table>";$("#trendlist").prepend(f)});$.each(i,function(j,k){g=$("#trendlist > table.trend").filter(function(){return $(this).text()==k});if(g.length<1){findATermAHome(k)}else{g.each(function(){makeActive($(this))})}});$("#trendlist > table.trend:not(.active)").mouseenter(function(){$(this).addClass("hovering")}).mouseleave(function(){$(this).removeClass("hovering")});$("#trendPanel div.header").removeClass("loading");if(trends){e();trends=false}return true}d(JSON.parse(c))}else{var b=/id{([0-9]+?)}username{(.+?)}avatar{(.+?)}text{([\s\S]+?)}type{(.+?)}lang{(.*?)}channel{(.*?)}?/m,a=c.match(b);newInsert({id:a[1],username:a[2],avatar:a[3],text:a[4],type:a[5],lang:a[6],channel:a[7],service:"",entities:undefined},language,retweets)}}function addQueueItem(){if($("#timeline_body").queue("fx").length=="0"){$("#timeline_body").queue(function(){})}$("#timeline_body").queue(function(){updateQueueCount();tweetssincetip+=1;var c=tweetQueue.first,a;if(animations.set==animations.none){c.type+=" dontshowme"}a=$(b(c.id,c.user,c.avatar,c.text,c.type,c.time,c.reply,c.geo));a.prependTo("#timeline_body");if(!blurcounters.ihazfocus){blurcounters.numbersinceblur+=1;switch(c.type.substring(0,4)){case"norm":blurcounters.trendssinceblur+=1;break;case"time":blurcounters.timelinesinceblur+=1;break;case"cust":blurcounters.customsinceblur+=1;break;case"list":blurcounters.listssinceblur+=1;break;case"ment":blurcounters.mentionssinceblur+=1;break;case"erro":blurcounters.tipssinceblur+=1;break}blurcounters.createTitle()}if(c.colour){a.css("background-color",$("#"+c.type.split(" ")[1]).data("colour"))}if(c.type.substring(0,4)!="norm"){a.data("time",new Date(c.time))}if(c.retweet){a.data("retweet",true)}animations.set(a);tweetQueue.remove(c);$("#timeline_body").children(":gt("+prefs.data.size+")").mouseleave().remove();function b(k,d,e,j,g,i,f,h){constructarray[1]=constructarray[33]=k;constructarray[3]=g;constructarray[6]=constructarray[10]=constructarray[17]=constructarray[19]=constructarray[31]=d;constructarray[8]=e;constructarray[15]=i;constructarray[21]="";if(h){constructarray[21]+=' <img class="geoImage" src="geoicon.png" alt="'+h+'">'}if((f=="yes")||((f=="")&&(j.match(/^<a href=\"http:\/\/twitter.com\/.+?>@/)))){constructarray[21]+=' <span class="conversationshow"><img src="user_convo.png" alt="See Conversation"></span>'}constructarray[23]=j;constructarray[25]=constructarray[27]=constructarray[29]=mapcounts;mapcounts+=1;return regexUse(constructarray)}})}function findATermAHome(d){var a,h,c,b,g;a=d.match(/(.+)\!(\#.+)?$/);if(a){d=a[1]||d;h=a[2]||colours.defaultcustomcolor()}c=$("#trendlist > table").filter(function(){return $(this).text().toLowerCase()==d.toLowerCase()});if(c.length>0){join($(c.get(0)).text(),"normal");makeActive($(c.get(0)));return true}b=$("#customlist > table").find("td.searchname").filter(function(){return $(this).text().toLowerCase()==d.toLowerCase()});if(b.length>0){g=$(b.get(0)).parents("table");if(!(g.hasClass("active"))){g.click()}return true}addCustomSearchToList(d);$("#customlist > table:last").data("colour",h);try{$("#customlist > table:last").find("input.colour").val(h).change()}catch(f){}if(!$("#customlist > table:first").hasClass("active")){makeActive($("#customlist > table:last"));processCustom()}}function join(e,c){var b,a;if((e=="All Terms"&&c=="normal")||(e=="All Searches"&&c=="custom")||(e=="All Lists"&&c=="list")){b=true}if(b){if(e=="All Terms"&&c=="normal"){a="trend"}else{a=c}$("#"+a+"list > table.active").each(function(f){leave($(this).text(),c);$(this).removeClass("hovering");makeInactive($(this))})}switch(c){case"normal":try{Meteor.joinChannel("twitterfall-"+escape(e),15)}catch(d){Meteor.leaveChannel("twitterfall-"+escape(e));Meteor.joinChannel("twitterfall-"+escape(e))}break;case"custom":setTimeout(processCustom,2000);break;case"list":setTimeout(processList,2000);break}}function leave(d,c){if(c=="normal"){Meteor.leaveChannel("twitterfall-"+escape(d))}var b=tweetQueue.first,a;while(1){if(b===null){break}if(b.type.split(" ").inArray(c)){if(d=="All Searches"){tweetQueue.remove(b);a=tweetQueue.first}else{if(b.channel==d){tweetQueue.remove(b);a=tweetQueue.first}else{a=b.next}}}else{a=b.next}if(b==tweetQueue.last){break}else{b=a}}reQueue()}function notLoggedIn(){setBarAndShow("Please <a id='loginLink'><strong>Login to Twitter</strong></a> to interact.",true);setBarAndShow("Please <a id='loginLink'><strong>Login to Twitter</strong></a> to interact.",false,3500);$("#loginLink").click(function(){$("#authorize").click();return false})}function doTwitter(e,d,h){logElement.append("Twitter - "+e+"<br />");h=h||function(){return true};var a,g,b,c;switch(e){case"sendreply":c={f:"sendreply",message:d.status_text,reply:d.status_id};if(geolocation.currentLocation){c.location="true";c.lat=geolocation.currentLocation.lat;c.lon=geolocation.currentLocation.lon}a="Replying&hellip;";g="Replied";break;case"follow":c={f:"follow",friendname:d.user};a="Following&hellip;";g="Followed";break;case"dupdate":c={f:"sendreply",message:d.status_text};a="Messaging&hellip;";g="Messaged";break;case"update":c={f:"sendreply",message:d.status_text,location:false};if(geolocation.currentLocation){c.location="true";c.lat=geolocation.currentLocation.lat;c.lon=geolocation.currentLocation.lon}a="Updating&hellip;";g="Updated";break;case"favourite":c={f:"createfavourite",favid:d.id};a="Favouriting&hellip;";g="Favourited";break;case"retweet":c={f:"retweetthis",reply:d.id};a="Retweeting&hellip;";g="Retweeted";break;default:return false}b="There was an error. This is most likely related to a problem with Twitter.";c.oauth_access_token=prefs.data.oauth_access_token;c.oauth_access_token_secret=prefs.data.oauth_access_token_secret;pauseQueue();queuestatus=3;setBarAndShow(a,true);$.ajax({type:"POST",url:"post.php",data:c,success:function(f){if(f.error){setBarAndShow(b,false)}else{setBarAndShow(g,false);h()}queuestatus=0;restartQueue()},error:function(i){try{response=JSON.parse(i.responseText);if(response.error=="Status is a duplicate."){b="Error: Status is a duplicate (your current tweet is the same as what you tried to tweet)."}else{if(response.error=="Status is over 140 characters."){b="Error: That tweet is over 140 characters, please shorten it and try again."}else{if(response.error){b="Error from Twitter: "+response.error}}}}catch(f){}setBarAndShow(b,false);queuestatus=0;restartQueue()},dataType:"json"})}function updateQueueCount(){var a=$("#timeline_body").queue("fx");if(a.length==0){$("#counter").text(a.length)}else{$("#counter").text(a.length-1)}}function addCustomSearchToList(b){b=b.stripScripts().stripTags();var a=colours.getMeAColor();$("#customlist").append('<table class="customsearch" id="custom'+customcounter+'"><tr><td><input class="colour" value="'+a+'" /></td><td class="searchname"><div class="hidingdiv">'+b+'</div></td><td class="trend-checkbox-outer"><input class="trend-checkbox" type="checkbox" /></td><td><img class="remove" src="cross_new.png" alt="remove" /><br /><img class="edit" src="pen.png" alt="Edit" /></td></tr></table>');$("#customlist > table:last").find("input.colour").colorInput().end().data("value",customcounter).data("colour",a).mouseenter(function(){$(this).addClass("hovering")}).mouseleave(function(){$(this).removeClass("hovering")});customcounter+=1}function addListoList(c){var b=c.stripScripts().stripTags().match(/@?([\w-_]+)\/([\w_-]+)/),a;if(b==null){$("#listPanel div.contents.open").append("<div class='quickalert' id='listAlert' style='display:none;'>That wasn't a valid list name, the correct form is @username/listname.<br />For example: @twfall/team<br /><a onClick='$(this).parent().fadeOut(function(){$(this).remove()});'>Remove Alert</a></div>");$("#listAlert").fadeIn("normal");return false}else{$("#listAlert").remove()}a=colours.getMeAColor();$("#listlist").append('<table class="aList" id="list'+listcounter+'"><tr><td><input class="colour" value="'+a+'" /></td><td class="listname"><div class="hidingdiv">@'+b[1]+"/"+b[2]+'</div></td><td class="trend-checkbox-outer"><input class="trend-checkbox" type="checkbox" /></td><td><img class="remove" src="cross_new.png" alt="remove" /></td></tr></table>');$("#listlist > table:last").find("input.colour").colorInput().end().data("value",listcounter).data("colour",a).mouseenter(function(){$(this).addClass("hovering")}).mouseleave(function(){$(this).removeClass("hovering")});listcounter+=1;processList();return true}function processListOfTrends(a){if(!((a.length==0)&&(prefs.data.timeline=="")&&(prefs.data.dm==""))){$.each(a,function(b,c){c=unescape(c).stripScripts().stripTags();findATermAHome(c)})}}function redoSaveLink(){var e=new Array,b=new Array,c=new Array,d={},a;$("#trendlist > table.active").each(function(){e.push(escape($(this).text()))});$("#customlist > table:gt(0)").each(function(){e.push(escape($(this).find("td.searchname").text()+"!"+$(this).data("colour")))});$("#listlist > table:gt(0)").each(function(){b.push(escape($(this).find("td.listname").text()+"!"+$(this).data("colour")))});$("div.header").each(function(){if($(this).hasClass("open")){d[$(this).parent().attr("id")]="open"}else{d[$(this).parent().attr("id")]="closed"}});$("#excludetable td.excludetext").each(function(){c.push(escape($(this).text()))});prefs.data.trends=e;prefs.data2.lists=b;prefs.data2.exclusions=c;prefs.data2.panels=d;a="?trend="+e.join("&trend=");if(geolocation.active!=false){if(a=="?trend="){a="?"}else{a+="&"}a+="geoloc="+escape($("#location").val())+"&distance="+$("#distance").val()+"&unit="+$("#unit").val();prefs.data.geoloc=$("#location").val();prefs.data.distance=$("#distance").val();prefs.data.unit=$("#unit").val()}else{delete prefs.data.geoloc;delete prefs.data.distance;delete prefs.data.unit}if(a=="?trend="){a=""}prefs.save();$("#savelink").attr("href","http://twitterfall.com/"+a)}function twitterLogin(a){$.ajax({type:"POST",url:"post.php",data:{f:"getaccess",oauth_request_token:a,oauth_request_token_secret:prefs.data.oauth_request_token_secret},success:function(b){if(b.oauth_access_token!=""){prefs.data.oauth_access_token=b.oauth_access_token;prefs.data.oauth_access_token_secret=b.oauth_access_token_secret;prefs.save();loggedInUI()}else{setErrorAndTimeOut("There was an error getting an access token from Twitter which most likely indicates that Twitter are having OAuth issues. Try removing anything after twitterfall.com in your address bar.")}},error:function(){setErrorAndTimeOut("There was an error getting an access token from Twitter which most likely indicates that Twitter are having OAuth issues.")},dataType:"json"})}function loggedInUI(){logElement.append("Log In<br />");$("div.login",$("#left-wrapper")).text("Logged In");$("#loginwrap div#login").fadeOut("slow",function(){$("#loginwrap div#loggedIn").fadeIn("slow");$("#importsavedsearches").click(function(){var b=$(this).text();$(this).text("Loading...");query={f:"saved_searches"};query.oauth_access_token=prefs.data.oauth_access_token;query.oauth_access_token_secret=prefs.data.oauth_access_token_secret;$.ajax({type:"POST",url:"post.php",data:query,success:function(c){if(c.error){setErrorAndTimeOut("There was an error importing your saved searches: "+c.error)}else{$.each(c,function(){findATermAHome(this.query)});redoSaveLink();$("#importsavedsearches").text(b);processCustom()}},error:function(){setErrorAndTimeOut("There was an error importing your saved searches")},dataType:"json"})});$("#importlists").click(function(){var b=$(this).text();$(this).text("Loading...");query={f:"subscribed_lists"};query.oauth_access_token=prefs.data.oauth_access_token;query.oauth_access_token_secret=prefs.data.oauth_access_token_secret;query.screen_name=prefs.data.screen_name;$.ajax({type:"POST",url:"post.php",data:query,success:function(c){if(c.error){setErrorAndTimeOut("There was an error importing your subscribed lists: "+c.error);$("#importlists").text(b)}else{$.each(c.lists,function(){addListoList(this.full_name)});redoSaveLink();$("#importlists").text(b);processList()}},error:function(){setErrorAndTimeOut("There was an error importing your subscribed lists");$("#importlists").text(b)},dataType:"json"})});$("#importownlists").click(function(){var b=$(this).text();$(this).text("Loading...");query={f:"getMyLists"};query.oauth_access_token=prefs.data.oauth_access_token;query.oauth_access_token_secret=prefs.data.oauth_access_token_secret;query.screen_name=prefs.data.screen_name;$.ajax({type:"POST",url:"post.php",data:query,success:function(c){if(c.error){setErrorAndTimeOut("There was an error importing your lists: "+c.error);$("#importownlists").text(b)}else{$.each(c.lists,function(){addListoList(this.full_name)});redoSaveLink();$("#importownlists").text(b);processList()}},error:function(){setErrorAndTimeOut("There was an error importing your lists");$("#importownlists").text(b)},dataType:"json"})});$("#exportsavedsearches").click(function(){var b=$(this).text(),c=0;$(this).text("Saving...");query={f:"saved_searches_create"};query.oauth_access_token=prefs.data.oauth_access_token;query.oauth_access_token_secret=prefs.data.oauth_access_token_secret;$("table.customsearch",$("#customSearchPanel")).find("td.searchname").filter(function(){return $(this).text()!="All Searches"}).each(function(){c+=1;query.message=$(this).text();$.ajax({type:"POST",url:"post.php",data:query,success:function(d){c-=1;if(c==0){$("#exportsavedsearches").text(b)}},dataType:"json"})})});$("#exportlists").click(function(){var c=$(this).text(),d=0,b;$(this).text("Subscribing...");query={f:"lists_subscribe"};query.oauth_access_token=prefs.data.oauth_access_token;query.oauth_access_token_secret=prefs.data.oauth_access_token_secret;$("table.aList",$("#listPanel")).find("td.listname").filter(function(){return $(this).text()!="All Lists"}).each(function(){d+=1;b=$(this).text().match(/@?([\w-_]+)\/([\w_-]+)/);query.username=b[1];query.slug=b[2];$.ajax({type:"POST",url:"post.php",data:query,success:function(e){d-=1;if(d==0){$("#exportlists").text(c)}},error:function(){setErrorAndTimeOut("There was an error exporting your lists",5000);$("#exportlists").text(c)},dataType:"json"})})});$("#changetimelineint, #changementionsint, #changedmint").click(function(){var b=$(this).attr("id").match(/change(.+?)int/);b=b[1];if($("#showmy"+b+"val").is(":checked")){timerBlock[b+"Timer"]=0;timerBlock[b+"Timer"]=$("#change"+b+"int").val();prefs.data[b]=$("#change"+b+"int").val();prefs.save()}});var a={timeline:false,mentions:false,dm:false};$("#showmydmval, #showmymentionsval, #showmytimelineval").click(function(){var b=$(this).attr("id").match(/showmy(.+?)val/);b=b[1];if($(this).is(":checked")||a[b]){doAPICall("get"+b);join("twitter"+b,b);timerBlock[b+"Timer"]=$("#change"+b+"int").val();prefs.data[b]=$("#change"+b+"int").val()}else{leave("twitter"+b,b);timerBlock[b+"Timer"]=0;prefs.data[b]=""}prefs.save();a[b]=false});if(prefs.data.timeline){$("#changetimelineint").val(prefs.data.timeline);a.timeline=true;$("#showmytimelineval").click();timerBlock.timelineTimer=prefs.data.timeline;doAPICall("gettimeline")}if(prefs.data.dm){$("#changedmint").val(prefs.data.dm);a.dm=true;$("#showmydmval").click();timerBlock.dmTimer=prefs.data.dm;doAPICall("getdm")}if(prefs.data.mentions){$("#changementionsint").val(prefs.data.mentions);a.mentions=true;$("#showmymentionsval").click();timerBlock.mentionsTimer=prefs.data.mentions;doAPICall("getmentions")}})}function addInGeolocation(b,h,e){var c=unescape(b).stripScripts().stripTags(),f=unescape(h).stripScripts().stripTags(),a=unescape(e).stripScripts().stripTags();$("#geoPanel > div.header").click();$("#location").val(c);$("#distance").val(f);$("#unit").val(a);geolocation.setAddress(c,function(){processCustom();redoSaveLink()})}function makeActive(a){a.addClass("active").find("input.trend-checkbox").attr("checked","checked").end().unbind("mouseleave")}function makeInactive(a){var b=a.find("input.trend-checkbox");a.removeClass("active");b.attr("checked","");a.mouseleave(function(){a.removeClass("hovering")})}function loginBindings(){$("#authorize").click(function(){$.ajax({type:"POST",url:"post.php",data:{f:"gettoken"},success:function(a){if(a.oauth_request_token){prefs.data.oauth_request_token=a.oauth_request_token;prefs.data.oauth_request_token_secret=a.oauth_request_token_secret;prefs.save();document.location="https://twitter.com/oauth/authenticate?oauth_token="+a.oauth_request_token}else{setErrorAndTimeOut("There was an error getting a request token from Twitter")}},error:function(){setErrorAndTimeOut("There was an error getting a request token from Twitter")},dataType:"json"})})}function setBarAndShow(c,a,b){b=b||2500;$("#popupReplyInner").html("<p>"+c+"</p>");if(a){$("#popupReply").fadeIn()}else{setTimeout(function(){$("#popupReply").fadeOut()},b)}}function setErrorAndTimeOut(b,a){a=a||20000;$("#popupErrorInner").html("<p>"+b+"</p>");$("#popupError").fadeIn();setTimeout(function(){$("#popupError").fadeOut()},a)}function regexUse(b){var c,a;if(safariorie){c=b.join("")}else{c="";for(a=0;a<b.length;a+=1){c+=b[a]}}return c}function addToExclusions(d,b){if(b){$("#excludetable").append("<tr class='excluderow'><td class='excludetext'>"+d+'</td><td style="cursor: pointer"><img class="remove" src="cross_new.png" alt="remove"></td></tr>')}var c=d.toLowerCase(),f=/from:[\s]*(.+)$/,e=/service:[\s]*(.+)$/,a=c.match(f),g=c.match(e);if(a){fromexclusions.add(a[1])}else{if(g){serviceexclusions.add(g[1])}else{stringexclusions.add(c)}}}function sendStat(a,b){$.getJSON("http://x5315.com/stats/statMonitor.php?stat="+a+"&value="+b+"&callback=?",function(c){return true})}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+=1};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+=1};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+=1};LinkedList.Circular.prototype.remove=function(a){if(this.length>1){if(a.next){a.prev.next=a.next;a.next.prev=a.prev}else{if(a.prev){a.prev.next=null}}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-=1};Array.prototype.inArray=function(b){for(var a=0;a<this.length;a+=1){if(this[a]==b){return true}}return false};Array.prototype.remove=function(c,b){var a=this.slice((b||c)+1||this.length);this.length=c<0?this.length+c:c;return this.push.apply(this,a)};String.prototype.stripTags=function(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")};String.prototype.stripScripts=function(){return this.replace(/<script[^>]*>([\\S\\s]*?)<\/script>/img,"")};function prependChild(a,b){a.insertBefore(b,a.firstChild);return(a.firstChild)}TrieNode.prototype.hasChild=function(a){if(a){if(this.children[a]){return this.children[a]}else{return false}}else{return false}};TrieNode.prototype.add=function(b){if(b){this.prefixCount+=1;var a=b.charAt(0);(this.children[a]||(this.children[a]=new TrieNode())).add(b.substring(1))}else{this.wordCount+=1}};TrieNode.prototype.getPrefixCount=function(a){return a?this.getCount(a,arguments.callee):this.prefixCount};TrieNode.prototype.getWordCount=function(a){return a?this.getCount(a,arguments.callee):this.wordCount};TrieNode.prototype.getCount=function(b,c){var a=b.charAt(0);return this.children[a]?c.call(this.children[a],b.substring(1)):0};