Skip to content

Instantly share code, notes, and snippets.

@bemoty
Last active December 26, 2016 11:13
Show Gist options
  • Save bemoty/11154147eaf50989afdf to your computer and use it in GitHub Desktop.
Save bemoty/11154147eaf50989afdf to your computer and use it in GitHub Desktop.
var message = prompt("Enter a message to spam.");
var usernumber = prompt("Enter how often the message will be sent.");
if (message != null && usernumber != null) {
var field = document.getElementsByClassName("input")[1];
counter = 0;
function dispatch(target, eventType, char) {
var event = document.createEvent("TextEvent");
event.initTextEvent (eventType, true, true, window, char, 0, "en-US");
target.focus();
target.dispatchEvent(event);
}
function spam() {
if (counter<usernumber) {
dispatch(field, "textInput", message);
var input = document.getElementsByClassName("icon btn-icon icon-send");
input[0].click();
counter++;
setTimeout(spam,1);
}
}
spam();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment