Created
December 30, 2012 01:27
-
-
Save printminion/4410413 to your computer and use it in GitHub Desktop.
autoload Snapbird Tweets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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