-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscriptoverkill.js
More file actions
40 lines (37 loc) · 1.06 KB
/
Copy pathscriptoverkill.js
File metadata and controls
40 lines (37 loc) · 1.06 KB
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
// ==UserScript==
// @name CellsHub.ga Mouse Control
// @version 1.0
// @description Left-click = Split, Right-click = Feed.
// @author Botplayer
// @icon http://bit.ly/2oT4wRk
// @match *://*.cellshub.ga/*
// @grant none
// ==/UserScript==
(function() {
"use strict";
let speed = 50;
let intervalID = null;
canvas.addEventListener("mousedown", ({button}) => {
if (button === 0) // left click
wsSend(UINT8_CACHE[17]);
if (button === 2) { // right click
wsSend(UINT8_CACHE[21]);
intervalID = setInterval(function(){wsSend(UINT8_CACHE[21]);}, speed);
}
});
addEventListener("mouseup", ({button}) => {
if (button === 2) {
clearInterval(intervalID);
intervalID = null;
}
});
canvas.addEventListener("mousewheel", () => {
canvas.dispatchEvent(new MouseEvent("mousemove", {
clientX: innerWidth / 2,
clientY: innerHeight / 2
}));
});
const prevent = event => event.preventDefault();
canvas.addEventListener("contextmenu", prevent);
canvas.addEventListener("drag", prevent);
})();