if(!window.console||!console.firebug){var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];window.console={};for(var i=0;i ").text(A).html().replace(/\"/gi,"""):A}function unh(A){return A?A.replace(/&(amp;)+/g,"&").replace(/&[a-z]+;/gi,function(B){if(unh.HTML_ESCAPE_TOKENS[B]){return unh.HTML_ESCAPE_TOKENS[B]}return B}):A}window.unh.HTML_ESCAPE_TOKENS={"<":"<",">":">",""":'"'};var DEBUG=false;$.extend({log:function(A){if(window.console){console.log(A)}},debug:function(A){if(DEBUG){console.log(A)}},inspect:function(B){var A="{\n";for(var C in B){A+="\t"+C+": "+B[C]+"\n"}A+="}";console.log(A);return A}});(function(){if(document.all){if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){var A=new Number(RegExp.$1);if(A>=8){$.browser.msie8=true}else{if(A>=7){$.browser.msie7=true}else{$.browser.msie6=true}}}}})();if(!window.twttr){var _tmp={};var twttr=(function(){var rtn={timeouts:{},processJson:function(json){if(typeof (json)=="object"){var evals=[];$.each(json,function(selector,content){var c=selector.charAt(0);if(c=="$"){evals.push(content)}else{if(c=="!"){var notification=window[selector.substring(1)+"Notification"];if(notification){(new notification()).setMessage(content).show()}}else{var contentPadded="
"+content+"
";var $content=$(selector,$(contentPadded));if($content.length==1){$(selector).replaceWith($content)}else{$(selector).html(content)}$(selector).show()}}});$.each(evals,function(index,js){if(js){eval(js)}})}},truncateToHeight:function(txt,$textContainer,$container,height,opts){if(!opts){opts={}}if(!opts.minlength){opts.minlength=0}if(opts.minlength&&(txt.length=0&&$container.height()>height){$textContainer.text(curr=curr.substring(0,curr.length-1)+"...");return curr}}$textContainer.text(curr);return curr},googleAnalytics:function(trackid){if(window.pageTracker){window.pageTracker._trackEvent("Ajax","refresh",trackid,null)}},trackPageView:function(action,query,suffix){if(window.pageTracker){var analyticsAction;if(action){analyticsAction=action.toString();if(query){analyticsAction="/search/tweets/"+encodeURIComponent(h(page.query))}if(suffix){analyticsAction=analyticsAction+suffix}window.pageTracker._trackPageview(analyticsAction)}else{window.pageTracker._trackPageview()}}},fadeAndReplace:function(selector,content){$(selector).fadeOut("medium",function(){$(selector).html(content)});$(selector).fadeIn("medium")},error:function(msg){alert(msg?msg:_("Whoops! Something went wrong. Please refresh the page and try again!"))},loading:function(){$("#loader").fadeIn(200)},loaded:function(){$("#loader").fadeOut(200)},updateLocation:function(href){if(href){document.location.hash=href.replace(/^https?:\/\/.+?\//,"").replace(/#/gi,"%23").replace(/\s/gi,"+")}},NON_CHAR_KEY_CODES:[8,9,16,17,18,19,20,27,33,34,35,36,37,38,39,40,45,46,91,92,93],isNonCharKeyCode:function(event){return $.inArray(event.keyCode,twttr.NON_CHAR_KEY_CODES)!=-1||((event.ctrlKey||event.metaKey)&&$.inArray(event.keyCode,[67,88])!=-1)}};return rtn})()}$.fn.isLoading=function(){$(this).addClass("loading")};$.fn.isLoaded=function(){$(this).removeClass("loading")};$.fn.replace_text=function(B,A){$(this).html($(this).html().replace(B,A))};var pluralize=function(C,B,A){return C==1?B:A};var setDocumentTitle=function(A){document.title=unh(A)||""};var sessionUserIsPageUser=function(){try{return $('meta[name="session-user-screen_name"]:first').get(0).content==$('meta[name="page-user-screen_name"]:first').get(0).content}catch(A){return false}};var updateCount=function(A,E){try{var D=$(A);var C=parseInt(D.html());D.html(C+=E);return C}catch(B){return false}};var updateFollowingCount=function(A){return updateCount("#following_count",A)};var updateFollowersCount=function(A){return updateCount("#follower_count",A)};$.fn.focusEnd=function(){return this.each(function(){var A=this;if(A.style.display!="none"){if($.browser.msie){A.focus();var B=A.createTextRange();B.collapse(false);B.select()}else{A.setSelectionRange(A.value.length,A.value.length);A.focus()}}})};$.fn.focusFirstTextField=function(){return this.find("input[type=text]:visible:enabled:first").focus().length>0},$.fn.focusFirstTextArea=function(){return this.find("textarea:visible:enabled:first").focus().length>0};$.fn.focusFirstTextElement=function(){return this.focusFirstTextField()||this.focusFirstTextArea()};$.fn.maxLength=function(A){return this.each(function(){$(this).keydown(function(B){return this.value.length<=A||twttr.isNonCharKeyCode(B)})})};$.fn.isSelectAll=function(A){return this.each(function(){var B=$(this);if(typeof (A)=="string"){var D=$(A).find("input[type=checkbox]")}else{var D=A}function C(){var E=true;D.each(function(){if(!this.checked){E=false;return false}});B.get(0).checked=E}B.click(function(){var E=B.get(0).checked;D.each(function(){this.checked=E});$(this).trigger("select-all-changed",E)});D.click(function(){C();$(this).trigger("checkbox-changed",this.checked)})})};$.fn.isUpdateForm=function(){return this.each(function(){var K=$(this);var F=K.find("textarea").isCharCounter();var A=K.find("input[type=submit]");var B=K.find("label.doing");var G=K.find(".char-counter");var E=/^\s*@(\w+)\W+/;var D=/^\s*[dD][mM]?\s+(?:(\w+)\W+)?/;function J(){var L=F.val();if(L.length>140){alert(_("That update is over 140 characters!"));return false}else{if(L.replace(/s\*/g,"")==""){return false}else{A.attr("disabled","disabled");return true}}}function H(L){A.removeAttr("disabled","disabled");var M=L.text;if(L.messageForFlash){(new ShortNotification()).setMessage(L.messageForFlash).show()}else{if($("body").attr("id")!="home"){(new ShortNotification()).setMessage(_("Your status has been updated!")).show()}else{if(L.status_li){$("#timeline tr.hentry:first").removeClass("latest-status");$.Timeline.prepend(L.status_li)}}$("#update_count").fadeOut("medium",function(){$("#update_count").html(L.status_count).fadeIn("medium")});if(L.latest_status){$("#latest_status").html(L.latest_status).isCurrentStatus(true)}}F.val("").focusEnd();$("#in_reply_to_status_id").val("");$("#in_reply_to").val("");C("");F.trigger("change");G.removeClass("loading");if(document.all){G.text("140")}else{G.css("color","#ccc")}}function C(M){var L;if(L=M.match(D)){B.html(L[1]?_("Direct message %{person}:",{person:L[1]}):_("Direct message:"));A.val(_("send"))}else{if(L=M.match(E)){B.html(_("Reply to %{screen_name}:",{screen_name:L[1]}));A.val(_("reply"))}else{B.html(_("What are you doing?"));A.val(_("update"))}}}F.bind("keyup blur focus",function(){C($(this).val())});K.submit(function(){if(J()){twttr.googleAnalytics("/status/update/refresh");var Q=F.val();var P={authenticity_token:twttr.form_authenticity_token,status:Q,twttr:true};var M=window.location.href;if($("body").attr("id")=="home"&&((M.indexOf("page=")==-1)||M.match(/page=1(?!\d)/))){P.return_rendered_status=true}var L=$("#in_reply_to_status_id").val();var O;if(L&&(O=Q.match(E))){if(O[1]==$("#in_reply_to").val()){P.in_reply_to_status_id=L}}var N=$("#source").val();if(N){P.source=N}$.ajax({type:"POST",dataType:"json",url:"/status/update",data:P,beforeSend:function(){G.addClass("loading");if(document.all){G.html(" ")}else{G.css("color","transparent")}},success:H})}return false});try{F.focusEnd()}catch(I){}})};$.fn.isDirectMessageForm=function(){return this.each(function(){var L=$(this);var D=L.find("textarea").isCharCounter();var B=/^\s*[dD][mM]?\s+([A-Za-z0-9]{1,20})[^A-Za-z0-9]/;var F=L.find("select");var A=L.find("#dm-submit");var E=L.find(".char-counter");var G="";L.find("input[type=submit]").attr("disabled","disabled").addClass("disabled");try{D.focusEnd()}catch(I){}function C(N){if(F.val()){return }if((matches=N.match(B))&&matches[1]&&(G!=matches[1])){var M=true;F.find("option").each(function(){if(this.innerHTML.toLowerCase()==matches[1].toLowerCase()){F.val(this.value);M=false;return false}});if(M){F.append(_('%{screen_name} ',{screen_name:matches[1]}));F.val(matches[1])}G=matches[1]}}A.click(function(M){var P=D.val();var N=P.match(B);var O=F.find("option[value="+F.val()+"]");if(N&&N[1]&&N[1].toLowerCase()==O.text().toLowerCase()){D.val(P.replace(B,""))}return true});F.change(function(M){D.trigger("update",M)});D.bind("keyup blur focus",function(M){C($(this).val());D.trigger("update",M)});function H(M){(new ShortNotification()).setMessage(M.messageForFlash).show();if($("body").attr("id")=="sent"){$.Timeline.prepend(M.direct_message_li)}D.val("");F.val("");G="";D.trigger("change");E.removeClass("loading");if(document.all){E.text("140")}else{E.css("color","#ccc")}}if(F.length>0){function J(){if(F.length&&(F.find("option").length==0)){$.ajax({type:"GET",dataType:"json",url:"/direct_messages/recipients_list",data:{twttr:true},success:function(N){if(N){var M=[];$.each(N,function(){var O=this;if((O.length>1)&&O[0]&&O[1]){M.push(''+O[1]+" ")}});F.html(' '+M.join(""))}},error:function(M){alert("error: "+M)}})}}var K=$("body").attr("id");if(K=="direct_messages"||K=="inbox"||K=="sent"){J()}L.bind("loadrecipients",null,function(M){J()});L.submit(function(){twttr.googleAnalytics("/direct_messages/create/refresh");var N=D.val();var M={authenticity_token:twttr.form_authenticity_token,text:N,"user[id]":F.val(),twttr:true};$.ajax({type:"POST",dataType:"json",url:"/direct_messages/create",data:M,beforeSend:function(){E.addClass("loading");if(document.all){E.text("")}else{E.css("color","transparent")}},success:H});return false})}})};$.fn.isDMTabLink=function(){return this.click(function(){$("body").attr("id",$(this).parent("li").attr("id").replace("_tab",""))})};$.fn.isCharCounter=function(){return this.each(function(){var A=true;var F=$(this);var J=F.parents("form");var E=J.find(".char-counter");var H=J.find("input[type=submit]");var D=J.find("select");function C(){H.attr("disabled","disabled").addClass("disabled");A=true}function G(){if(A){H.removeAttr("disabled").removeClass("disabled");A=false}}function B(){var L=F.val();var K=L.length;E.html(""+(140-K));if(K<=0){E.css("color","#cccccc");C()}else{if(K<=140&&(D.length==0||D.val())){G()}else{C()}if(K>130){E.css("color","#d40d12")}else{if(K>120){E.css("color","#5c0002")}else{E.css("color","#cccccc")}}}}var I="blur focus change "+($.browser.mozilla?"paste input":"keyup");F.bind(I,function(K){B()});D.change(function(K){B()});F.focus()})};$.fn.isCurrentStatus=function(A){return this.each(function(){var F=$(this);var C=F.find("#latest_text");var E=C.find(".status-text");var D=$(this).parent("#currently");var H=D.find("strong");$("#latest_text_full, #latest_text").click(function(){$("#latest_text_full, #latest_text").toggle()});var G=E.css("color");C.css("color","transparent");var B=$("#latest_text_full .status-text").text();twttr.truncateToHeight(B,$("#latest_text .status-text"),$("#latest_text"),40,{minlength:60});C.css("color",G);if(A){if(D.css("visibility")=="hidden"){D.css("visibility","visible")}var I=D.find("span, strong").animate({color:"#333333"},500);clearTimeout(twttr.timeouts.latest_status_timeout);twttr.timeouts.latest_status_timeout=setTimeout(function(){I.animate({color:G},1500)},1500)}})};function initializeTimeline(){$("#timeline").Timeline()}function getListItemFromChild(A){return A.parents(".hentry:first")}function getStatusIdFromListItem(B){var A=/status_(.*)/i.exec(B.attr("id"));return(A)?A[1]:null}function getScreenNameFromListItem(B){var A=/u-([A-Za-z0-9_]+)/i.exec(B.attr("class"));return(A)?A[1]:null}function getShareIdFromListItem(B){var A=/(.)* s-([\d]+)(.)*/i.exec(B.attr("class"));return(A)?A[2]:getStatusIdFromListItem(B)}(function(){$(document).ready(function(){$().Page();initializeTimeline();$("#pagination #more").isMoreButton()});$.fn.Page=function(){var A=$('meta[name="session-user-screen_name"]:first').get(0);var C=$('meta[name="page-user-screen_name"]:first').get(0);var B=A&&C&&A.content==C.content;if(!page){page={}}page=$.extend(page,{timeline:null,sessionUserScreenName:(A?A.content:null),pageUserScreenName:(C?C.content:null),loggedIn:$('meta[name="session-loggedin"][content="y"]').length>0,hideUnfavorited:B})};$.fn.Timeline=function(){page.timeline=$(this);return this.each(function(){var A=$(this);var B={};$.Timeline.settings=$.extend({},$.Timeline.defaults);settings=$.extend($.Timeline.settings,page);var C=A.find(".hentry");if(settings.loggedIn){$.each($.Timeline.actions.tweet,function(){this.apply(C,[settings])})}})};$.Timeline={defaults:{timeline:$("#timeline")},prepend:function(A){$.Timeline.settings.timeline.prepend(A)},append:function(A){$.Timeline.settings.timeline.append(A)},actions:{tweet:{isTweet:function(A){return this.livequery(function(){var B=$(this).find("a.hashtag");B.isSearchLink("processHashtagLink")})},isHoverable:function(A){if($("body.ie,body.ie6").get(0)){return this.livequery(function(){var B=$(this);B.hover(function(){console.log(B);B.addClass("hover")},function(){B.removeClass("hover")})})}},isFavoriteable:function(A){return this.find(".fav-action").livequery(function(){var B=$(this);B.click(function(){var C=B.parents(".hentry:first");var F=C.attr("id").replace(/status_/,"");var E=B.hasClass("fav");var D=E?"destroy":"create";twttr.googleAnalytics("/favorites/"+D+"/refresh/"+F);$.ajax({type:"POST",url:"/favorites/"+D+"/"+F,data:{authenticity_token:twttr.form_authenticity_token},beforeSend:function(){B.attr("title","").removeClass(E?"fav":"non-fav").addClass("fav-throb")},success:function(){if($("body#favourings").hasClass("favourings")&&A.hideUnfavorited){C.fadeOut(500,function(){C.remove()})}else{B.attr("title",(E?"favorite":"un-favorite")+" this update").removeClass("fav-throb").addClass(E?"non-fav":"fav")}}});return false})})},isReplyable:function(A){return this.find(".reply").livequery(function(){var B=$(this);B.click(function(){var E=B.parents(".hentry:first");var H=E.attr("id").replace(/status_/,"");var C=E.attr("class").match(/u-([A-Za-z0-9_]+)/);var D=C[1];if(!D){alert(_("Whoops! Something went wrong. Please refresh the page and try again!"));return }if(E.hasClass("direct_message")){var G=$("#text");twttr.googleAnalytics("/direct_messages/reply/"+D+"/"+H);var F=$("#direct_message_user_id");if(!F.find("option[text='"+D+"']").attr("selected",true).length){F.append(''+D+" ")}G.trigger("update");$("#text").focusEnd()}else{if(E.hasClass("status")){var G=$("#status");twttr.googleAnalytics("/reply/"+D+"/"+H);G.val("@"+D+" "+G.val().replace(RegExp("@"+D+" ?","i"),"")).trigger("update");$("#status").focusEnd();$("#in_reply_to_status_id").val(H);$("#in_reply_to").val(D);window.scroll(0,0)}}window.scroll(0,0);return false})})},isShareable:function(A){return this.find(".share-link").livequery(function(){var B=$(this);B.click(function(D){var C="yes, share it";var E="Share with your followers?";var F=B.parent().offset();(new InlineForm(E,C)).show(B,parseInt(F.top),parseInt(F.left));D.preventDefault()})})},isDeleteable:function(A){return this.find(".del").livequery(function(){var B=$(this);B.click(function(){var C=B.parents(".hentry:first");var F;var E=C.hasClass("latest-status");var D;if(C.hasClass("direct_message")){F=C.attr("id").replace(/direct_message_/,"");D="/direct_messages/destroy"}else{if(C.hasClass("status")){F=C.attr("id").replace(/status_/,"");D="/status/destroy"}}if(confirm("Sure you want to delete this update? There is NO undo!")){twttr.googleAnalytics(D+"/refresh/"+F);$.ajax({type:"POST",url:D+"/"+F,data:{authenticity_token:twttr.form_authenticity_token,latest_status:E},dataType:(D=="/status/destroy"?"json":null),beforeSend:function(){B.attr("title","").removeClass("del").addClass("del-throb")},success:function(G){var H=C.parents(".conversation");var I=H.get(0)?H:C;I.fadeOut(500,function(){I.remove();if(D=="/status/destroy"){if(E){twttr.processJson(G);updateLatest()}}})}})}return false})})}}}}})();(function(){$.fn.isMoreButton=function(){return this.livequery(function(){$(this).click(function(){var B=$(this);B.blur();var A=B.attr("href");$.ajax({type:"GET",url:A,dataType:"json",beforeSend:function(){$("#more").addClass("loading").html("")},success:function(C){$("#timeline").append($(C["#timeline"]).find(".hentry"));$("#pagination").html(C["#pagination"]);if(window.onPageChange){onPageChange()}},error:function(){alert(_("Whoops! Something went wrong. Please try refreshing the page."))}});return false})})}})();$(function(){var request=function(data,success){return function(){var self=this;$this=$(this);var notification=(new ProgressNotification()).setProgressMessage($this.attr("progress")).setCompletedMessage($this.attr("completed"));$.ajax({type:$this.attr("method"),dataType:"json",url:$this.attr("href")||$this.attr("action"),data:data.apply(self),success:function(){notification.done();if(success){success.apply(self)}},beforeSend:function(){twttr.loading();notification.show()},complete:twttr.loaded});return false}};$("form.restful").livequery("submit",request(function(){return $(this).serializeArray()},function(){$(this).trigger("submitted")}));$("a.restful").livequery("click",request(function(){return eval("("+$(this).attr("data")+")")}))});function updateLatest(){var A=$("#latest_status");if(A.length){A.isCurrentStatus(true)}$("#timeline li:first").addClass("latest-status")}function setTitleAndHeading(C){var J=$("#timeline_heading h1");var C=C||$("body").attr("id");var A=h(page.query);var D=page.user_screenname?page.user_screenname:$('meta[name="session-user-screen_name"]:first').get(0).content;if(!twttr.titles_and_headings){var H={user:D,name:page.user_fullname};twttr.titles_and_headings={home:{title:_("Home"),heading:_("Home")},replies:{title:("@"+D),heading:_("Updates mentioning @%{user}",H)},favorites:{title:_("Your Favorites"),heading:_("Your Favorites")},inbox:{title:_("Direct Messages"),heading:_("Direct messages sent only to you")},direct_messages:{title:_("Direct Messages"),heading:_("Direct messages sent only to you")},sent:{title:_("Sent Direct Messages"),heading:_("Direct messages you've sent")},shared_with:{title:_("Shares",H),heading:_("Shares",H)},profile_favorites:{title:_("%{user}'s Favorites",H),heading:_("%{user}'s Favorites",H)},profile:{title:_("%{name} (%{user}) on Twitter",H),heading:null}}}var E;if(C=="search"){E={title:_("Search - %{query}",{query:page.query})};var B=$("#side #saved_searches ul.sidebar-menu li.active");var I;if(B.length){var F=B.attr("id").replace("ss_","");I=''+_("Remove this saved search")+" "}else{I=''+_("Save this search")}I=""+I+" ";if(page.searchResults){E.heading=I+_("Real-time results for %{query} ",{query:A})}else{E.heading=I+_("No results for %{query} ",{query:A})}}else{E=twttr.titles_and_headings[C]}if(E){var G=(C=="profile")?"":"Twitter / ";setDocumentTitle(G+E.title);if(E.heading){J.html(E.heading);J.parent("div").show()}else{J.parent("div").hide()}if(C=="search"){J.find(".save-search-link").isSaveSearchLink().end().find(".delete-search-link").isRemoveSearchLink()}}}var searchSummize=function(E,B,F,A){page.query=E;var D=$("body#search #timeline :first-child").attr("id");if(D&&page.retainTimeline){page.maxId=D.substring(7)}else{page.maxId=null}var C={q:page.query,rpp:20,maxId:page.maxId,callback:F||"processSummize",layout:"none"};if(A){C.page=A}$("#side #q").val(E);B.trigger("loading");$.ajax({url:page.summizeSearchUrl,data:C,dataType:"script",cache:false,complete:function(){$("#side #primary_nav li").removeClass("active");$("body").attr("id","search");var G=$("#side li.active a.search-link").parents("div#trends, div#saved_searches");var H=G.length==0?$("#side div#custom_search.active").attr("id"):G.attr("id");twttr.trackPageView($("body").attr("id"),(page.query&&page.query.length>0?page.query:null),"/"+H+(!page.retainTimeline?"/ajax":"/ajax/more"));B.trigger("loaded");page.retainTimeline=null}})};var processSummize=function(B){var G=$(B);var E=$("#timeline");var J=(page.query!="");$("body").attr("id","search");var K=1;$pageBtn=G.find(".paginator a.next");var D;if($pageBtn.length){D=$pageBtn.attr("href");D.match(/\?.*page=([0-9]+)/gi);K=RegExp.$1;K=K?parseInt(K):1}var C=[];if(J){if(!page.retainTimeline){$("#timeline").empty();$("#pagination").empty();$("#content .no-results").remove()}C=renderResultsFromSummize(G,E)}$("#container, #side_base").show();E.find(".status-body a,.vcard a").each(function(){var M=$(this);if(M.attr("href").match(/^\/search\?q=([^&]+)/)){M.removeAttr("target");var L=unescape(RegExp.$1);M.attr("title",L);M.isSearchLink(L.match(/^#/)?"processHashtagLink":"processInResultsLink")}});if(page.searchResults=(C.length>0&&J)){enfavoriteSummize(C);page.maxId=C[0];if(D){$("#pagination").empty().html(''+_("more")+" ").find("a").isSearchMoreButton()}}else{var H=["Try a more general search.","Try using different words."];var I=''+_("Suggestions:")+"
";for(var F=0;F"+_(H[F])+"")}I+=" ";$("#timeline_heading").after(I)}twttr.updateLocation("search?q="+escape(page.query));initializeSidebar();var A=$("#sidebar_search_q");if(A.val()!=page.query){A.val(page.query);A.css("color","#000")}onPageChange();$("#side #rssfeed a.search-rss").attr("href","http://search.twitter.com/search.atom?q="+h(escape(page.query)));summizeRefresh()};var callbacks=["pageLoadSearch","processSearchLink","processTrendLink","processSavedSearchLink","processSearchForm","processHashtagLink","processInResultsLink","processSearchMore","processSearchRefresh"];$.each(callbacks,function(){window[this]=window.processSummize});function renderResultsFromSummize(B,A){var C=[];B.find(".result").each(function(){var H=$(this);H.find(".location,.thread,.to_av,p.clearleft,.expand,#share").remove();var E=$(H.find(".avatar").get(0));E.replaceWith(''+E.html()+" ");var J=$(H.find(".info").get(0));var K,F,D;J.find("a.lit").each(function(){D=$(this).attr("href");var N=D.match(/\/(\w+)\/statuses\/(\d+)/);K=N[2];C.push(K);F=N[1]});var G=J.find(".source").remove();J.find("a").remove();J.html(''+J.html()+" ");J.append(G);var M=''+J.html().replace(/\u00B7/g,"")+" ";J.remove();var L=$(H.find(".msg").get(0));L.replaceWith(''+($.browser.msie6?' ':"")+L.html().replace(/a>\s*:\s* ");var I=H.html();I+=' ';A.append(''+I+" ")});return C}function enfavoriteSummize(A){if(page.loggedIn&&A.length>0){$timeline=$("#timeline");$.ajax({type:"POST",dataType:"json",url:"/favourings/intersect_for_search",data:{authenticity_token:twttr.form_authenticity_token,"status_id[]":A,twttr:true},beforeSend:null,success:function(B){$.map(B,function(C){$timeline.find("#status_"+C+" .non-fav").addClass("fav").removeClass("non-fav")})},complete:null})}}$.fn.isSaveSearchLink=function(){return this.each(function(){var A=$(this);var B=$("#saved_searches");var C=B.find("ul.sidebar-menu");A.click(function(){if(C.find("li").length>=10){(new InfoNotification()).setMessage(_("You can only save ten searches. To remove a saved search, select the search and click remove this saved search .")).show();return false}var E=A.attr("title");var D=$(''+h(E)+" ");D.find("a").isSearchLink("processSavedSearchLink");D.fadeOut(1,function(){C.append(D);D.fadeIn(100)});if(B.hasClass("collapsed")){B.trigger("expand")}B.fadeIn();$("#side ul.sidebar-menu li").removeClass("active");$("#side #custom_search").removeClass("active");D.addClass("active");$.ajax({type:"POST",dataType:"json",url:"/saved_searches/create",data:{q:E,authenticity_token:twttr.form_authenticity_token,twttr:true},beforeSend:function(){A.replaceWith(''+_("Save this search")+" ")},success:function(F){D.attr("id","ss_"+F.id);setTitleAndHeading("search")},error:function(F){(new InfoNotification()).setMessage(F.responseText).show();D.remove()}});return false})})};function summizeRefresh(){if(page.summizeRefresh||page.darkmodeSummizeRefresh){return }page.newResults=null;page.summizeRefresh=new Occasionally(function(){var A=false;$.ajax({dataType:"script",url:page.summizeSearchUrl,data:{q:page.query,since_id:page.maxId,refresh:true,callback:"processSummizeRefresh"},cache:false,callback:null})},15000,function(){return page.newResults});page.summizeRefresh.start()}function processSummizeRefresh(A){if(unescape(A.query).replace(/\+/g," ")==page.query&&A.total){page.maxId=A.max_id;page.summizeRefreshResults=(page.summizeRefreshResults||0)+A.total;$("#results_update").replace_text(/results? /,pluralize(page.summizeRefreshResults,"result ","results "));$("#new_results_count").html(page.summizeRefreshResults);$("#results_update:hidden").slideDown();$("#search_refresh_link").attr("title",page.query).attr("href","/search?q="+encodeURIComponent(page.query)).isSearchLink("processSearchRefresh");page.newResults=true}else{page.newResults=false}}$.fn.isRemoveSearchLink=function(){return this.each(function(){var A=$(this);var C=A.attr("title");var B=A.attr("href");A.click(function(){var D=$("#side #saved_searches li a[title='"+C+"']").parent("li");D.fadeOut(100,function(){D.remove();var E=$("#saved_searches ul.sidebar-menu a");if(E.length==0){$("#saved_searches").hide()}setTitleAndHeading("search");$("#side #custom_search").addClass("active")});$.ajax({type:"POST",url:B,data:{authenticity_token:twttr.form_authenticity_token,twttr:true},beforeSend:function(){A.replaceWith(''+_("Remove this saved search")+" ")},error:function(){(new InfoNotification()).setMessage(_("Whoops! Something went wrong. Please refresh the page and try again!")).show()}});return false})})};$.fn.isSearchMoreButton=function(){return this.each(function(){var A=$(this);A.click(function(){A.blur();var C=A.attr("href");C.match(/\?.*page=([0-9]+)/gi);var B=RegExp.$1;page.retainTimeline=true;searchSummize(page.query,A,"processSearchMore",B);A.addClass("loading").html("");return false})})};$(document).ready(function(){$("#tweet_search_submit").click(function(){$("#tweet_search").submit()});if($("body").attr("id")=="search"){onCondition(function(){return page.summizeResults},function(){processSummize(page.summizeResults)})}});function onPageChange(A){var B=$("body").attr("id");setTitleAndHeading(B);if(!A){if(page.summizeRefresh){page.summizeRefresh.stop();page.summizeRefresh=null;page.summizeRefreshResults=null}$("#results_update").hide();$(".no-results").remove();$("#new_results_count").html("0")}twttr.trackPageView(B,(page.query&&page.query.length>0?page.query:null),A?null:"/ajax")}function initializePage(A){if("home,search".indexOf(A)==-1){twttr.updateLocation(A)}initializeSidebar();$(".sidebar-menu a, ul#dm_tabs a").isSidebarTab();$("#side form#sidebar_search").isSearchForm();$("#side .collapsible").isCollapsibleMenu();onPageChange(true);$(".in-page-link").isInPageLink();$(".saved-search-links li a").isSearchLink("processSavedSearchLink");$(".trends-links li a").isSearchLink("processTrendLink");$("#dm_tabs a").isDMTabLink();$(".bulletin").isBulletin()}function initializeSidebar(){if($("#side ul.sidebar-menu li.active").length==0){var C=$("body").attr("id");var A=null;if(C=="search"){C=page.query;if(C){var B=$("#side ul.sidebar-menu li a[title='"+C+"']");if(B.length){A=B.parent("li")}else{$("#side #custom_search").addClass("active")}}}else{if(C){if(C=="sent"||C=="inbox"){C="direct_messages"}A=$("#side ul.sidebar-menu li#"+C+"_tab")}}if(A&&A.length){$(A.get(0)).addClass("active")}}}$.fn.isCollapsibleMenu=function(){function A(){var B=[];$("#side .collapsible").each(function(){var C=$(this);var E=C.find("h2.sidebar-title").attr("id");if(E){E=E.replace("_menu","")}else{return true}var D=C.hasClass("collapsed")?"C":"O";B.push(E+D)});$.cookie("menus",B.join("_"))}return this.each(function(){var D=$(this);var B=D.find("h2.sidebar-title");function F(G){$.ajax({type:"GET",url:G,dataType:"html",beforeSend:function(){D.addClass("loading")},success:function(H){D.find(".sidebar-menu").remove();B.after(H);C()},complete:function(){D.removeClass("loading")}})}function C(){var G=D.find(".sidebar-menu");D.find("#friends_view_all").fadeIn();G.slideDown(100,function(){D.removeClass("collapsed");A()})}function E(){var G=D.find(".sidebar-menu");D.find("a.xref").fadeOut(100);D.find("div#friends_view_all").fadeOut(100);G.slideUp(100,function(){D.addClass("collapsed");A()})}D.bind("expand",function(){C()});D.bind("collapse",function(){E()});B.click(function(H){if(H.target.nodeName.toLowerCase()=="a"){return true}var G=D.find("a.fetch-contents");if(D.hasClass("collapsed")){D.find("a.xref").fadeIn(100);if(G.length){F(G.attr("href"));G.remove()}else{C()}}else{E()}})})};$.fn.isSidebarTab=function(){return this.each(function(){var A=$(this);A.click(function(){if(A.parents("#side").length>0){$(window).scrollTop(0);$("#side ul.sidebar-menu li").removeClass("active");$("#side #custom_search").removeClass("active");A.parent("li").addClass("active")}}).bind("loading",null,function(B){A.parent("li").addClass("loading")}).bind("loaded",null,function(B){A.parent("li").removeClass("loading")})})};$.fn.isInPageLink=function(){return this.each(function(){var A=$(this);var C=A.parent("li");var B=C.attr("new_id")||C.attr("id").replace("_tab","");A.click(function(){if($.browser.msie){this.hideFocus=true}var D=A.attr("href");page.query="";$.ajax({type:"GET",url:D,dataType:"json",beforeSend:function(){A.trigger("loading")},success:function(E){twttr.processJson(E);twttr.updateLocation(D);$("body").attr("id",B);if(B=="direct_messages"||B=="inbox"||B=="sent"){$("#direct_message_form").trigger("loadrecipients")}},complete:function(){$("#sidebar_search_q").val("").blur();onPageChange();$("body").addClass("replyable");initializeTimeline();A.trigger("loaded")}});return false})})};$.fn.isSearchLink=function(A){return this.each(function(){var B=$(this);B.click(function(){if($.browser.msie){this.hideFocus=true}searchSummize(B.attr("title"),B,A);if(B.parents("#side").length>0){$("#side ul.sidebar-menu li").removeClass("active")}B.parent("li").addClass("active");return false})})};$.fn.isSearchForm=function(A){return this.each(function(){var C=$(this);var B=$(C.find('input[type="text"]')[0]);var D=C.find("#sidebar_search_submit");B.Watermark(_("Search")).focus(function(){B.select();return true});D.click(function(){C.submit()});C.submit(function(){var E=B.val();if(E!=""){D.addClass("loading");searchSummize(E,C,"processSearchForm")}$("#side ul.sidebar-menu li").removeClass("active");$("#side #custom_search").addClass("active");return false});C.bind("loaded",null,function(E){D.removeClass("loading")})})};$.fn.isBulletin=function(){return this.each(function(){var A=$(this);var B=A.find("a.close, a.hide");B.click(function(){A.fadeOut();return false})})};$.fn.isDeviceFailBulletin=function(){return this.each(function(){var A=$(this);var B=A.find("a.hide-fail-notice, a.close, a.hide");var C=B.attr("id").replace("hide_device_","");B.click(function(){$.ajax({type:"POST",dataType:"text",url:"/devices/update/"+C,data:{authenticity_token:twttr.form_authenticity_token,"device[fail_alert]":"0",twttr:true},success:function(D){if(D.match(/success/)){A.fadeOut(200)}else{twttr.error()}},beforeSend:null,complete:null});return false})})};$.fn.isBouncingEmailBulletin=function(){return this.each(function(){var A=$(this);A.find("a.close, a.hide").click(function(){$.ajax({type:"POST",dataType:"text",url:"/bouncers/reset",data:{authenticity_token:twttr.form_authenticity_token,twttr:true},beforeSend:null,complete:function(){(new InfoNotification()).setMessage(_("Your email notifications should resume shortly.")).show()}});return false})})};$.fn.isNotificationSetting=function(){return this.each(function(){var B=$(this);var A=B.attr("id").replace("notify_on_","").replace("notify_off_","");B.click(function(){var C=B.attr("value");$.ajax({type:"POST",dataType:"text",url:"/friends/"+C+"/"+A,data:{authenticity_token:twttr.form_authenticity_token,twttr:true},success:function(D){if(D.match(/success/)){$(".follow-control").trigger("refresh",["notify_"+(C=="follow"?"on":"off")])}else{twttr.error()}}})})})};$.fn.isNudgable=function(){return this.each(function(){var A=$(this);A.click(function(){var B=A.parents("form");B.find("input[name=authenticity_token]").val(twttr.form_authenticity_token);B.submit();return false})})};$.fn.isFollowControl=function(){return this.each(function(){var I=$(this);var H=I.parents(".follow-actions");var A=I.find(".follow-button");var B=H.attr("class").split(" ").pop();var E=H.attr("id").replace("follow_actions_","");var C=H.find("#follow-toggle");var G=H.find(".remove-button");var D=$("#flash");H.find(".notify-input").isNotificationSetting();function F(J){$.ajax({type:"GET",dataType:"json",url:"/account/refresh_follow_control/"+E,data:{action_taken:J},success:function(K){twttr.processJson(K);$(".follow-control").isFollowControl()}})}A.click(function(){$.ajax({type:"POST",dataType:"json",url:"/friendships/create/"+E,data:{authenticity_token:twttr.form_authenticity_token,twttr:true},success:function(J){if(J.result=="Bring"){twttr.error()}else{if(J.success){I.trigger("refresh",["followed"])}else{if(J.result!="242"){if(J.notice){var K=(new ErrorNotification());K.setMessage(J.notice);K.show()}else{twttr.error()}}}}},beforeSend:function(){$("#follow-flash").css("visibility","hidden");twttr.loading()},complete:twttr.loaded});return false});I.bind("refresh",function(J,K){F(K)});C.click(function(){$("#follow-flash").css("visibility","hidden");var J=H.find("#follow-details").toggle();if(J.css("display")=="block"){C.removeClass("closed").addClass("opened")}else{C.removeClass("opened").addClass("closed")}return false});G.click(function(){$.ajax({type:"POST",dataType:"json",url:"/friendships/destroy/"+E,data:{authenticity_token:twttr.form_authenticity_token,twttr:true},success:function(J){if(J.success){I.trigger("refresh",["removed"])}else{twttr.error()}}});return false})})};$.fn.isFollowRequestLinks=function(){return this.each(function(){var B=$(this);var D=B.hasClass("ifr-profile");var F=D?B.attr("id").replace("ifr_",""):"";var A=B.find("#accept_all_requests");var C=B.find("#deny_all_requests");function E(G){var H={decision:G,authenticity_token:twttr.form_authenticity_token};if(D){H.id=F;H.source="profile"}$.ajax({type:"POST",url:"/friend_requests/"+(D?"decision":"all"),dataType:"text",data:H,cache:false,success:function(I){if(I=="fail"){alert(_("Whoops! Something went wrong. Please refresh the page and try again!"))}else{if(D){B.fadeOut("medium",function(){B.html(I)});B.fadeIn("medium")}else{var J=window.location;uri=J.protocol+"//"+J.host+"/";window.location=uri}}}})}A.click(function(){E("accept");return false});C.click(function(){E("deny");return false})})};$.fn.isPasswordStrengthField=function(A,B){return this.each(function(){if(!A){return }if(!B){B={}}var H=$(this);var J=$(A);J.append(' ');var F=J.find(".pstrength-text");function E(K){J.children().each(function(){var L=$(this);if(L.hasClass("pstrength-text")){if(K){L.show()}else{L.hide()}}else{if(K){L.hide()}else{L.show()}}})}function I(K){var M=0;var L=B.minlength?B.minlength:6;if(K.length100){M=100}if(M<34){return{score:M,message:_("Weak"),className:"password-weak"}}if(M<50){return{score:M,message:_("Good"),className:"password-good"}}if(M<75){return{score:M,message:_("Strong"),className:"password-strong"}}return{score:M,message:_("Very Strong"),className:"password-verystrong"}}function D(L,O){var K="";for(var N=0;N0){var K=I(L);F.html(K.message);if(C(K.className)){J.addClass(K.className)}}}H.bind("show-password-meter",function(){J.show()});H.bind("hide-password-meter",function(){J.hide()});H.keyup(function(){G()});H.blur(function(){if(this.value.length==0){C();H.trigger("hide-password-meter")}});if(H.val()){G();J.show()}})};$.fn.isOAuthApplication=function(){return this.each(function(){var C=$(this);var B=C.attr("id").replace("oauth_application_","");var A=C.find(".revoke-access");A.click(function(){$.ajax({type:"POST",dataType:"json",url:"/oauth/revoke",data:{authenticity_token:twttr.form_authenticity_token,token:B,twttr:true},success:function(D){if(D.revoked){C.addClass("revoked")}else{C.removeClass("revoked")}A.text(D.label)}});return false})})};(function(){jQuery.inherits=function(A,C){function B(){}B.prototype=C.prototype;A.prototype=new B();A.prototype.constructor=A}})();(function(){jQuery.fn.equals=function(A){return this.get(0)==A.get(0)}})();(function(){jQuery.fn.hasParent=function(A){var B=false;this.parents().map(function(){if($(this).equals(A)){B=true}});return B}})();function Notification(B){this.$bar=jQuery('
');this.$barContainer=jQuery('
');this.$barContents=jQuery('
');this.$barBackground=jQuery('
');this.$message=jQuery('
');this.$bar.hide();this.$barBackground.hide();var A=this;this.$bar.click(function(C){A.removeAfterEvent(C)});this.className=B}Notification.SLIDE_SPEED_IN_MS=300;Notification.prototype.remove=function(){var A=this;this.slideUp(function(){A.$bar.remove();A.$barBackground.remove();window.clearTimeout(A.timeout)})};Notification.prototype.removeAfterEvent=function(B){var A=$(B.target);if(A.get(0).nodeName.toLowerCase()=="a"&&A.hasParent(this.$message)){return }this.remove()};Notification.prototype.setMessage=function(A){this.msg=A;return this};Notification.prototype.show=function(){this.$message.addClass(this.className).html(this.msg);this.$barContainer.append(this.$barBackground).append(this.$bar.append(this.$barContents.append(this.$message)));jQuery("#notifications").append(this.$barContainer);this.$barBackground.height(this.$bar.height());this.showBar();if(this.onShow){this.onShow()}return this};Notification.prototype.removeInMilliseconds=function(){var A=this;this.timeout=window.setTimeout(function(){A.remove()},A.timeoutInMilliseconds)};Notification.prototype.showBar=function(){this.$bar.show();this.$barBackground.show()};Notification.prototype.onShow=function(){this.removeInMilliseconds()};Notification.prototype.slideUp=function(A){this.$bar.slideUp(Notification.SLIDE_SPEED_IN_MS);this.$barBackground.slideUp(Notification.SLIDE_SPEED_IN_MS,A)};function ShortNotification(){Notification.call(this,"message-info");this.timeoutInMilliseconds=3000}jQuery.inherits(ShortNotification,Notification);ShortNotification.prototype.showBar=function(){this.$bar.slideDown(Notification.SLIDE_SPEED_IN_MS);this.$barBackground.slideDown(Notification.SLIDE_SPEED_IN_MS)};function InfoNotification(){Notification.call(this,"message-info");this.timeoutInMilliseconds=6000}jQuery.inherits(InfoNotification,Notification);InfoNotification.prototype.showBar=function(){this.$bar.slideDown(Notification.SLIDE_SPEED_IN_MS);this.$barBackground.slideDown(Notification.SLIDE_SPEED_IN_MS)};function ProgressNotification(){Notification.call(this,"message-progress");this.timeoutInMilliseconds=1000}jQuery.inherits(ProgressNotification,Notification);ProgressNotification.prototype.setProgressMessage=function(A){return this.setMessage(A)};ProgressNotification.prototype.setCompletedMessage=function(A){this.completedMsg=A;return this};ProgressNotification.prototype.onShow=function(){};ProgressNotification.prototype.cancel=function(){this.timeoutInMilliseconds=0;this.removeInMilliseconds()};ProgressNotification.prototype.done=function(){this.$message.addClass("message-progress-done").removeClass(this.className).html(this.completedMsg);this.removeInMilliseconds()};function ErrorNotification(){Notification.call(this,"message-error");this.timeoutInMilliseconds=12000}jQuery.inherits(ErrorNotification,Notification);(function(A){var B=new Array();A.Watermark={ShowAll:function(){for(var C=0;C0){A.each(F,function(G,H){if(A.inArray(H,D)<0){A.event.remove(H,E.type,E.fn)}})}}else{C.each(function(){E.fn.apply(this)});if(this.fn2&&F.length>0){A.each(F,function(G,H){if(A.inArray(H,D)<0){E.fn2.apply(H)}})}}}};A.extend(A.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if(A.livequery.running&&A.livequery.queue.length){var C=A.livequery.queue.length;while(C--){A.livequery.queries[A.livequery.queue.shift()].run()}}},pause:function(){A.livequery.running=false},play:function(){A.livequery.running=true;A.livequery.run()},registerPlugin:function(){A.each(arguments,function(D,E){if(!A.fn[E]){return }var C=A.fn[E];A.fn[E]=function(){var F=C.apply(this,arguments);A.livequery.run();return F}})},run:function(C){if(C!=undefined){if(A.inArray(C,A.livequery.queue)<0){A.livequery.queue.push(C)}}else{A.each(A.livequery.queries,function(D){if(A.inArray(D,A.livequery.queue)<0){A.livequery.queue.push(D)}})}if(A.livequery.timeout){clearTimeout(A.livequery.timeout)}A.livequery.timeout=setTimeout(A.livequery.checkQueue,20)},stop:function(C){if(C!=undefined){A.livequery.queries[C].stop()}else{A.each(A.livequery.queries,function(D){A.livequery.queries[D].stop()})}}});A.livequery.registerPlugin("append","prepend","after","before","wrap","attr","removeAttr","addClass","removeClass","toggleClass","empty","remove");A(function(){A.livequery.play()});var B=A.prototype.init;A.prototype.init=function(C,E){var D=B.apply(this,arguments);if(C&&C.selector){D.context=C.context,D.selector=C.selector}if(typeof C=="string"){D.context=E||document,D.selector=C}return D};A.prototype.init.prototype=A.prototype})(jQuery);$.fn.occasionally=function(C,A,B){return new Occasionally(C,A,B).start()};function Occasionally(C,A,B){this.job=C;this.decayCallback=B;this.interval=A;this.timesRun=0;this.timesDecayed=0;this.decayRate=1;this.decayMultiplier=1.25;this.decayDivisor=0.75}Occasionally.prototype.start=function(){this.stop();this.run()};Occasionally.prototype.stop=function(){if(this.worker){window.clearTimeout(this.worker)}};Occasionally.prototype.run=function(){this.decayRate=this.decayCallback()?1:this.decayRate*this.decayMultiplier;var A=this;this.worker=window.setTimeout(function(){A.execute()},this.interval*this.decayRate)};Occasionally.prototype.execute=function(){this.job();this.timesRun++;this.run()};