(function(e){if(typeof define==="function"&&define.amd)define(["jquery"],e);else e(jQuery)})(function(e){e.fn.tweet=function(t){function i(e,t){if(typeof e==="string"){var n=e;for(var r in t){var i=t[r];n=n.replace(new RegExp("{"+r+"}","g"),i===null?"":i)}return n}else return e(t)}function s(t,n){return function(){var r=[];this.each(function(){r.push(this.replace(t,n))});return e(r)}}function o(e){return e.replace(//g,"^>")}function u(e,t){return e.replace(r,function(e){var n=/^[a-z]+:/i.test(e)?e:"http://"+e;var r=e;for(var i=0;i'+o(r)+""})}function a(e){return Date.parse(e.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i,"$1,$2$4$3"))}function f(e){var t=function(e){return parseInt(e,10)};var n=new Date;var r=t((n.getTime()-e)/1e3);if(r<1)r=0;return{days:t(r/86400),hours:t(r/3600),minutes:t(r/60),seconds:t(r)}}function l(e){if(e.days>2)return"about "+e.days+" days ago";if(e.hours>24)return"about a day ago";if(e.hours>2)return"about "+e.hours+" hours ago";if(e.minutes>45)return"about an hour ago";if(e.minutes>2)return"about "+e.minutes+" minutes ago";if(e.seconds>1)return"about "+e.seconds+" seconds ago";return"just now"}function c(e){if(e.match(/^(@([A-Za-z0-9-_]+)) .*/i)){return n.auto_join_text_reply}else if(e.match(r)){return n.auto_join_text_url}else if(e.match(/^((\w+ed)|just) .*/im)){return n.auto_join_text_ed}else if(e.match(/^(\w*ing) .*/i)){return n.auto_join_text_ing}else{return n.auto_join_text_default}}function h(){var e="https:"==document.location.protocol?"https:":"http:";var t=n.fetch===null?n.count:n.fetch;var r="&include_entities=1&callback=?";if(n.list){return e+"//"+n.twitter_api_url+"/1/"+n.username[0]+"/lists/"+n.list+"/statuses.json?page="+n.page+"&per_page="+t+r}else if(n.favorites){return e+"//"+n.twitter_api_url+"/favorites/"+n.username[0]+".json?page="+n.page+"&count="+t+r}else if(n.query===null&&n.username.length==1){return e+"//"+n.twitter_api_url+"/1/statuses/user_timeline.json?screen_name="+n.username[0]+"&count="+t+(n.retweets?"&include_rts=1":"")+"&page="+n.page+r}else{var i=n.query||"from:"+n.username.join(" OR from:");return e+"//"+n.twitter_search_url+"/search.json?&q="+encodeURIComponent(i)+"&rpp="+t+"&page="+n.page+r}}function p(e,t){if(t){return"user"in e?e.user.profile_image_url_https:p(e,false).replace(/^http:\/\/[a-z0-9]{1,3}\.twimg\.com\//,"https://s3.amazonaws.com/twitter_production/")}else{return e.profile_image_url||e.user.profile_image_url}}function d(t){var r={};r.item=t;r.source=t.source;r.screen_name=t.from_user||t.user.screen_name;r.name=t.from_user_name||t.user.name;r.avatar_size=n.avatar_size;r.avatar_url=p(t,document.location.protocol==="https:");r.retweet=typeof t.retweeted_status!="undefined";r.tweet_time=a(t.created_at);r.join_text=n.join_text=="auto"?c(t.text):n.join_text;r.tweet_id=t.id_str;r.twitter_base="http://"+n.twitter_url+"/";r.user_url=r.twitter_base+r.screen_name;r.tweet_url=r.user_url+"/status/"+r.tweet_id;r.reply_url=r.twitter_base+"intent/tweet?in_reply_to="+r.tweet_id;r.retweet_url=r.twitter_base+"intent/retweet?tweet_id="+r.tweet_id;r.favorite_url=r.twitter_base+"intent/favorite?tweet_id="+r.tweet_id;r.retweeted_screen_name=r.retweet&&t.retweeted_status.user.screen_name;r.tweet_relative_time=l(f(r.tweet_time));r.entities=t.entities?(t.entities.urls||[]).concat(t.entities.media||[]):[];r.tweet_raw_text=r.retweet?"RT @"+r.retweeted_screen_name+" "+t.retweeted_status.text:t.text;r.tweet_text=e([u(r.tweet_raw_text,r.entities)]).linkUser().linkHash()[0];r.tweet_text_fancy=e([r.tweet_text]).makeHeart()[0];r.user=i('{screen_name}',r);r.join=n.join_text?i(' {join_text} ',r):" ";r.avatar=r.avatar_size?i('{screen_name}\'s avatar',r):"";r.text=i('{tweet_text_fancy}',r);r.time=i('{tweet_relative_time}',r);r.reply_action=i('reply',r);r.retweet_action=i('retweet',r);r.favorite_action=i('favorite',r);return r}function v(t){var r='

'+n.intro_text+"

";var s='

'+n.outro_text+"

";var o=e('

'+n.loading_text+"

");if(n.loading_text)e(t).not(":has(.tweet_list)").empty().append(o);e.getJSON(h(),function(o){var u=e('