Auto Click Target on Mouse Accuracy

Auto click targets in Mouse Accuracy with better accuracy

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 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.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

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         Auto Click Target on Mouse Accuracy
// @namespace    http://tampermonkey.net/
// @version      2.3
// @description  Auto click targets in Mouse Accuracy with better accuracy
// @author       HưngVN
// @license      MIT
// @match        https://mouseaccuracy.com/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const clickedTargets = new Set(); // Lưu các target đã bấm

    // Hàm mô phỏng click chuột
    function simulateMouseEvent(element, eventType) {
        const mouseEvent = new MouseEvent(eventType, {
            bubbles: true,
            cancelable: true,
            view: window,
        });
        element.dispatchEvent(mouseEvent);
    }

    // Hàm tự động click vào target hợp lệ
    function autoClickTarget() {
        const targets = document.querySelectorAll('.target');
        targets.forEach((target) => {
            if (
                document.body.contains(target) && // Kiểm tra target còn tồn tại
                !clickedTargets.has(target) // Đảm bảo chưa click vào target này
            ) {
                simulateMouseEvent(target, 'mousedown');
                simulateMouseEvent(target, 'mouseup');
                simulateMouseEvent(target, 'click');
                clickedTargets.add(target); // Đánh dấu đã click
                console.log('Đã click vào target mới!');
            }
        });

        // Liên tục chạy lại kiểm tra target
        requestAnimationFrame(autoClickTarget);
    }

    // Khởi chạy vòng lặp auto-click
    requestAnimationFrame(autoClickTarget);
})();