Created
January 1, 2018 16:46
-
-
Save cagatayldzz/e1c4e374290137582308a972a2d79dbe to your computer and use it in GitHub Desktop.
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 timer = setInterval(general,1000); | |
function general(){ | |
if(document.getElementsByClassName("app-wrapper-main")[0] != null){ | |
var item2 = document.getElementsByClassName("pane-header pane-list-header")[0]; | |
var panel = document.getElementsByClassName("chatlist-panel")[0]; | |
var element = item2.cloneNode(true); | |
element.style.zIndex = 0; | |
element.innerHTML = "<input type='text' id='mensaje' placeholder='Bir mesaj yazın' style='border-radius: 5px;border: 1px solid #dedede;padding: 1em;width: 100%;height: 11px;' size='30'><input type='number' min='1' id='repeticiones' style='margin-right:5px;margin-left: 7px;width: 23%;border-radius: 5px;border: 1px solid #dedede;padding: 1em;height: 11px;'><div id='spam' data-icon=\"send\" class=\"img icon icon-send\" style='margin-left: 5px;cursor:pointer;'><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\"><path opacity=\".4\" d=\"M1.101 21.757L23.8 12.028 1.101 2.3l.011 7.912 13.623 1.816-13.623 1.817-.011 7.912z\"></path></svg></div>"; | |
panel.insertBefore(element, panel.childNodes[1]); | |
document.getElementById("spam").addEventListener("click", spam); | |
clearInterval(timer); | |
}else{ | |
console.log("Whatsapp uygulamasının yüklenmesini bekliyor..."); | |
} | |
} | |
function dispatch(input, message) { | |
InputEvent = Event || InputEvent; | |
var evt = new InputEvent('input', { | |
bubbles: true, | |
composer: true | |
}); | |
input.innerHTML = message; | |
input.dispatchEvent(evt); | |
document.querySelector(".compose-btn-send > span").click(); | |
} | |
function spam(){ | |
var text = document.getElementById("mensaje").value; | |
var reps = document.getElementById("repeticiones").value; | |
var input = document.querySelector("#main > footer > div.block-compose > div.input-container > div > div.pluggable-input-body.copyable-text.selectable-text"); | |
var counter = 1; | |
while(counter <= reps){ | |
dispatch(input, text); | |
counter++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment