Skip to content

Commit 9cf956c

Browse files
committed
added buffer for mentions in twitter stream
1 parent 9730e24 commit 9cf956c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

.themes/classic/source/javascripts/twitter.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ function linkifyTweet(text, url) {
4949
if(url[u].expanded_url != null){
5050
var shortUrl = new RegExp( url[u].url.replace(/https?:\/\//, ''), 'g');
5151
text = text.replace(shortUrl, url[u].display_url);
52-
console.log(text);
5352
}
5453
}
5554
return text
@@ -66,11 +65,11 @@ function showTwitterFeed(tweets, twitter_user) {
6665
}
6766

6867
function getTwitterFeed(user, count, replies) {
68+
count = parseInt(count, 10);
6969
$.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=?"
70+
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=?"
7171
, type: 'jsonp'
7272
, error: function (err) { $('#tweets li.loading').addClass('error').text("Twitter's busted"); }
73-
, success: function(data) { showTwitterFeed(data, user); }
73+
, success: function(data) { showTwitterFeed(data.slice(0, count), user); }
7474
})
7575
}
76-

0 commit comments

Comments
 (0)