forked from gamemakerfp3/Auto-Cicker-For-Browsers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoClicker.js
77 lines (69 loc) · 2.26 KB
/
autoClicker.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// ==UserScript==
// @name Auto Clicker
// @namespace http://tampermonkey.net/
// @version 1.3
// @description Auto Clicker for Browsers!!
// @author GSRHackZ
// @match *://*/*
// @grant none
// @icon https://image.flaticon.com/icons/svg/99/99188.svg
// @license MIT
// @compatible chrome
// @compatible firefox
// @compatible opera
// @compatible safari
// ==/UserScript==
let x,y,set,cps=10;
document.addEventListener('keyup',function(evt){
if(evt.keyCode==77&&evt.altKey){
if(!set==true){
set=true;
let inp=prompt("How many clicks would you like per second? Recommended Max : 100,000 cps");
if(!isNaN(inp)&&inp.trim().length>0){
if(inp>100000){
let check=confirm(`${inp} clicks per second may crash your browser! Are you sure you would like to continue?`)
if(check){
alert("Ok whatever you say...");
console.warn("Idiot...");
cps=inp;
}
else{
set=false;
alert("Thanks for understanding. Please click ctrl + m to try again.")
}
}
else if(inp<1000){
cps=1000;
}
else{
cps=inp;
}
}
alert("You may now click on any point in this tab to set the autoclicker to it. Have fun !!");
onmousedown = function(e){
x=e.clientX;
y=e.clientY;
};
let autoClick=setInterval(function(){
if(x!==undefined&&y!==undefined&&set==true){
for(let i=0;i<cps/1000;i++){
click(x,y);
}
}
},1)}
else{
set=false
}
}
})
function click(x, y){
let ev = new MouseEvent('click', {
'view': window,
'bubbles': true,
'cancelable': true,
'screenX': x,
'screenY': y
});
let el = document.elementFromPoint(x, y);
el.dispatchEvent(ev);
}