Random Clicker

Auto Clicker for Browsers!!

Stan na 04-09-2023. Zobacz najnowsza wersja.

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

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

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         Random Clicker
// @namespace    
// @version      1.11
// @description  Auto Clicker for Browsers!!
// @author       
// @match        *://*/*
// @grant        none
// @icon         
// @compatible               chrome
// @compatible               firefox
// @compatible               opera
// @compatible               safari
// ==/UserScript==

let x, y, minCPS = 1, maxCPS = 5, autoClick;
let infoElement = document.createElement("div");
infoElement.style.position = "fixed";
infoElement.style.top = "10px";
infoElement.style.left = "10px";
document.body.appendChild(infoElement);

function updateInfo(message) {
    infoElement.textContent = message;
}

function startAutoClick(x, y) {
    // Generate a new random CPS
    let randomCPS = Math.floor(Math.random() * (maxCPS - minCPS + 1)) + minCPS;

    autoClick = setInterval(function () {
        if (x !== undefined && y !== undefined) {
            click(x, y, randomCPS); // Pass the coordinates and random CPS to the click function
        }
    }, 1000 / randomCPS); // Convert CPS to milliseconds
}

function stopAutoClick() {
    clearInterval(autoClick); // Clear the autoClick interval
    x = undefined;
    y = undefined;
}

document.addEventListener('keydown', function (evt) {
    if (evt.shiftKey && evt.key === 'J') {
        if (autoClick) {
            stopAutoClick(); // Stop the previous autoclick interval
        }

        updateInfo("You may now click on any point in this tab to set the autoclicker to it. Have fun !!");

        document.addEventListener('click', function (event) {
            x = event.clientX;
            y = event.clientY;
            updateInfo(`Mouse click at X: ${x}, Y: ${y}`);
            startAutoClick(x, y); // Start autoclicking at the new coordinates
        });
    }
});

function click(x, y, randomCPS) {
    // You can still display information here if needed
    let ev = new MouseEvent('click', {
        'view': window,
        'bubbles': true,
        'cancelable': true,
        'screenX': x,
        'screenY': y
    });

    let el = document.elementFromPoint(x, y);
    el.dispatchEvent(ev);
}