AutoClick

Hold ` key to repeatedly click element under mouse

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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