您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
使用模拟点击元素实现的快捷暂停
// ==UserScript== // @name 共创世界(CCW)快捷键暂停 // @namespace https://greasyfork.org/zh-CN/scripts/477123-ccw%E5%BF%AB%E6%8D%B7%E9%94%AE%E6%9A%82%E5%81%9C // @version 1.5 // @description 使用模拟点击元素实现的快捷暂停 // @match https://www.ccw.site/detail/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // 用户自定义的触发按键 const customKey = 'x'; // 需要点击的元素选择器 const elementSelector = 'div.action-item-P9SP6.action-control-8nmb9'; window.addEventListener('keydown', function(event) { const key = event.key.toLowerCase(); // 判断是否按下用户定义的按键 if (key === customKey) { // 获取要点击的元素 const element = document.querySelector(elementSelector); console.log(element.style.visibility); if (element && element.style.visibility === '' && typeof element.click === 'function') { element.click(); } } }); })();