Auto Click (mobile)

Auto click enter on mobile

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Auto Click (mobile)
// @description  Auto click enter on mobile
// @version      1.1
// @include      https://*/game.php*
// @namespace https://greasyfork.org/users/1388899
// ==/UserScript==
 
(function() {
 
    'use strict';
 
    // Create button
 
    let button = document.createElement("button");
 
    button.innerText = "Start";
 
    button.style.position = "fixed";
 
    button.style.bottom = "20px";
 
    button.style.left = "20px";
 
    button.style.padding = "8px 8px";
 
    button.style.fontSize = "13px";
 
    button.style.zIndex = "1000";
 
    button.style.backgroundColor = "#4CAF50";
 
    button.style.color = "white";
 
    button.style.border = "none";
 
    button.style.borderRadius = "5px";
 
    button.style.cursor = "pointer";
 
    document.body.appendChild(button);
 
    let isRunning = false;
 
    let intervalId;
 
    function pressEnterRandomly() {
 
        const randomDelay = Math.floor(Math.random() * (350 - 200 + 1)) + 200; // Random delay between 200-350 ms
 
        document.dispatchEvent(new KeyboardEvent('keydown', {
 
            key: 'Enter',
 
            code: 'Enter',
 
            which: 13,
 
            keyCode: 13,
 
            bubbles: true
 
        }));
 
        intervalId = setTimeout(pressEnterRandomly, randomDelay);
 
    }
 
    // Toggle the Enter key press on and off
 
    button.addEventListener("click", function() {
 
        if (isRunning) {
 
            clearTimeout(intervalId);
 
            button.innerText = "Start";
 
            isRunning = false;
 
        } else {
 
            pressEnterRandomly();
 
            button.innerText = "Stop";
 
            isRunning = true;
 
        }
 
    });
 
})();