1var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; 2if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } 3{ 4 let window = _____WB$wombat$assign$function_____("window"); 5 let self = _____WB$wombat$assign$function_____("self"); 6 let document = _____WB$wombat$assign$function_____("document"); 7 let location = _____WB$wombat$assign$function_____("location"); 8 let top = _____WB$wombat$assign$function_____("top"); 9 let parent = _____WB$wombat$assign$function_____("parent"); 10 let frames = _____WB$wombat$assign$function_____("frames"); 11 let opener = _____WB$wombat$assign$function_____("opener"); 12 13(function($) { 14 $.fn.tweet = function(o){ 15 var s = $.extend({ 16 username: null, // [string or array] required unless using the 'query' option; one or more twitter screen names 17 list: null, // [string] optional name of list belonging to username 18 favorites: false, // [boolean] display the user's favorites instead of his tweets 19 query: null, // [string] optional search query 20 avatar_size: null, // [integer] height and width of avatar if displayed (48px max) 21 count: 3, // [integer] how many tweets to display? 22 fetch: null, // [integer] how many tweets to fetch via the API (set this higher than 'count' if using the 'filter' option) 23 page: 1, // [integer] which page of results to fetch (if count != fetch, you'll get unexpected results) 24 retweets: true, // [boolean] whether to fetch (official) retweets (not supported in all display modes) 25 intro_text: null, // [string] do you want text BEFORE your your tweets? 26 outro_text: null, // [string] do you want text AFTER your tweets? 27 join_text: null, // [string] optional text in between date and tweet, try setting to "auto" 28 auto_join_text_default: "i said,", // [string] auto text for non verb: "i said" bullocks 29 auto_join_text_ed: "i", // [string] auto text for past tense: "i" surfed 30 auto_join_text_ing: "i am", // [string] auto tense for present tense: "i was" surfing 31 auto_join_text_reply: "i replied to", // [string] auto tense for replies: "i replied to" @someone "with" 32 auto_join_text_url: "i was looking at", // [string] auto tense for urls: "i was looking at" http:... 33 loading_text: 'loading tweets...', // [string] optional loading text, displayed while tweets load 34 refresh_interval: null , // [integer] optional number of seconds after which to reload tweets 35 twitter_url: "twitter.com", // [string] custom twitter url, if any (apigee, etc.) 36 twitter_api_url: "api.twitter.com", // [string] custom twitter api url, if any (apigee, etc.) 37 twitter_search_url: "search.twitter.com", // [string] custom twitter search url, if any (apigee, etc.) 38 template: "{avatar}{time}{join}{text}", // [string or function] template used to construct each tweet <li> - see code for available vars 39 comparator: function(tweet1, tweet2) { // [function] comparator used to sort tweets (see Array.sort) 40 return tweet2["tweet_time"] - tweet1["tweet_time"]; 41 }, 42 filter: function(tweet) { // [function] whether or not to include a particular tweet (be sure to also set 'fetch') 43 return true; 44 }, 45 seconds_ago_text: "about %d seconds ago", 46 a_minutes_ago_text: "about a minute ago", 47 minutes_ago_text: "about %d minutes ago", 48 a_hours_ago_text: "about an hour ago", 49 hours_ago_text: "about %d hours ago", 50 a_day_ago_text: "about a day ago", 51 days_ago_text: "about %d days ago", 52 view_text: "view tweet on twitter" 53 }, o); 54 $.fn.extend({ 55 linkUrl: function() { 56 var returning = []; 57 // See http://daringfireball.net/2010/07/improved_regex_for_matching_urls 58 var regexp = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>???��������]))/gi; 59 this.each(function() { 60 returning.push(this.replace(regexp, 61 function(match) { 62 var url = (/^[a-z]+:/i).test(match) ? match : "http://"+match; 63 return "<a href=\""+url+"\">"+match+"</a>"; 64 })); 65 }); 66 return $(returning); 67 }, 68 linkUser: function() { 69 var returning = []; 70 var regexp = /[\@]+(\w+)/gi; 71 this.each(function() { 72 returning.push(this.replace(regexp,"@<a href=\"http://"+s.twitter_url+"/$1\">$1</a>")); 73 }); 74 return $(returning); 75 }, 76 linkHash: function() { 77 var returning = [];
78 // Support various latin1 (\u00**) and arabic (\u06**) alphanumeric chars 79 var regexp = /(?:^| )[\#]+([\w\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0600-\u06ff]+)/gi; 80 var usercond = (s.username && s.username.length == 1) ? '&from='+s.username.join("%2BOR%2B") : ''; 81 this.each(function() { 82 returning.push(this.replace(regexp, ' <a href="http://'+s.twitter_search_url+'/search?q=&tag=$1&lang=all'+usercond+'">#$1</a>')); 83 }); 84 return $(returning); 85 }, 86 capAwesome: function() { 87 var returning = []; 88 this.each(function() { 89 returning.push(this.replace(/\b(awesome)\b/gi, '<span class="awesome">$1</span>')); 90 }); 91 return $(returning); 92 }, 93 capEpic: function() { 94 var returning = []; 95 this.each(function() { 96 returning.push(this.replace(/\b(epic)\b/gi, '<span class="epic">$1</span>')); 97 }); 98 return $(returning); 99 }, 100 makeHeart: function() { 101 var returning = []; 102 this.each(function() { 103 returning.push(this.replace(/(<)+[3]/gi, "<tt class='heart'>♥</tt>")); 104 }); 105 return $(returning); 106 } 107 }); 108 function parse_date(date_str) { 109 // The non-search twitter APIs return inconsistently-formatted dates, which Date.parse 110 // cannot handle in IE. We therefore perform the following transformation: 111 // "Wed Apr 29 08:53:31 +0000 2009" => "Wed, Apr 29 2009 08:53:31 +0000" 112 return Date.parse(date_str.replace(/^([a-z]{3})( [a-z]{3} \d\d?)(.*)( \d{4})$/i, '$1,$2$4$3')); 113 } 114 function relative_time(date) { 115 var relative_to = (arguments.length > 1) ? arguments[1] : new Date(); 116 var delta = parseInt((relative_to.getTime() - date) / 1000, 10); 117 var r = ''; 118 if (delta < 60) { 119 r = s.seconds_ago_text.replace(/%d/,delta); 120 } else if(delta < 120) { 121 r = s.a_minutes_ago_text; 122 } else if(delta < (45*60)) { 123 r = s.minutes_ago_text.replace(/%d/,(parseInt(delta / 60, 10)).toString()); 124 } else if(delta < (2*60*60)) { 125 r = s.a_hours_ago_text; 126 } else if(delta < (24*60*60)) { 127 r = s.hours_ago_text.replace(/%d/,(parseInt(delta / 3600, 10)).toString()); 128 } else if(delta < (48*60*60)) { 129 r = s.a_day_ago_text; 130 } else { 131 r = s.days_ago_text.replace(/%d/,(parseInt(delta / 86400, 10)).toString()); 132 } 133 return r; 134 } 135 function build_url() { 136 var proto = ('https:' == document.location.protocol ? 'https:' : 'http:'); 137 var count = (s.fetch === null) ? s.count : s.fetch; 138 if (s.list) { 139 return proto+"//"+s.twitter_api_url+"/1/"+s.username[0]+"/lists/"+s.list+"/statuses.json?page="+s.page+"&per_page="+count+"&callback=?"; 140 } else if (s.favorites) { 141 return proto+"//"+s.twitter_api_url+"/favorites/"+s.username[0]+".json?page="+s.page+"&count="+s.count+"&callback=?"; 142 } else if (s.query === null && s.username.length == 1) { 143 return proto+'//'+s.twitter_api_url+'/1/statuses/user_timeline.json?screen_name='+s.username[0]+'&count='+count+(s.retweets ? '&include_rts=1' : '')+'&page='+s.page+'&callback=?'; 144 } else { 145 var query = (s.query || 'from:'+s.username.join(' OR from:')); 146 return proto+'//'+s.twitter_search_url+'/search.json?&q='+encodeURIComponent(query)+'&rpp='+count+'&page='+s.page+'&callback=?'; 147 } 148 } 149 return this.each(function(i, widget){ 150 var list = $('<div class="blogRightM">').appendTo(widget); 151 var intro = '<p class="tweet_intro">'+s.intro_text+'</p>'; 152 var outro = '<p class="tweet_outro">'+s.outro_text+'</p>'; 153 var loading = $('<p class="loading">'+s.loading_text+'</p>'); 154 if(s.username && typeof(s.username) == "string"){ 155 s.username = [s.username]; 156 } 157 var expand_template = function(info) { 158 if (typeof s.template === "string") { 159 var result = s.template; 160 for(var key in info) { 161 var val = info[key]; 162 result = result.replace(new RegExp('{'+key+'}','g'), val === null ? '' : val); 163 } 164 return result; 165 } else return s.template(info); 166 }; 167 if (s.loading_text) $(widget).append(loading); 168 $(widget).bind("load", function(){ 169 $.getJSON(build_url(), function(data){ 170 if (s.loading_text) loading.remove(); 171 if (s.intro_text) list.before(intro); 172 list.empty(); 173 var tweets = $.map(data.results || data, function(item){ 174 var join_text = s.join_text; 175 // auto join text based on verb tense and content 176 if (s.join_text == "auto") { 177 if (item.text.match(/^(@([A-Za-z0-9-_]+)) .*/i)) { 178 join_text = s.auto_join_text_reply; 179 } else if (item.text.match(/(^\w+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+) .*/i)) { 180 join_text = s.auto_join_text_url; 181 } else if (item.text.match(/^((\w+ed)|just) .*/im)) { 182 join_text = s.auto_join_text_ed; 183 } else if (item.text.match(/^(\w*ing) .*/i)) { 184 join_text = s.auto_join_text_ing; 185 } else { 186 join_text = s.auto_join_text_default; 187 } 188 }
189 // Basic building blocks for constructing tweet <li> using a template 190 var screen_name = item.from_user || item.user.screen_name; 191 var source = item.source; 192 var user_url = "http://"+s.twitter_url+"/"+screen_name; 193 var avatar_size = s.avatar_size; 194 var avatar_url = item.profile_image_url || item.user.profile_image_url; 195 var tweet_url = "http://"+s.twitter_url+"/"+screen_name+"/status/"+item.id_str; 196 var retweet = (typeof(item.retweeted_status) != 'undefined'); 197 var retweeted_screen_name = retweet ? item.retweeted_status.user.screen_name : null; 198 var tweet_time = parse_date(item.created_at); 199 var tweet_relative_time = relative_time(tweet_time); 200 var tweet_raw_text = retweet ? ('RT @'+retweeted_screen_name+' '+item.retweeted_status.text) : item.text; // avoid '...' in long retweets 201 var tweet_text = $([tweet_raw_text]).linkUrl().linkUser().linkHash()[0]; 202 // Default spans, and pre-formatted blocks for common layouts 203 var user = '<a class="tweet_user" href="'+user_url+'">'+screen_name+'</a>';
204 var join = ((s.join_text) ? ('<span class="tweet_join"> '+join_text+' </span>') : ' '); 205 var avatar = (avatar_size ? 206 ('<a class="tweet_avatar" href="'+user_url+'"><img src="'+avatar_url+ 207 '" height="'+avatar_size+'" width="'+avatar_size+ 208 '" alt="'+screen_name+'\'s avatar" title="'+screen_name+'\'s avatar" border="0"/></a>') : ''); 209 var time = '<span class="tweet_time"><a href="'+tweet_url+'" title="'+s.view_text+'">'+tweet_relative_time+'</a></span>'; 210 var text = '<span class="tweet_text">'+$([tweet_text]).makeHeart().capAwesome().capEpic()[0]+ '</span>'; 211 var reply_url = "http://"+s.twitter_url+"/intent/tweet?in_reply_to="+item.id_str; 212 var retweet_url = "http://"+s.twitter_url+"/intent/retweet?tweet_id="+item.id_str; 213 var favorite_url = "http://"+s.twitter_url+"/intent/favorite?tweet_id="+item.id_str; 214 var reply_action = '<a class="tweet_action tweet_reply" href="'+reply_url+'">reply</a>'; 215 var retweet_action = '<a class="tweet_action tweet_retweet" href="'+retweet_url+'">retweet</a>'; 216 var favorite_action = '<a class="tweet_action tweet_favorite" href="'+favorite_url+'">favorite</a>'; 217 return { item: item, // For advanced users who want to dig out other info 218 screen_name: screen_name, 219 user_url: user_url, 220 avatar_size: avatar_size, 221 avatar_url: avatar_url, 222 source: source, 223 tweet_url: tweet_url, 224 tweet_time: tweet_time, 225 tweet_relative_time: tweet_relative_time, 226 tweet_raw_text: tweet_raw_text, 227 tweet_text: tweet_text, 228 retweet: retweet, 229 retweeted_screen_name: retweeted_screen_name, 230 user: user, 231 join: join, 232 avatar: avatar, 233 time: time, 234 text: text, 235 reply_url: reply_url, 236 favorite_url: favorite_url, 237 retweet_url: retweet_url, 238 reply_action: reply_action, 239 favorite_action: favorite_action, 240 retweet_action: retweet_action 241 }; 242 }); 243 tweets = $.grep(tweets, s.filter).sort(s.comparator).slice(0, s.count); 244 list.append($.map(tweets, 245 function(t) { return '<div class="widget-cloud tweet"><p class="content">' + expand_template(t) + '</p><span class="arrow"></span></div>'; }).join('')). 246 children('div:first').addClass('tweet_first').end(). 247 children('div:odd').addClass('tweet_even').end(). 248 children('div:even').addClass('tweet_odd'); 249 if (s.outro_text) list.after(outro); 250 $(widget).trigger("loaded").trigger((tweets.length === 0 ? "empty" : "full")); 251 if (s.refresh_interval) { 252 window.setTimeout(function() { $(widget).trigger("load"); }, 1000 * s.refresh_interval); 253 } 254 }); 255 return false; //stop propagation 256 }).trigger("load"); 257 }); 258 }; 259})(jQuery); 260 261 262}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.