Skip to content

Instantly share code, notes, and snippets.

@mitio
Last active May 6, 2017 17:17
Show Gist options
  • Save mitio/23c383fe45dda84bfd4546357cd3c596 to your computer and use it in GitHub Desktop.
Save mitio/23c383fe45dda84bfd4546357cd3c596 to your computer and use it in GitHub Desktop.
var emails = ['[email protected]', 'another.example.com'];
var index = 0;
function inviteNextPerson() {
if (index >= emails.length) return;
var email = emails[index];
var input = $('input[name=invite]');
var submit = $('button[type=submit].solid.info.fat');
if (submit.text() == 'Send invite') {
input.val(email);
input[0].dispatchEvent(new Event('input', { bubbles: true }));
submit.click();
index++;
console.log('Sent invite to ' + email)
setTimeout(inviteNextPerson, 100);
} else {
console.log('.');
setTimeout(inviteNextPerson, 200);
}
}
(function() {
// Load the script
var script = document.createElement("SCRIPT");
script.src = 'https://code.jquery.com/jquery-3.2.1.slim.min.js';
script.type = 'text/javascript';
script.onload = function() {
var $ = window.jQuery;
inviteNextPerson();
};
document.getElementsByTagName("head")[0].appendChild(script);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment