forked from macr1408/Whatsapp-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Spam script (Tampermonkey version)
50 lines (46 loc) · 2.78 KB
/
Spam script (Tampermonkey version)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// ==UserScript==
// @name Whatsapp spam 2.0
// @namespace https://github.com/macr1408/Whatsapp-scripts
// @version 2.0
// @description Made by Macr1408
// @author Macr1408
// @match https://web.whatsapp.com/
// @grant none
// @icon https://k60.kn3.net/58A8A056B.png
// @icon64 https://k60.kn3.net/58A8A056B.png
// ==/UserScript==
var timer = setInterval(general,1000);
function general(){
if(document.getElementsByClassName("app-wrapper-main")[0] != null){
var item2 = document.getElementsByClassName("_3auIg")[0];
var panel = document.getElementsByClassName("swl8g")[0];
var element = item2.cloneNode(true); // Create text and reps inputs
element.style.zIndex = 0; // This way the menu doesn't go below our app
element.innerHTML = "<input type='text' id='mensaje' placeholder='Message' style='margin-right:10px' size='30'><input type='number' min='1' id='repeticiones' style='width:50px;padding-left:5px;margin-right:5px'>Times<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]); // Insert everything we have created
document.getElementById("spam").addEventListener("click", spam); // Assign a function to the botton
clearInterval(timer);
}else{
console.log("WS Spam: Waiting for whatsapp to load...");
}
}
function dispatch(input, message) {
InputEvent = Event || InputEvent;
var evt = new InputEvent('input', { // Create a new event from type "input"
bubbles: true,
composer: true
});
input.innerHTML = message; // Get text to spam
input.dispatchEvent(evt); // Fire the event (inserts text) in the input field.
document.querySelector("._2lkdt > span").click(); // Press send button
}
function spam(){
var text = document.getElementById("mensaje").value; // Get text to spam
var reps = document.getElementById("repeticiones").value; // Get number of repetitions
var input = document.querySelector("#main > footer > div._3oju3 > div._2bXVy > div > div.pluggable-input-body.copyable-text.selectable-text"); // Select the input
var counter = 1; // Initialize a counter
while(counter <= reps){ // Iterate the number of repetitions needed
dispatch(input, text); // Spam!
counter++;
}
}