Skip to content

Instantly share code, notes, and snippets.

@Prithvirajbilla
Last active October 11, 2016 12:27
Show Gist options
  • Save Prithvirajbilla/50dc499242c32cbf81f4 to your computer and use it in GitHub Desktop.
Save Prithvirajbilla/50dc499242c32cbf81f4 to your computer and use it in GitHub Desktop.
//Works on http://web.whatsapp.com
// With little creativity and some coding skills you can do a lot of things using this code to annoy some one.
function dispatch(target, eventType, char) {
var evt = document.createEvent("TextEvent");
evt.initTextEvent (eventType, true, true, window, char, 0, "en-US");
target.focus();
target.dispatchEvent(evt);
}
function triggerClick() {
var event = new MouseEvent('click', {
'view': window,
'bubbles': true,
'cancelable': true
});
document.querySelector(".icon.btn-icon.icon-send").dispatchEvent(event)
}
window.setInterval(function(){
dispatch(document.querySelector(".block-compose .input"), "textInput", "valar morghulis!");
triggerClick();
}, 1000);
@kennedysmartins
Copy link

didn't work here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment