您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Records and replays user actions with periodic and on-demand options
当前为
// ==UserScript== // @name Action Recorder and Replayer // @namespace http://tampermonkey.net/ // @version 0.2 // @description Records and replays user actions with periodic and on-demand options // @match :///* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; let actions = []; let recording = false; let replayInterval; // Start recording when 'x' is pressed document.addEventListener('keydown', function(event) { if (event.key === 'x') { recording = true; actions = []; console.log('Recording started'); } else if (event.key === 'y') { recording = false; console.log('Recording stopped'); } }); // Capture mouse clicks and key presses document.addEventListener('click', function(event) { if (recording) { actions.push({ type: 'click', x: event.clientX, y: event.clientY, time: Date.now() }); } }); document.addEventListener('keydown', function(event) { if (recording) { actions.push({ type: 'keydown', key: event.key, time: Date.now() }); } }); // Replay actions function replayActions() { if (actions.length === 0) return; let startTime = actions[0].time; actions.forEach(action => { let delay = action.time - startTime; setTimeout(() => { if (action.type === 'click') { let clickEvent = new MouseEvent('click', { clientX: action.x, clientY: action.y, bubbles: true }); document.dispatchEvent(clickEvent); } else if (action.type === 'keydown') { let keyEvent = new KeyboardEvent('keydown', { key: action.key, bubbles: true }); document.dispatchEvent(keyEvent); } }, delay); }); } // Set up periodic replay every 4 hours function startPeriodicReplay() { replayInterval = setInterval(replayActions, 4 * 60 * 60 * 1000); // 4 hours in milliseconds } // Stop periodic replay function stopPeriodicReplay() { clearInterval(replayInterval); } // Trigger replay with 'z' and 'P' keys document.addEventListener('keydown', function(event) { if (event.key === 'z') { replayActions(); startPeriodicReplay(); } else if (event.key === 'P') { replayActions(); } }); // Optional: Stop periodic replay when the script is unloaded or at some other condition window.addEventListener('beforeunload', function() { stopPeriodicReplay(); }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址