-
Notifications
You must be signed in to change notification settings - Fork 7
/
script.js
60 lines (49 loc) · 1.59 KB
/
script.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
(() => {
if (window.BlumAC) return;
window.BlumAC = true;
const autoPlay = true;
const gc = [208, 216, 0];
const t = 5;
if (autoPlay) {
setInterval(() => {
const playButton = document.querySelector("button.is-primary, .play-btn");
if (!playButton) return;
if (!playButton.textContent.toLowerCase().includes("play")) return;
playButton.click();
}, 5000)
}
setInterval(() => {
const canvas = document.querySelector("canvas");
if (canvas) findAndClickObjects(canvas);
}, 100);
function findAndClickObjects(screenCanvas) {
const context = screenCanvas.getContext('2d');
const width = screenCanvas.width;
const height = screenCanvas.height;
const imageData = context.getImageData(0, 0, width, height);
const pixels = imageData.data;
for (let x = 0; x < width; x += 1) {
for (let y = 0; y < height; y += 1) {
if (y < 70) continue;
const index = (y * width + x) * 4;
const r = pixels[index];
const g = pixels[index + 1];
const b = pixels[index + 2];
const greenRange = (gc[0] - t < r && r < gc[0] + t) && (gc[1] - t < g && g < gc[1] + t) && (gc[2] - t < b && b < gc[2] + t);
if (greenRange) {
simulateClick(screenCanvas, x, y);
}
}
}
}
function simulateClick(canvas, x, y) {
const prop = {
clientX: x,
clientY: y,
bubbles: true
};
canvas.dispatchEvent(new MouseEvent('click', prop));
canvas.dispatchEvent(new MouseEvent('mousedown', prop));
canvas.dispatchEvent(new MouseEvent('mouseup', prop));
}
})();