Browse code

added buffer for mentions in twitter stream

Brandon Mathis authored on 28/09/2011 at 05:53:31
Showing 1 changed files
... ...
@@ -49,7 +49,6 @@ function linkifyTweet(text, url) {
49 49
     if(url[u].expanded_url != null){
50 50
       var shortUrl = new RegExp( url[u].url.replace(/https?:\/\//, ''), 'g');
51 51
       text = text.replace(shortUrl, url[u].display_url);
52
-      console.log(text);
53 52
     }
54 53
   }
55 54
   return text
... ...
@@ -66,11 +65,11 @@ function showTwitterFeed(tweets, twitter_user) {
66 66
 }
67 67
 
68 68
 function getTwitterFeed(user, count, replies) {
69
+  count = parseInt(count, 10);
69 70
   $.ajax({
70
-      url: "http://api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (parseInt(count, 10)) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?"
71
+      url: "http://api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (count + 20) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?"
71 72
     , type: 'jsonp'
72 73
     , error: function (err) { $('#tweets li.loading').addClass('error').text("Twitter's busted"); }
73
-    , success: function(data) { showTwitterFeed(data, user); }
74
+    , success: function(data) { showTwitterFeed(data.slice(0, count), user); }
74 75
   })
75 76
 }
76
-