1(function($){ 2 3 $.fn.extend({ 4 5 //pass the options variable to the function 6 jtwt: function(options) { 7 8 9 //Set the default values, use comma to separate the settings, example: 10 var defaults = { 11 username : 'google', 12 count : 1, 13 image_size: 48, 14 convert_links: 1, 15 loader_text: 'loading new tweets' 16 } 17 18 var options = $.extend(defaults, options); 19 20 return this.each(function() { 21 var o = options; 22 var obj = $(this); 23 24$(obj).append('<p id="jtwt_loader" style="display:none;">' + o.loader_text + '</p>'); 25$("#jtwt_loader").fadeIn('slow'); 26 27 28 $.getJSON('http://api.twitter.com/1/statuses/user_timeline.json?screen_name=' + o.username + '&count=' + o.count + '&callback=?', function(data){ 29 30 31 32 33 34 $.each(data, function(i, item) { 35 36 jtweet = '<div id="jtwt">'; 37 38 39 40 if (o.image_size != 0) { 41 42 today = new Date(); 43 44 jtweet += '<div id="jtwt_picture">'; 45 jtweet += '<a href="http://twitter.com/' + item.user['screen_name'] + '">' 46 jtweet += '<img width="' + o.image_size +'" height="' + o.image_size + '" src="' + item.user['profile_image_url'] + '" />'; 47 jtweet += '</a><br />'; 48 jtweet += '</div>'; 49 jtweet += '<div id="jtwt_tweet">'; 50 } 51 52 53 54 var tweettext = item.text; 55 var tweetdate = item.created_at; 56 57 if (o.convert_links != 0) { 58 59 60 61 tweettext = tweettext.replace(/(http\:\/\/[A-Za-z0-9\/\.\?\=\-]*)/g,'<a href="$1">$1</a>'); 62 tweettext = tweettext.replace(/@([A-Za-z0-9\/_]*)/g,'<a href="http://twitter.com/$1">@$1</a>'); 63 tweettext = tweettext.replace(/#([A-Za-z0-9\/\.]*)/g,'<a href="http://twitter.com/search?q=$1">#$1</a>'); 64 65 } 66 67 jtweet += '<div id="jtwt_text">'; 68 jtweet += tweettext; 69 jtweet += '<br />'; 70 71 72 tweetdate = tweetdate.replace(/201.{1}/, ""); 73 tweetdate = tweetdate.replace(/\+00.{2}/, ""); 74 jtweet += '<a href="http://twitter.com/' + item.user['screen_name'] + '/statuses/' + item.id + '" id="jtwt_date">'; 75 76 jtweet += tweetdate; 77 jtweet += '</a></div>'; 78 jtweet += '</div>'; 79 80 $(obj).append(jtweet); 81 82 83 84 85 }); 86 87 88$("#jtwt_loader").fadeOut('fast'); 89 90 }); 91 92 93 94 }); 95 } 96 }); 97 98})(jQuery);
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.