ueuyegf

1 click = 2 clicks, with UI and proper CPS control

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         ueuyegf
// @namespace    https://greasyfork.org/users/yourname
// @version      1.1
// @description  1 click = 2 clicks, with UI and proper CPS control
// @match        *://*/*
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let enabled = false;
    let toggleKey = "KeyG"; // Press G to toggle
    let menuVisible = true;

    // Cooldown to prevent 500 CPS spam
    let lastClickTime = 0;
    const cooldown = 50; // ms — prevents multiple duplicates per real click

    // --- UI CREATION ---
    const ui = document.createElement("div");
    ui.style = `
        position: fixed;
        top: 20px;
        left: 20px;
        width: 180px;
        padding: 12px;
        background: rgba(20,20,20,0.85);
        color: white;
        font-family: sans-serif;
        border-radius: 10px;
        z-index: 999999;
        backdrop-filter: blur(6px);
        border: 1px solid #444;
        user-select: none;
        transition: opacity 0.2s ease;
    `;
    ui.innerHTML = `
        <div style="font-size:16px; margin-bottom:8px; font-weight:600;">
            DoubleClick UI
        </div>

        <div style="margin-bottom:6px;">
            <b>Status:</b> <span id="dc-status" style="color:#f55;">OFF</span>
        </div>

        <div style="margin-bottom:6px;">
            <b>Toggle Key:</b> G
        </div>

        <div style="margin-bottom:6px;">
            <b>Hide Menu:</b> ArrowDown
        </div>

        <button id="dc-toggle" style="
            width:100%;
            padding:6px;
            background:#333;
            color:white;
            border:1px solid #555;
            border-radius:6px;
            cursor:pointer;
        ">Enable</button>
    `;
    document.body.appendChild(ui);

    const statusEl = ui.querySelector("#dc-status");
    const toggleBtn = ui.querySelector("#dc-toggle");

    // --- DRAGGABLE UI ---
    let dragging = false, offsetX = 0, offsetY = 0;

    ui.addEventListener("mousedown", e => {
        dragging = true;
        offsetX = e.clientX - ui.offsetLeft;
        offsetY = e.clientY - ui.offsetTop;
    });

    document.addEventListener("mousemove", e => {
        if (!dragging) return;
        ui.style.left = (e.clientX - offsetX) + "px";
        ui.style.top = (e.clientY - offsetY) + "px";
    });

    document.addEventListener("mouseup", () => dragging = false);

    // --- TOGGLE LOGIC ---
    function updateUI() {
        if (enabled) {
            statusEl.textContent = "ON";
            statusEl.style.color = "#5f5";
            toggleBtn.textContent = "Disable";
        } else {
            statusEl.textContent = "OFF";
            statusEl.style.color = "#f55";
            toggleBtn.textContent = "Enable";
        }
    }

    toggleBtn.onclick = () => {
        enabled = !enabled;
        updateUI();
    };

    document.addEventListener("keydown", e => {
        if (e.code === toggleKey) {
            enabled = !enabled;
            updateUI();
        }

        // ArrowDown hides/shows menu
        if (e.code === "ArrowDown") {
            menuVisible = !menuVisible;
            ui.style.opacity = menuVisible ? "1" : "0";
            ui.style.pointerEvents = menuVisible ? "auto" : "none";
        }
    });

    // --- DOUBLE CLICK LOGIC ---
    window.addEventListener("click", function(e) {
        if (!enabled) return;

        const now = performance.now();

        // Prevent multiple duplicates from bubbling
        if (now - lastClickTime < cooldown) return;
        lastClickTime = now;

        // Fire 1 extra synthetic click
        const c1 = new MouseEvent("click", {
            bubbles: true,
            cancelable: true,
            clientX: e.clientX,
            clientY: e.clientY
        });

        e.target.dispatchEvent(c1);
    }, true);

})();