-
Notifications
You must be signed in to change notification settings - Fork 0
/
Code.js
44 lines (33 loc) · 1.28 KB
/
Code.js
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
function FunctionDispatch(element, eventid)
{
var mouseEvent = document.createEvent('MouseEvents');
mouseEvent.initEvent(eventid, true, true);
element.dispatchEvent(mouseEvent);
}
function startTimer()
{
setTimeout(MessageTrigger, 3000);
}
function MessageTrigger()
{
messageBox = document.querySelectorAll("[contenteditable='true']")[1];
message = "Enter Your Message Body Here";//Your message needs to be placed here, for spaces try using   eg.. Hardik Bharunt which gives "Hardik Bharunt" as the message
counter = 100;//Change how many messages to send
for (i = 0; i < counter; i++)
{
event = document.createEvent("UIEvents");
messageBox.innerHTML = message.replace(/ /gm, '');
event.initUIEvent("input", true, true, window, 1);
messageBox.dispatchEvent(event);
EventExecute(document.querySelector('span[data-icon="send"]'), 'click');
}
}
var EventExecute = (element, type) => {
var event = document.createEvent("MouseEvents");
event.initMouseEvent
(type, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
element.dispatchEvent(event);
};
contact = "Contact Name"//Add contact name or name of the group as it is
FunctionDispatch(document.querySelector('[title="' + contact + '"]'), 'mousedown');
startTimer();