Ultimate Auto Clicker (Compact UI, Cursor-based)

Best auto-clicker: clean, compact UI, Ctrl+E toggle, and cursor-based clicking (Mac-friendly too!) 🚀🖱️💻

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Ultimate Auto Clicker (Compact UI, Cursor-based)
// @namespace    http://tampermonkey.net/
// @version      3.0
// @description  Best auto-clicker: clean, compact UI, Ctrl+E toggle, and cursor-based clicking (Mac-friendly too!) 🚀🖱️💻
// @author       Marley
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // ✅ Prevent duplicate UI
    if (window.__ultimateClickerLoaded) return;
    window.__ultimateClickerLoaded = true;

    let autoClicking = false;
    let intervalId = null;
    const intervalMs = 100;

    // ✅ Track cursor position
    let mouseX = 0, mouseY = 0;
    document.addEventListener('mousemove', e => {
        mouseX = e.clientX;
        mouseY = e.clientY;
    });

    // ✅ Auto-click function
    function clickUnderCursor() {
        const el = document.elementFromPoint(mouseX, mouseY);
        if (el) el.click();
    }

    // ✅ Toggle function
    function toggleClicker() {
        autoClicking = !autoClicking;
        statusDot.style.backgroundColor = autoClicking ? '#00ff80' : '#ff4d4d';
        toggleBtn.textContent = autoClicking ? 'Stop' : 'Start';

        if (autoClicking) {
            intervalId = setInterval(clickUnderCursor, intervalMs);
        } else {
            clearInterval(intervalId);
        }
    }

    // ✅ Keyboard toggle: Ctrl + E
    document.addEventListener('keydown', e => {
        if (e.ctrlKey && e.key.toLowerCase() === 'e') {
            toggleClicker();
        }
    });

    // === ✅ UI CREATION ===
    const panel = document.createElement('div');
    panel.style.position = 'fixed';
    panel.style.bottom = '20px';
    panel.style.left = '20px';
    panel.style.zIndex = '999999';
    panel.style.background = '#1e1e1e';
    panel.style.border = '1px solid #444';
    panel.style.borderRadius = '6px';
    panel.style.padding = '6px 10px';
    panel.style.display = 'flex';
    panel.style.alignItems = 'center';
    panel.style.gap = '8px';
    panel.style.fontFamily = 'Arial, sans-serif';
    panel.style.fontSize = '12px';
    panel.style.color = '#eee';
    panel.style.boxShadow = '0 2px 8px rgba(0, 0, 0, 0.4)';

    const toggleBtn = document.createElement('button');
    toggleBtn.textContent = 'Start';
    toggleBtn.style.padding = '4px 8px';
    toggleBtn.style.fontSize = '12px';
    toggleBtn.style.backgroundColor = '#007bff';
    toggleBtn.style.color = 'white';
    toggleBtn.style.border = 'none';
    toggleBtn.style.borderRadius = '4px';
    toggleBtn.style.cursor = 'pointer';
    toggleBtn.addEventListener('click', toggleClicker);

    const statusDot = document.createElement('div');
    statusDot.style.width = '10px';
    statusDot.style.height = '10px';
    statusDot.style.borderRadius = '50%';
    statusDot.style.backgroundColor = '#ff4d4d';
    statusDot.title = 'Clicker Status';

    const label = document.createElement('span');
    label.textContent = 'Auto-Clicker';

    panel.appendChild(label);
    panel.appendChild(statusDot);
    panel.appendChild(toggleBtn);
    document.body.appendChild(panel);
})();