AutoClick

Hold ` key to repeatedly click element under mouse

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        AutoClick
// @author      QtheConqueror
// @namespace   Automation
// @description Hold ` key to repeatedly click element under mouse
// @version     3.0
// @include     http:*
// @include     https:*
// @grant       none
// @license     GPL-3.0-or-later
// ==/UserScript==

var cps = 0; // Clicks per Second: 0 = as fast as possible

if (window.attachEvent) {
    document.attachEvent('onmousemove', mouseMv);
} else {
    document.addEventListener('mousemove', mouseMv, false);
}
document.addEventListener('keydown', keyDown);

var x, y;
var interval, timeout;
var rate = (cps ? 1000 / (cps / 3) : 0);

/**
 * Summary: Listens for mouse movement and exports position to variables x & y.
 * @param {Event} e 
 */
function mouseMv(e) {
    if (!e) e = window.event;

    if (typeof e.pageY == 'number') {
        x = e.pageX;
        y = e.pageY;
    } else {
        x = e.clientX;
        y = e.clientY;
    }
}

/**
 * Summary: Listens for keydown event
 * @param {Event} e 
 */
function keyDown(e) {``
    var char = e.key
    if (char == '`' || char == '~') {
        interval = setInterval(click, rate, x, y);
        timeout = setTimeout(clearInterval, 200, interval)
    }
}

/** 
 * Summary: Clicks element at positions (x, y) on document.
 * @param {number} x - X coordinate of document element.
 * @param {number} y - Y coordinate of document element.
 */
function click() {
    document.elementFromPoint(x, y).click();
}