Skip to content

Instantly share code, notes, and snippets.

/addteammate.js Secret

Created February 7, 2017 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/adea982b840181b69414d7b292dd2972 to your computer and use it in GitHub Desktop.
Save anonymous/adea982b840181b69414d7b292dd2972 to your computer and use it in GitHub Desktop.
script for adding multiple students to Cloud9 team
var email_addresses = "me@gmail.com, you@gmail.com, us@gmail.com";
var emails = email_addresses.split(/,\s*/);
var inputElement = document.querySelector("input");
var submitButton = inputElement.parentNode.parentNode.childNodes[1];
for (var i = 0; i < emails.length; i++) {
setTimeout(function(x) {
return function() {
inputElement.value = emails[x];
var event = new Event('input', { bubbles: true }); // reactJS waits for this event to be dispatched
inputElement.dispatchEvent(event);
submitButton.click()
};
}(i), 6000*i);
// I found it takes up to 5 seconds or so for the invite to be added and the input element to be empty again.
// 6000*i (6 second intervals) is the one I found best.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment