-
-
Save anonymous/adea982b840181b69414d7b292dd2972 to your computer and use it in GitHub Desktop.
script for adding multiple students to Cloud9 team
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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