Skip to content

Instantly share code, notes, and snippets.

@nikhedonia
Last active August 15, 2016 00:47
Show Gist options
  • Save nikhedonia/76435240a7440f6d2d04daa6558e1471 to your computer and use it in GitHub Desktop.
Save nikhedonia/76435240a7440f6d2d04daa6558e1471 to your computer and use it in GitHub Desktop.
invites everybody who shows up on your search page
function inviteAll(i, clickTime, loadTime) {
i = (i !== undefined) ? i : 100; // how many people you like to add ?
clickTime = clickTime||350; // how quick can a human click ?
loadTime = loadTime||1000; // wait till next page is loaded
if (i<=0) return;
var invite = document.
querySelector('a[href^="/people/invite"]:not(.invite-sent)');
// check if there a people to invite
if (invite) {
invite.click();
} else {
// check if there is a next-page button
var next = document.querySelector('li.next a.page-link');
if (!next) { return; }
next.click();
}
var timeout = Math.random() * 200 // randomize to fake a real user
+ (invite) ? clickTime : loadTime; // wait for data or next invite
// recurse
setTimeout( inviteAll.bind(
this, i-1, clickTime, loadTime
) , timeout);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment