Skip to content

Instantly share code, notes, and snippets.

@max-frai
Created June 1, 2017 11:12
Show Gist options
  • Save max-frai/cb7c16d31d7ef4286aa1302c007c688a to your computer and use it in GitHub Desktop.
Save max-frai/cb7c16d31d7ef4286aa1302c007c688a to your computer and use it in GitHub Desktop.
Invite people to subscribe page
var scroll = document.querySelector('div.uiLayer div[role=dialog] div.uiScrollableAreaWrap');
var lastScroll = -1;
var it = 0;
var inviteIt = 0;
var allInvites = [];
var invitePause= 1000; // ms
var INTERVAL = window.setInterval(function() {
if (it >= 7)
{
console.log('Start inviting');
window.clearInterval(INTERVAL);
allInvites = document.querySelectorAll('div[role=dialog] div.uiScrollableAreaWrap a[ajaxify*="invite"]');
var INTERVAL2 = window.setInterval(function() {
if (inviteIt < allInvites.length)
{
allInvites[inviteIt++].click();
console.log("Invited #" + inviteIt);
}
else
{
window.clearInterval(INTERVAL2);
}
}, invitePause);
}
it = (scroll.scrollTop == lastScroll) ? (it+1) : 0;
lastScroll = scroll.scrollTop;
var seeMore = document.querySelector('#reaction_profile_pager .uiMorePagerPrimary');
if (seeMore)
seeMore.click();
scroll.scrollTop += 1000;
}, 700);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment