Created
January 24, 2017 12:26
-
-
Save sagic/168ce80386970ab60e20325d2112f3a0 to your computer and use it in GitHub Desktop.
reply to web whatsapp spammers
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
// import/require jquery (or copy from cdn) and then: | |
var lastText = ''; | |
$('.pane-chat .message-list').bind('DOMSubtreeModified',function(e){ | |
var txt = $('.pane-chat .message-list .msg').last()[0].innerText; | |
if (lastText !== txt) { | |
lastText = txt; | |
// console.log(lastText); | |
if (lastText.indexOf('Yossi') > -1) { // search for an incoming message text | |
setTimeout(function(){ | |
function whatsAppText(t) { | |
window.InputEvent = window.Event || window.InputEvent; | |
var d = new Date(); | |
var event = new InputEvent('input', {bubbles: true}); | |
var textbox = document.querySelector('#main > footer > div.block-compose > div.input-container > div > div.input'); | |
textbox.textContent = t; | |
textbox.dispatchEvent(event); | |
document.querySelector('.icon.btn-icon.icon-send.send-container').click() | |
} | |
whatsAppText('💁♂'); // reply with something :) | |
}, 1000); | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment