Random Clicker

Auto Clicker for Browsers!!

As of 04.09.2023. See ბოლო ვერსია.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Random Clicker
// @namespace    
// @version      1.6
// @description  Auto Clicker for Browsers!!
// @author       
// @match        *://*/*
// @grant        none
// @icon         
// @compatible               chrome
// @compatible               firefox
// @compatible               opera
// @compatible               safari
// ==/UserScript==

let x, y, set, minCPS = 1, maxCPS = 5;

document.addEventListener('keyup', function (evt) {
    if (evt.keyCode == 77 && evt.altKey) {
        if (!set == true) {
            set = true;
            alert("You may now click on any point in this tab to set the autoclicker to it. Have fun !!");

            // Generate a random CPS between minCPS and maxCPS
            let randomCPS = Math.floor(Math.random() * (maxCPS - minCPS + 1)) + minCPS;

            let autoClick = setInterval(function () {
                if (x !== undefined && y !== undefined && set == true) {
                    for (let i = 0; i < randomCPS; i++) {
                        click(x, y);
                    }
                }
            }, 1000 / randomCPS); // Convert CPS to milliseconds
        } else {
            set = false;
        }
    }
})

function click(x, y) {
    let ev = new MouseEvent('click', {
        'view': window,
        'bubbles': true,
        'cancelable': true,
        'screenX': x,
        'screenY': y
    });

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