共创世界(CCW)快捷键暂停

使用模拟点击元素实现的快捷暂停

目前为 2023-10-10 提交的版本。查看 最新版本

// ==UserScript==
// @name         共创世界(CCW)快捷键暂停
// @namespace    https://gf.qytechs.cn/zh-CN/scripts/477123-ccw%E5%BF%AB%E6%8D%B7%E9%94%AE%E6%9A%82%E5%81%9C
// @version      1.3
// @description  使用模拟点击元素实现的快捷暂停
// @match        https://www.ccw.site/detail/*
// @grant        none
// @license MIT
// ==/UserScript==


(function () {
    'use strict';

    // 用户自定义的触发按键
    const customKey = 'x';

    // 需要点击的元素选择器
    const elementSelector = 'div.action-item-1ZhLn.action-control-MUkPX';

    window.addEventListener('keydown', function (event) {
        const key = event.key.toLowerCase();
        // 判断是否按下用户定义的按键
        if (key === customKey) {
            // 获取要点击的元素
            const element = document.querySelector(elementSelector);

            if (element && element.style.visibility === 'visible' && typeof element.click === 'function') {
                element.click();
            }
        }
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址