Here's a new one which also employs a delay to prevent spam issues.
var FOLLOW_PAUSE = 1250;
var FOLLOW_RAND = 250;
var PAGE_WAIT = 2000;
__cnt__ = 0;
var f;
f = function() {
var eles;
var __lcnt__ = 0;
eles = jQuery('.Grid-cell .not-following .follow-text').each(function(i, ele) {
ele = jQuery(ele);
if (ele.css('display') != 'block') {
console.trace('Already following: ' + i);
return;
}
setTimeout(function() {
console.trace("Following " + i + " of " + eles.length);
ele.click();
if ((eles.length - 1) == i) {
console.trace("Scrolling...");
window.scrollTo(0, document.body.scrollHeight);
setTimeout(function() {
f();
}, PAGE_WAIT);
}
}, __lcnt__++ * FOLLOW_PAUSE + Math.random()*(FOLLOW_RAND) - FOLLOW_RAND/2);
__cnt__++;
});
}
f();
What it does:
- Looks for follow buttons
- Checks that you aren't already following or pending (
display: block
check)
- Sets a timer to click the FOLLOW buttons every 500ms to prevent spam issues.
- NEW! When it's done them all, scrolls the page and waits a couple seconds for the next loads to appear, then repeats the whole process!
Notes for hackers:
- Works on Chrome latest version and Twitter as of the 30th of Sep 2016.
- You seem to need to "click" the DIV inside the A tag, not the A tag itself.
- HOMEWORK: Maybe try jQuery's live() function to auto-click any new buttons which show up after the initial page load :)
Disclaimer: This is not a hack...just a technique to save some wrist and finger RSI :) Regardless, use cautiously and respectfully.
UPDATE: Improved for latest twitter. Now employs randomness in the timing to make you look less like a bot