Skip to content

Instantly share code, notes, and snippets.

@printminion
Created December 30, 2012 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save printminion/4410413 to your computer and use it in GitHub Desktop.
Save printminion/4410413 to your computer and use it in GitHub Desktop.
autoload Snapbird Tweets
/**
* @desc autoload Snapbird Tweets
* run it in the console after injecting jquery: https://gist.github.com/4141199
* @author Misha M.-Kupriyanov https://plus.google.com/104512463398531242371/
* @require jQuery
* @link https://gist.github.com/4410413
*/
var lastCount = getTweetsCount();
var currentCount = 0;
var bLoading = false;
console.log('currentCount', currentCount);
checkNewTweets();
function checkNewTweets() {
if ($('div#loading').is(':visible') || !$('div#more').is(':visible')) {
console.log('checkNewTweets', 'skip on loading');
setTimeout('checkNewTweets()', 100);
return;
}
if (bLoading) {
bLoading = false;
currentCount = getTweetsCount();
}
console.log(lastCount + ' != ' + currentCount);
if (lastCount != currentCount) {
bLoading = true;
$('#more a').click();
lastCount = currentCount;
setTimeout('checkNewTweets()', 100);
}
}
function getTweetsCount() {
var count = $('p.searched').text();
count = count.split(' ');
count = count[0];
count = count.replace(',', '');
return parseInt(count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment