SHOW:
|
|
- or go back to the newest paste.
| 1 | // ==UserScript== | |
| 2 | // @name Eclipse Auto Clicker | |
| 3 | // @namespace http://tampermonkey.net/ | |
| 4 | // @version 1.0 | |
| 5 | // @description Bichok Eclipse Auto Clicker | |
| 6 | // @match https://tap.eclipse.xyz/* | |
| 7 | // @grant none | |
| 8 | // ==/UserScript== | |
| 9 | ||
| 10 | (function() {
| |
| 11 | 'use strict'; | |
| 12 | ||
| 13 | function waitForElements() {
| |
| 14 | return new Promise(resolve => {
| |
| 15 | function check() {
| |
| 16 | const container = document.querySelector('.row-start-1.grid.place-content-start.justify-center.py-8.md\\:col-span-1');
| |
| 17 | const canvas = document.querySelector('canvas');
| |
| 18 | ||
| 19 | if (container && canvas) {
| |
| 20 | resolve({ container, canvas });
| |
| 21 | return true; | |
| 22 | } | |
| 23 | return false; | |
| 24 | } | |
| 25 | ||
| 26 | if (check()) return; | |
| 27 | ||
| 28 | const observer = new MutationObserver(mutations => {
| |
| 29 | if (check()) {
| |
| 30 | observer.disconnect(); | |
| 31 | } | |
| 32 | }); | |
| 33 | ||
| 34 | observer.observe(document.body, {
| |
| 35 | childList: true, | |
| 36 | subtree: true | |
| 37 | }); | |
| 38 | }); | |
| 39 | } | |
| 40 | ||
| 41 | function createToggleButton() {
| |
| 42 | const toggleButton = document.createElement('button');
| |
| 43 | toggleButton.innerHTML = '🖱️ Off'; | |
| 44 | toggleButton.style.cssText = ` | |
| 45 | margin: 20px auto 0; | |
| 46 | padding: 8px 16px; | |
| 47 | border-radius: 8px; | |
| 48 | background: #0B979F; | |
| 49 | color: white; | |
| 50 | border: none; | |
| 51 | cursor: pointer; | |
| 52 | font-weight: bold; | |
| 53 | opacity: 0.8; | |
| 54 | display: block; | |
| 55 | `; | |
| 56 | return toggleButton; | |
| 57 | } | |
| 58 | ||
| 59 | function getRandomCoordinates(element) {
| |
| 60 | const rect = element.getBoundingClientRect(); | |
| 61 | const centerX = rect.left + rect.width / 2; | |
| 62 | const centerY = rect.top + rect.height / 2; | |
| 63 | ||
| 64 | const radiusX = rect.width * 0.3; | |
| 65 | const radiusY = rect.height * 0.3; | |
| 66 | ||
| 67 | const angle = Math.random() * Math.PI * 2; | |
| 68 | const distance = Math.random(); | |
| 69 | ||
| 70 | const x = centerX + Math.cos(angle) * radiusX * distance; | |
| 71 | const y = centerY + Math.sin(angle) * radiusY * distance; | |
| 72 | ||
| 73 | return { x, y };
| |
| 74 | } | |
| 75 | ||
| 76 | function simulateRealClick(element) {
| |
| 77 | if (!element) return; | |
| 78 | ||
| 79 | const { x, y } = getRandomCoordinates(element);
| |
| 80 | const { x: upX, y: upY } = getRandomCoordinates(element);
| |
| 81 | ||
| 82 | const mouseDown = new MouseEvent('mousedown', {
| |
| 83 | view: window, | |
| 84 | bubbles: true, | |
| 85 | cancelable: true, | |
| 86 | clientX: x, | |
| 87 | clientY: y, | |
| 88 | button: 0, | |
| 89 | buttons: 1 | |
| 90 | }); | |
| 91 | element.dispatchEvent(mouseDown); | |
| 92 | ||
| 93 | setTimeout(() => {
| |
| 94 | const mouseUp = new MouseEvent('mouseup', {
| |
| 95 | view: window, | |
| 96 | bubbles: true, | |
| 97 | cancelable: true, | |
| 98 | clientX: upX, | |
| 99 | clientY: upY, | |
| 100 | button: 0, | |
| 101 | buttons: 0 | |
| 102 | }); | |
| 103 | element.dispatchEvent(mouseUp); | |
| 104 | ||
| 105 | setTimeout(() => {
| |
| 106 | const click = new MouseEvent('click', {
| |
| 107 | view: window, | |
| 108 | bubbles: true, | |
| 109 | cancelable: true, | |
| 110 | clientX: upX, | |
| 111 | clientY: upY, | |
| 112 | button: 0, | |
| 113 | buttons: 0 | |
| 114 | }); | |
| 115 | element.dispatchEvent(click); | |
| 116 | }, 5 + Math.random() * 10); | |
| 117 | }, 50 + Math.random() * 50); | |
| 118 | } | |
| 119 | ||
| 120 | async function initAutoClicker() {
| |
| 121 | const { container, canvas } = await waitForElements();
| |
| 122 | const toggleButton = createToggleButton(); | |
| 123 | container.appendChild(toggleButton); | |
| 124 | ||
| 125 | let isClicking = localStorage.getItem('autoClickerEnabled') === 'true';
| |
| 126 | let clickTimeout = null; | |
| 127 | let reloadTimeout = null; | |
| 128 | ||
| 129 | function performClick() {
| |
| 130 | if (!isClicking) return; | |
| 131 | ||
| 132 | const shouldTakeLongBreak = Math.random() < 0.002; | |
| 133 | ||
| 134 | simulateRealClick(canvas); | |
| 135 | ||
| 136 | if (shouldTakeLongBreak) {
| |
| 137 | clickTimeout = setTimeout(performClick, 10000 + Math.random() * 20000); | |
| 138 | } else {
| |
| 139 | clickTimeout = setTimeout(performClick, 100 + Math.random() * 50); | |
| 140 | } | |
| 141 | } | |
| 142 | ||
| 143 | function scheduleReload() {
| |
| 144 | if (!isClicking) return; | |
| 145 | ||
| 146 | reloadTimeout = setTimeout(() => {
| |
| 147 | localStorage.setItem('autoClickerEnabled', 'true');
| |
| 148 | location.reload(); | |
| 149 | }, 30 * 60 * 1000); | |
| 150 | } | |
| 151 | ||
| 152 | if (isClicking) {
| |
| 153 | toggleButton.innerHTML = '🖱️ On'; | |
| 154 | toggleButton.style.background = '#9F0B0B'; | |
| 155 | setTimeout(() => {
| |
| 156 | performClick(); | |
| 157 | scheduleReload(); | |
| 158 | }, 45000); | |
| 159 | } | |
| 160 | ||
| 161 | toggleButton.addEventListener('click', () => {
| |
| 162 | isClicking = !isClicking; | |
| 163 | localStorage.setItem('autoClickerEnabled', isClicking);
| |
| 164 | toggleButton.innerHTML = isClicking ? '🖱️ On' : '🖱️ Off'; | |
| 165 | toggleButton.style.background = isClicking ? '#9F0B0B' : '#0B979F'; | |
| 166 | ||
| 167 | if (isClicking) {
| |
| 168 | performClick(); | |
| 169 | scheduleReload(); | |
| 170 | } else {
| |
| 171 | if (clickTimeout) {
| |
| 172 | clearTimeout(clickTimeout); | |
| 173 | } | |
| 174 | if (reloadTimeout) {
| |
| 175 | clearTimeout(reloadTimeout); | |
| 176 | } | |
| 177 | } | |
| 178 | }); | |
| 179 | } | |
| 180 | ||
| 181 | initAutoClicker().catch(console.error); | |
| 182 | })(); |