AutoClick

Hold ` key to repeatedly click element under mouse

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        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();
}