(function(a){a.fn.jTweetsAnywhere=function(b){var b=a.extend({username:"tbillenstein",list:null,searchParams:null,count:0,tweetProfileImagePresent:null,tweetFilter:defaultTweetFilter,showTweetFeed:true,showFollowButton:false,showConnectButton:false,showLoginInfo:false,showTweetBox:false,mainDecorator:defaultMainDecorator,tweetFeedDecorator:defaultTweetFeedDecorator,tweetDecorator:defaultTweetDecorator,tweetProfileImageDecorator:defaultTweetProfileImageDecorator,tweetBodyDecorator:defaultTweetBodyDecorator,tweetUsernameDecorator:defaultTweetUsernameDecorator,tweetTextDecorator:defaultTweetTextDecorator,tweetAttributesDecorator:defaultTweetAttributesDecorator,tweetTimestampDecorator:defaultTweetTimestampDecorator,tweetSourceDecorator:defaultTweetSourceDecorator,tweetGeoLocationDecorator:defaultTweetGeoLocationDecorator,tweetInReplyToDecorator:defaultTweetInReplyToDecorator,tweetRetweeterDecorator:defaultTweetRetweeterDecorator,tweetFeedControlsDecorator:defaultTweetFeedControlsDecorator,tweetFeedControlsMoreBtnDecorator:defaultTweetFeedControlsMoreBtnDecorator,tweetFeedControlsPrevBtnDecorator:defaultTweetFeedControlsPrevBtnDecorator,tweetFeedControlsNextBtnDecorator:defaultTweetFeedControlsNextBtnDecorator,tweetFeedAutorefreshTriggerDecorator:defaultTweetFeedAutorefreshTriggerDecorator,tweetFeedAutorefreshTriggerContentDecorator:defaultTweetFeedAutorefreshTriggerContentDecorator,connectButtonDecorator:defaultConnectButtonDecorator,loginInfoDecorator:defaultLoginInfoDecorator,loginInfoContentDecorator:defaultLoginInfoContentDecorator,followButtonDecorator:defaultFollowButtonDecorator,tweetBoxDecorator:defaultTweetBoxDecorator,linkDecorator:defaultLinkDecorator,usernameDecorator:defaultUsernameDecorator,hashtagDecorator:defaultHashtagDecorator,loadingDecorator:defaultLoadingDecorator,errorDecorator:defaultErrorDecorator,noDataDecorator:defaultNoDataDecorator,tweetTimestampFormatter:defaultTweetTimestampFormatter,tweetTimestampTooltipFormatter:defaultTweetTimestampTooltipFormatter,tweetVisualizer:defaultTweetVisualizer,loadingIndicatorVisualizer:defaultLoadingIndicatorVisualizer,autorefreshTriggerVisualizer:defaultAutorefreshTriggerVisualizer,onDataRequestHandler:defaultOnDataRequestHandler,onRateLimitDataHandler:defaultOnRateLimitDataHandler,_tweetFeedConfig:{expandHovercards:false,showTimestamp:{refreshInterval:0},showSource:false,showGeoLocation:true,showInReplyTo:true,showProfileImages:null,showUserScreenNames:null,showUserFullNames:false,includeRetweets:true,paging:{mode:"none",_limit:0,_offset:0},autorefresh:{mode:"none",interval:60,duration:3600,_startTime:null,_triggerElement:null},_pageParam:0,_maxId:null,_recLevel:0,_noData:false,_clearBeforePopulate:false},_tweetBoxConfig:{counter:true,width:515,height:65,label:"What's happening?",defaultContent:"",onTweet:function(a,b){}},_connectButtonConfig:{size:"medium"},_baseSelector:null,_baseElement:null,_tweetFeedElement:null,_tweetFeedControlsElement:null,_followButtonElement:null,_loginInfoElement:null,_connectButtonElement:null,_tweetBoxElement:null,_loadingIndicatorElement:null,_noDataElement:null,_tweetsCache:[],_autorefreshTweetsCache:[],_stats:{dataRequestCount:0,rateLimitPreventionCount:0,rateLimit:{remaining_hits:150,hourly_limit:150}}},b);if(!b.mainDecorator){return}b._baseSelector=this.selector;if(typeof b.username!="string"){if(!b.searchParams){b.searchParams=["q=from:"+b.username.join(" OR from:")]}b.username=b.username[0]}if(typeof b.showTweetFeed=="object"){a.extend(true,b._tweetFeedConfig,b.showTweetFeed)}if(typeof b.showTweetBox=="object"){b._tweetBoxConfig=b.showTweetBox;b.showTweetBox=true}if(typeof b.showConnectButton=="object"){b._connectButtonConfig=b.showConnectButton;b.showConnectButton=true}if(b._tweetFeedConfig.showProfileImages==null){b._tweetFeedConfig.showProfileImages=b.tweetProfileImagePresent}if(b._tweetFeedConfig.showProfileImages==null){b._tweetFeedConfig.showProfileImages=(b.list||b.searchParams)&&b.tweetProfileImageDecorator}if(b._tweetFeedConfig.showUserScreenNames==null){if(b.list||b.searchParams){b._tweetFeedConfig.showUserScreenNames=true}if(!b.tweetUsernameDecorator){b._tweetFeedConfig.showUserScreenNames=false}}if(b._tweetFeedConfig.showUserFullNames==null){if(b.list||b.searchParams){b._tweetFeedConfig.showUserFullNames=true}if(!b.tweetUsernameDecorator){b._tweetFeedConfig.showUserFullNames=false}}b.count=validateRange(b.count,0,b.searchParams?100:20);b._tweetFeedConfig.autorefresh.interval=Math.max(30,b._tweetFeedConfig.autorefresh.interval);b._tweetFeedConfig.paging._offset=0;b._tweetFeedConfig.paging._limit=b.count;if(b.count==0||!b.showTweetFeed){b.tweetFeedDecorator=null;b.tweetFeedControlsDecorator=null}if(b._tweetFeedConfig.paging.mode=="none"){b.tweetFeedControlsDecorator=null}if(!b.showFollowButton){b.followButtonDecorator=null}if(!b.showTweetBox){b.tweetBoxDecorator=null}if(!b.showConnectButton){b.connectButtonDecorator=null}if(!b.showLoginInfo){b.loginInfoDecorator=null}if(!b._tweetFeedConfig.showTimestamp){b.tweetTimestampDecorator=null}if(!b._tweetFeedConfig.showSource){b.tweetSourceDecorator=null}if(!b._tweetFeedConfig.showGeoLocation){b.tweetGeoLocationDecorator=null}if(!b._tweetFeedConfig.showInReplyTo){b.tweetInReplyToDecorator=null}a.ajaxSetup({cache:true});return this.each(function(){b._baseElement=a(this);b._tweetFeedElement=b.tweetFeedDecorator?a(b.tweetFeedDecorator(b)):null;b._tweetFeedControlsElement=b.tweetFeedControlsDecorator?a(b.tweetFeedControlsDecorator(b)):null;b._followButtonElement=b.followButtonDecorator?a(b.followButtonDecorator(b)):null;b._tweetBoxElement=b.tweetBoxDecorator?a(b.tweetBoxDecorator(b)):null;b._connectButtonElement=b.connectButtonDecorator?a(b.connectButtonDecorator(b)):null;b._loginInfoElement=b.loginInfoDecorator?a(b.loginInfoDecorator(b)):null;b.mainDecorator(b);populateTweetFeed(b);populateAnywhereControls(b);bindEventHandlers(b);b._tweetFeedConfig.autorefresh._startTime=(new Date).getTime();startAutorefresh(b);startTimestampRefresh(b)})};defaultMainDecorator=function(a){if(a._tweetFeedElement){a._baseElement.append(a._tweetFeedElement)}if(a._tweetFeedControlsElement){a._baseElement.append(a._tweetFeedControlsElement)}if(a._connectButtonElement){a._baseElement.append(a._connectButtonElement)}if(a._loginInfoElement){a._baseElement.append(a._loginInfoElement)}if(a._followButtonElement){a._baseElement.append(a._followButtonElement)}if(a._tweetBoxElement){a._baseElement.append(a._tweetBoxElement)}};defaultTweetFeedControlsDecorator=function(a){var b="";if(a._tweetFeedConfig.paging.mode=="prev-next"){if(a.tweetFeedControlsPrevBtnDecorator){b+=a.tweetFeedControlsPrevBtnDecorator(a)}if(a.tweetFeedControlsNextBtnDecorator){b+=a.tweetFeedControlsNextBtnDecorator(a)}}else if(a._tweetFeedConfig.paging.mode=="endless-scroll"){}else{if(a.tweetFeedControlsMoreBtnDecorator){b+=a.tweetFeedControlsMoreBtnDecorator(a)}}return'<div class="jta-tweet-list-controls">'+b+"</div>"};defaultTweetFeedControlsMoreBtnDecorator=function(a){return'<span class="jta-tweet-list-controls-button jta-tweet-list-controls-button-more">'+"More"+"</span>"};defaultTweetFeedControlsPrevBtnDecorator=function(a){return'<span class="jta-tweet-list-controls-button jta-tweet-list-controls-button-prev">'+"Prev"+"</span>"};defaultTweetFeedControlsNextBtnDecorator=function(a){return'<span class="jta-tweet-list-controls-button jta-tweet-list-controls-button-next">'+"Next"+"</span>"};defaultTweetFeedAutorefreshTriggerDecorator=function(a,b){var c="";if(b.tweetFeedAutorefreshTriggerContentDecorator){c=b.tweetFeedAutorefreshTriggerContentDecorator(a,b)}return'<li class="jta-tweet-list-autorefresh-trigger">'+c+"</li>"};defaultTweetFeedAutorefreshTriggerContentDecorator=function(a,b){var c=""+a+" new "+(a>1?" tweets":" tweet");return'<span class="jta-tweet-list-autorefresh-trigger-content">'+c+"</span>"};defaultTweetFeedDecorator=function(a){return'<ul class="jta-tweet-list"></ul>'};defaultTweetDecorator=function(a,b){var c="";if(b._tweetFeedConfig.showProfileImages){c+=b.tweetProfileImageDecorator(a,b)}if(b.tweetBodyDecorator){c+=b.tweetBodyDecorator(a,b)}c+='<div class="jta-clear"> </div>';return'<li class="jta-tweet-list-item">'+c+"</li>"};defaultTweetProfileImageDecorator=function(a,b){var c=a.retweeted_status||a;var d=c.user?c.user.screen_name:false||c.from_user;var e=c.user?c.user.profile_image_url:false||c.profile_image_url;var f='<a class="jta-tweet-profile-image-link" href="http://twitter.com/'+d+'" target="_blank">'+'<img src="'+e+'" alt="'+d+'"'+(isAnywherePresent()?"":' title="'+d+'"')+"/>"+"</a>";return'<div class="jta-tweet-profile-image">'+f+"</div>"};defaultTweetBodyDecorator=function(a,b){var c="";if(b.tweetTextDecorator){c+=b.tweetTextDecorator(a,b)}if(b.tweetAttributesDecorator){c+=b.tweetAttributesDecorator(a,b)}return'<div class="jta-tweet-body '+(b._tweetFeedConfig.showProfileImages?"jta-tweet-body-list-profile-image-present":"")+'">'+c+"</div>"};defaultTweetTextDecorator=function(a,b){var c=a.text;if(a.retweeted_status&&(b._tweetFeedConfig.showUserScreenNames||b._tweetFeedConfig.showUserScreenNames==null||b._tweetFeedConfig.showUserFullNames||b._tweetFeedConfig.showUserFullNames==null)){c=a.retweeted_status.text}if(b.linkDecorator){c=b.linkDecorator(c,b)}if(b.usernameDecorator){c=b.usernameDecorator(c,b)}if(b.hashtagDecorator){c=b.hashtagDecorator(c,b)}if(b._tweetFeedConfig.showUserScreenNames||b._tweetFeedConfig.showUserFullNames||a.retweeted_status&&(b._tweetFeedConfig.showUserScreenNames==null||b._tweetFeedConfig.showUserFullNames==null)){c=b.tweetUsernameDecorator(a,b)+" "+c}return'<span class="jta-tweet-text">'+c+"</span>"};defaultTweetUsernameDecorator=function(a,b){var c=a.retweeted_status||a;var d=c.user?c.user.screen_name:false||c.from_user;var e=c.user?c.user.name:null;var f;if(d&&(b._tweetFeedConfig.showUserScreenNames||b._tweetFeedConfig.showUserScreenNames==null&&a.retweeted_status)){f='<span class="jta-tweet-user-screen-name">'+'<a class="jta-tweet-user-screen-name-link" href="http://twitter.com/'+d+'" target="_blank">'+d+"</a>"+"</span>"}var g;if(e&&(b._tweetFeedConfig.showUserFullNames||b._tweetFeedConfig.showUserFullNames==null&&a.retweeted_status)){g='<span class="jta-tweet-user-full-name">'+(f?" (":"")+'<a class="jta-tweet-user-full-name-link" href="http://twitter.com/'+d+'" name="'+d+'" target="_blank">'+e+"</a>"+(f?")":"")+"</span>"}var h="";if(f){h+=f}if(g){if(f){h+=" "}h+=g}if(f||g){h='<span class="jta-tweet-user-name">'+(a.retweeted_status?"RT ":"")+h+"</span>"}return h};defaultTweetAttributesDecorator=function(a,b){var c="";if(b.tweetTimestampDecorator||b.tweetSourceDecorator||b.tweetGeoLocationDecorator||b.tweetInReplyToDecorator||a.retweeted_status&&b.tweetRetweeterDecorator){c+='<span class="jta-tweet-attributes">';if(b.tweetTimestampDecorator){c+=b.tweetTimestampDecorator(a,b)}if(b.tweetSourceDecorator){c+=b.tweetSourceDecorator(a,b)}if(b.tweetGeoLocationDecorator){c+=b.tweetGeoLocationDecorator(a,b)}if(b.tweetInReplyToDecorator){c+=b.tweetInReplyToDecorator(a,b)}if(a.retweeted_status&&b.tweetRetweeterDecorator){c+=b.tweetRetweeterDecorator(a,b)}c+="</span>"}return c};defaultTweetTimestampDecorator=function(a,b){var c=a.retweeted_status||a;var d=formatDate(c.created_at);var e=b.tweetTimestampFormatter(d);var f=b.tweetTimestampTooltipFormatter(d);var g=c.user?c.user.screen_name:false||c.from_user;var h='<span class="jta-tweet-timestamp">'+'<a class="jta-tweet-timestamp-link" data-timestamp="'+d+'" href="http://twitter.com/'+g+"/status/"+c.id+'" target="_blank" title="'+f+'">'+e+"</a>"+"</span>";return h};defaultTweetTimestampTooltipFormatter=function(a){var b=new Date(a);return b.toLocaleString()};defaultTweetTimestampFormatter=function(a){var b=new Date;var c=parseInt((b.getTime()-Date.parse(a))/1e3);var d="";if(c<60){d+=c+" second"+(c==1?"":"s")+" ago"}else if(c<3600){var e=parseInt((c+30)/60);d+=e+" minute"+(e==1?"":"s")+" ago"}else if(c<86400){var e=parseInt((c+1800)/3600);d+=e+" hour"+(e==1?"":"s")+" ago"}else{var f=new Date(a);var g="AM";var h=f.getHours();if(h>12){h-=12;g="PM"}var i=f.getMinutes();var j=(i<10?"0":"")+i;var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];d+=k[f.getMonth()]+" "+f.getDate();if(f.getFullYear()<b.getFullYear()){d+=", "+f.getFullYear()}var e=parseInt((c+43200)/86400);d+=" ("+e+" day"+(e==1?"":"s")+" ago)"}return d};exTimestampFormatter=function(a){var b=parseInt(((new Date).getTime()-Date.parse(a))/1e3);var c="";if(b<60){c+="less than a minute ago"}else if(b<3600){var d=parseInt((b+30)/60);c+=d+" minute"+(d==1?"":"s")+" ago"}else if(b<86400){var d=parseInt((b+1800)/3600);c+="about "+d+" hour"+(d==1?"":"s")+" ago"}else{var d=parseInt((b+43200)/86400);c+="about "+d+" day"+(d==1?"":"s")+" ago";var e=new Date(a);var f="AM";var g=e.getHours();if(g>12){g-=12;f="PM"}var h=e.getMinutes();var i=(h<10?"0":"")+h;c+=" ("+g+":"+i+" "+f+" "+(e.getMonth()+1)+"/"+e.getDate()+"/"+e.getFullYear()+")"}return c};defaultTweetSourceDecorator=function(a,b){var c=a.retweeted_status||a;var d=c.source.replace(/\&lt\;/gi,"<").replace(/\&gt\;/gi,">").replace(/\&quot\;/gi,'"');var e='<span class="jta-tweet-source">'+" via "+'<span class="jta-tweet-source-link">'+d+"</span>"+"</span>";return e};defaultTweetGeoLocationDecorator=function(a,b){var c="";var d=a.retweeted_status||a;var e;if(d.geo&&d.geo.coordinates){e=d.geo.coordinates.join()}else if(d.place&&d.place.full_name){e=d.place.full_name}if(e){var f="here";if(d.place&&d.place.full_name){f=d.place.full_name}var g="http://maps.google.com/maps?q="+e;c='<span class="jta-tweet-location">'+" from "+'<a class="jta-tweet-location-link" href="'+g+'" target="_blank">'+f+"</a>"+"</span>"}return c};defaultTweetInReplyToDecorator=function(a,b){var c=a.retweeted_status||a;var d="";if(c.in_reply_to_status_id&&c.in_reply_to_screen_name){d='<span class="jta-tweet-inreplyto">'+" "+'<a class="jta-tweet-inreplyto-link" href="http://twitter.com/'+c.in_reply_to_screen_name+"/status/"+c.in_reply_to_status_id+'" target="_blank">'+"in reply to "+c.in_reply_to_screen_name+"</a>"+"</span>"}return d};defaultTweetRetweeterDecorator=function(a,b){var c="";if(a.retweeted_status){var d=a.user?a.user.screen_name:false||a.from_user;var e=(a.retweeted_status.retweet_count||0)-1;var f='<a class="jta-tweet-retweeter-link" href="http://twitter.com/'+d+'" target="_blank">'+d+"</a>";var g=" and "+e+(e>1?" others":" other");c="<br/>"+'<span class="jta-tweet-retweeter">'+"Retweeted by "+f+(e>0?g:"")+"</span>"}return c};defaultConnectButtonDecorator=function(a){return'<div class="jta-connect-button"></div>'};defaultLoginInfoDecorator=function(a){return'<div class="jta-login-info"></div>'};defaultLoginInfoContentDecorator=function(a,b){var c="";if(b.isConnected()){var d=b.currentUser.data("screen_name");var e=b.currentUser.data("profile_image_url");c='<div class="jta-login-info-profile-image">'+'<a href="http://twitter.com/'+d+'" target="_blank">'+'<img src="'+e+'" alt="'+d+'" title="'+d+'"/>'+"</a>"+"</div>"+'<div class="jta-login-info-block">'+'<div class="jta-login-info-screen-name">'+'<a href="http://twitter.com/'+d+'" target="_blank">'+d+"</a>"+"</div>"+'<div class="jta-login-info-sign-out">'+"Sign out"+"</div>"+"</div>"+'<div class="jta-clear"> </div>'}return c};defaultFollowButtonDecorator=function(a){return'<div class="jta-follow-button"></div>'};defaultTweetBoxDecorator=function(a){return'<div class="jta-tweet-box"></div>'};defaultLinkDecorator=function(a,b){return a.replace(/((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi,'<a href="$1" class="jta-tweet-a jta-tweet-link" target="_blank" rel="nofollow">$1</a>')};defaultUsernameDecorator=function(a,b){return isAnywherePresent()?a:a.replace(/@([a-zA-Z0-9_]+)/gi,'@<a href="http://twitter.com/$1" class="jta-tweet-a twitter-anywhere-user" target="_blank" rel="nofollow">$1</a>')};defaultHashtagDecorator=function(a,b){return a.replace(/#([a-zA-Z0-9_]+)/gi,'<a href="http://search.twitter.com/search?q=%23$1" class="jta-tweet-a jta-tweet-hashtag" title="#$1" target="_blank" rel="nofollow">#$1</a>')};defaultLoadingDecorator=function(a){return'<li class="jta-loading">loading ...</li>'};defaultErrorDecorator=function(a,b){return'<li class="jta-error">ERROR: '+a+"</li>"};defaultNoDataDecorator=function(a){return'<li class="jta-nodata">No more data</li>'};defaultTweetFilter=function(a,b){return true};defaultTweetVisualizer=function(a,b,c,d){a[c](b)};defaultLoadingIndicatorVisualizer=function(a,b,c,d){defaultVisualizer(a,b,"append","fadeIn",600,"fadeOut",200,d)};defaultAutorefreshTriggerVisualizer=function(a,b,c,d){defaultVisualizer(a,b,"prepend","slideDown",600,"fadeOut",200,d)};defaultVisualizer=function(a,b,c,d,e,f,g,h){var i=function(){if(h){h()}};if(a){b.hide();a[c](b);b[d](e,i)}else{b[f](g,function(){b.remove();i()})}};defaultOnDataRequestHandler=function(a,b){return true};defaultOnRateLimitDataHandler=function(a,b){};updateLoginInfoElement=function(b,c){if(b._loginInfoElement&&b.loginInfoContentDecorator){b._loginInfoElement.children().remove();b._loginInfoElement.append(b.loginInfoContentDecorator(b,c));a(b._baseSelector+" .jta-login-info-sign-out").bind("click",function(){twttr.anywhere.signOut()})}};getFeedUrl=function(a,b){var c="https:"==document.location.protocol?"https:":"http:";if(a.searchParams){c+="//search.twitter.com/search.json?"+(a.searchParams instanceof Array?a.searchParams.join("&"):a.searchParams)+"&rpp=100"}else if(a.list){c+="//api.twitter.com/1/"+a.username+"/lists/"+a.list+"/statuses.json?per_page=20"}else{c+="//api.twitter.com/1/statuses/user_timeline.json?screen_name="+a.username+"&count=20";if(a._tweetFeedConfig.includeRetweets)c+="&include_rts=true"}if(b){c+=(a._tweetFeedConfig._maxId?"&max_id="+a._tweetFeedConfig._maxId:"")+"&page="+a._tweetFeedConfig._pageParam}c+="&callback=?";return c};isAnywherePresent=function(){return typeof twttr!="undefined"};clearTweetFeed=function(a){if(a._tweetFeedElement){a._tweetFeedElement.empty()}};populateTweetFeed=function(b){if(b.tweetDecorator&&b._tweetFeedElement){getPagedTweets(b,function(b,c){if(c._tweetFeedConfig._clearBeforePopulate){clearTweetFeed(c)}hideLoadingIndicator(c,function(){a.each(b,function(b,d){c.tweetVisualizer(c._tweetFeedElement,a(c.tweetDecorator(d,c)),"append",c)});if(c._tweetFeedConfig._noData&&c.noDataDecorator&&!c._tweetFeedConfig._noDataElement){c._tweetFeedConfig._noDataElement=a(c.noDataDecorator(c));c._tweetFeedElement.append(c._tweetFeedConfig._noDataElement)}if(c._tweetFeedConfig._clearBeforePopulate){c._tweetFeedElement.scrollTop(0)}addHovercards(c)})})}};populateTweetFeed2=function(b){if(b._tweetFeedElement&&b._autorefreshTweetsCache.length>0){if(b._tweetFeedConfig.autorefresh.mode=="trigger-insert"){if(b._tweetFeedConfig.autorefresh._triggerElement){if(b.tweetFeedAutorefreshTriggerContentDecorator){b._tweetFeedConfig.autorefresh._triggerElement.html(b.tweetFeedAutorefreshTriggerContentDecorator(b._autorefreshTweetsCache.length,b))}}else{if(b.tweetFeedAutorefreshTriggerDecorator){b._tweetFeedConfig.autorefresh._triggerElement=a(b.tweetFeedAutorefreshTriggerDecorator(b._autorefreshTweetsCache.length,b));b._tweetFeedConfig.autorefresh._triggerElement.bind("click",function(){b.autorefreshTriggerVisualizer(null,b._tweetFeedConfig.autorefresh._triggerElement,b,function(){insertTriggerTweets(b)});b._tweetFeedConfig.autorefresh._triggerElement=null});b.autorefreshTriggerVisualizer(b._tweetFeedElement,b._tweetFeedConfig.autorefresh._triggerElement,b)}}}else{insertTriggerTweets(b)}}};insertTriggerTweets=function(b){if(b.tweetDecorator&&b._autorefreshTweetsCache.length>0){while(b._autorefreshTweetsCache.length>0){var c=b._autorefreshTweetsCache.pop();b._tweetsCache.unshift(c);b._tweetFeedConfig.paging._offset++;b.tweetVisualizer(b._tweetFeedElement,a(b.tweetDecorator(c,b)),"prepend",b)}addHovercards(b)}};addHovercards=function(a){if(isAnywherePresent()){};};populateAnywhereControls=function(b){if(isAnywherePresent()){twttr.anywhere(function(c){if(b.tweetBoxDecorator){c(b._baseSelector+" .jta-tweet-box").tweetBox(b._tweetBoxConfig)}if(b.followButtonDecorator){c(b._baseSelector+" .jta-follow-button").followButton(b.username)}if(b.connectButtonDecorator){var d=a.extend({authComplete:function(a){updateLoginInfoElement(b,c)},signOut:function(){updateLoginInfoElement(b,c)}},b._connectButtonConfig);c(b._baseSelector+" .jta-connect-button").connectButton(d);updateLoginInfoElement(b,c)}})}};bindEventHandlers=function(b){if(b.tweetFeedControlsDecorator){if(b._tweetFeedConfig.paging.mode=="prev-next"){a(b._baseSelector+" .jta-tweet-list-controls-button-prev").bind("click",function(){if(!isLoading(b)&&b._tweetFeedConfig.paging._offset>0){prevPage(b,true)}});a(b._baseSelector+" .jta-tweet-list-controls-button-next").bind("click",function(){if(!isLoading(b)){nextPage(b,true)}})}else if(b._tweetFeedConfig.paging.mode=="endless-scroll"){b._tweetFeedElement.bind("scroll",function(){if(!isLoading(b)&&a(this)[0].scrollHeight-a(this).scrollTop()==a(this).outerHeight()){nextPage(b,false)}})}else{a(b._baseSelector+" .jta-tweet-list-controls-button-more").bind("click",function(){if(!isLoading(b)){nextPage(b,false)}})}}};nextPage=function(a,b){doPage(a,b,Math.min(a._tweetFeedConfig.paging._offset+a._tweetFeedConfig.paging._limit,a._tweetsCache.length))};prevPage=function(a,b){doPage(a,b,Math.max(0,a._tweetFeedConfig.paging._offset-a._tweetFeedConfig.paging._limit))};doPage=function(a,b,c){a._tweetFeedConfig.paging._offset=c;a._tweetFeedConfig._clearBeforePopulate=b;populateTweetFeed(a)};startAutorefresh=function(a){if(a._tweetFeedConfig.autorefresh.mode!="none"&&a._tweetFeedConfig.paging.mode!="prev-next"&&a._tweetFeedConfig.autorefresh.duration!=0&&(a._tweetFeedConfig.autorefresh.duration<0||(new Date).getTime()-a._tweetFeedConfig.autorefresh._startTime<=a._tweetFeedConfig.autorefresh.duration*1e3)){window.setTimeout(function(){processAutorefresh(a)},a._tweetFeedConfig.autorefresh.interval*1e3)}};stopAutorefresh=function(a){a._tweetFeedConfig.autorefresh.duration=0};processAutorefresh=function(b){if(b._tweetFeedConfig.autorefresh.duration!=0){getRateLimitedData(b,true,getFeedUrl(b,false),function(b,c){var d=(b.results||b).slice(0);d.reverse();a.each(d,function(a,b){if(!isTweetInCache(b,c)){if(c.tweetFilter(b,c)){c._autorefreshTweetsCache.unshift(b)}}});populateTweetFeed2(c)});startAutorefresh(b)}};startTimestampRefresh=function(a){if(a.tweetTimestampDecorator&&typeof a._tweetFeedConfig.showTimestamp=="object"&&a._tweetFeedConfig.showTimestamp.refreshInterval>0){window.setTimeout(function(){processTimestampRefresh(a)},a._tweetFeedConfig.showTimestamp.refreshInterval*1e3)}};processTimestampRefresh=function(b){a.each(b._tweetFeedElement.find(".jta-tweet-timestamp-link"),function(c,d){var e=a(d).attr("data-timestamp");a(d).html(b.tweetTimestampFormatter(e))});startTimestampRefresh(b)};isTweetInCache=function(a,b){var c=b._tweetsCache.length;for(var d=0;d<c;d++){if(a.id==b._tweetsCache[d].id){return true}}return false};showLoadingIndicator=function(b){if(b._tweetFeedElement&&b.loadingDecorator&&!b._loadingIndicatorElement){b._loadingIndicatorElement=a(b.loadingDecorator(b));b.loadingIndicatorVisualizer(b._tweetFeedElement,b._loadingIndicatorElement,b,null);b._tweetFeedElement.scrollTop(1e6)}};hideLoadingIndicator=function(a,b){if(a._loadingIndicatorElement){a.loadingIndicatorVisualizer(null,a._loadingIndicatorElement,a,b);a._loadingIndicatorElement=null}else{if(b){b()}}};isLoading=function(a){return a._loadingIndicatorElement!=null};formatDate=function(a){return a.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i,"$1,$2$4$3")};validateRange=function(a,b,c){if(a<b)a=b;if(a>c)a=c;return a};showError=function(a,b){if(a.errorDecorator&&a._tweetFeedElement){a._tweetFeedElement.append(a.errorDecorator(b,a))}};getPagedTweets=function(a,b){a._tweetFeedConfig._recLevel=0;getRecPagedTweets(a,a._tweetFeedConfig.paging._offset,a._tweetFeedConfig.paging._limit,b)};getRecPagedTweets=function(b,c,d,e){++b._tweetFeedConfig._recLevel;if(c+d<=b._tweetsCache.length||b._tweetFeedConfig._recLevel>3||b._tweetFeedConfig._noData){if(c+d>b._tweetsCache.length){d=Math.max(0,b._tweetsCache.length-c)}var f=[];for(var g=0;g<d;g++){f[g]=b._tweetsCache[c+g]}e(f,b)}else{++b._tweetFeedConfig._pageParam;getRateLimitedData(b,false,getFeedUrl(b,true),function(b,f){var g=b.results||b;if(g.length==0){f._tweetFeedConfig._noData=true}else{a.each(g,function(a,b){if(b.id_str){b.id=b.id_str}if(b.in_reply_to_status_id_str){b.in_reply_to_status_id=b.in_reply_to_status_id_str}if(!f._tweetFeedConfig._maxId){f._tweetFeedConfig._maxId=b.id}if(f.tweetFilter(b,f)){f._tweetsCache.push(b)}})}getRecPagedTweets(f,c,d,e)})}};getRateLimitedData=function(a,b,c,d){getRateLimit(a,function(e){if(e&&e.remaining_hits<=0){a._stats.rateLimitPreventionCount++;hideLoadingIndicator(a,null);return}getData(a,b,c,d)})};getData=function(b,c,d,e){b._stats.dataRequestCount++;if(!b.onDataRequestHandler(b._stats,b)){hideLoadingIndicator(b,null);return}if(!c){showLoadingIndicator(b)}a.getJSON(d,function(a){if(a.error){showError(b,a.error)}else{e(a,b)}})};getRateLimit=function(b,c){a.getJSON("http://api.twitter.com/1/account/rate_limit_status.json?callback=?",function(a){b._stats.rateLimit=a;b.onRateLimitDataHandler(b._stats,b);c(a)})}})(jQuery)
