public
Description: put twitter on your website with tweet, an unobtrusive javascript plugin for jquery
Homepage: http://tweet.seaofclouds.com
Clone URL: git://github.com/seaofclouds/tweet.git
Multi user support
pengwynn (author)
Wed Nov 12 19:42:34 -0800 2008
commit  0b499ded129d16970baca73d9a78c04d37894036
tree    4fd4c2940b00b885a1a9e82bcb6bf228d178a05e
parent  190c85bca6ea6492953909623e58513f831606c5
...
2
3
4
 
 
5
6
7
...
41
42
43
44
 
 
 
 
45
46
47
...
61
62
63
64
 
65
66
67
68
 
 
 
69
70
71
...
2
3
4
5
6
7
8
9
...
43
44
45
 
46
47
48
49
50
51
52
...
66
67
68
 
69
70
 
 
 
71
72
73
74
75
76
0
@@ -2,6 +2,8 @@
0
   $.fn.tweet = function(o){
0
     var s = {
0
       username: "seaofclouds",                // [string]   required, unless you want to display our tweets. :)
0
+      show_user: false,                        // [Boolean]  show user name in tweet?
0
+      avatar_size: 32,                        // [integer]  height and width of avatar if displayed
0
       count: 1,                               // [integer]  how many tweets to display?
0
       intro_text: null,                       // [string]   do you want text BEFORE your your tweets?
0
       outro_text: null,                       // [string]   do you want text AFTER your tweets?
0
@@ -41,7 +43,10 @@
0
       var intro = '<p class="tweet_intro">'+s.intro_text+'</p>'
0
       var outro = '<p class="tweet_outro">'+s.outro_text+'</p>'
0
       var loading = $('<p class="loading">'+s.loading_text+'</p>');
0
-      var url = 'http://search.twitter.com/search.json?q=from%3A'+s.username+'&rpp='+s.count+'&callback=?'
0
+      if(typeof(s.username) == "string"){
0
+        s.username = [s.username];
0
+      }
0
+      var url = 'http://search.twitter.com/search.json?q=from:'+s.username.join('%20OR%20')+'&rpp='+s.count+'&callback=?';
0
       if (s.loading_text) $(this).append(loading);
0
       $.getJSON(url,  function(data){
0
         if (s.loading_text) loading.remove();
0
@@ -61,11 +66,11 @@
0
               var join_text = s.auto_join_text_default;
0
             }
0
           } else {
0
-            var join_text = s.join_text
0
+            var join_text = s.join_text;
0
           };
0
-          var join = '<span class="tweet_join"> '+join_text+' </span>'
0
-          
0
-          list.append('<li><a href="http://twitter.com/'+s.username+'/statuses/'+item.id+'" title="view tweet on twitter">'+relative_time(item.created_at)+'</a>'+ ((s.join_text) ? join : ' ') + '<span class="tweet_text">' + item.text.replace(/(\w+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+)/gi, '<a href="$1">$1</a>').replace(/[\@]+([A-Za-z0-9-_]+)/gi, (s.join_text == "auto") ? '<a href="http://twitter.com/$1">@$1</a> with ' : ' ').replace(/[\#]+([A-Za-z0-9-_]+)/gi, '<a href="http://search.twitter.com/search?q=&tag=$1&lang=all&from='+s.username+'">#$1</a>').replace(/[&lt;]+[3]/gi, "<tt class='heart'>&#x2665;</tt>") + '</span></li>');
0
+          var join = '<span class="tweet_join"> '+join_text+' </span>';
0
+
0
+          list.append('<li>'+(s.show_user ? '<a href="http://twitter.com/'+ item.from_user+'"><img class="tweet_avatar" src="'+item.profile_image_url+'" height="'+s.avatar_size+'" width="'+s.avatar_size+'" alt="avatar"/></a>' : '')+'<a href="http://twitter.com/'+item.from_user+'/statuses/'+item.id+'" title="view tweet on twitter">'+relative_time(item.created_at)+'</a>'+ ((s.join_text) ? join : ' ') + '<span class="tweet_text">' + item.text.replace(/(\w+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+)/gi, '<a href="$1">$1</a>').replace(/[\@]+([A-Za-z0-9-_]+)/gi, (s.join_text == "auto") ? '<a href="http://twitter.com/$1">@$1</a> with ' : '<a href="http://twitter.com/$1">@$1</a>').replace(/[\#]+([A-Za-z0-9-_]+)/gi, '<a href="http://search.twitter.com/search?q=&tag=$1&lang=all&from='+s.username.join("%2BOR%2B")+'">#$1</a>').replace(/[&lt;]+[3]/gi, "<tt class='heart'>&#x2665;</tt>") + '</span></li>');
0
         });
0
         $('.tweet_list li:odd').addClass('tweet_even');
0
         $('.tweet_list li:even').addClass('tweet_odd');

Comments