您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Simulate human typing in Google Docs and Slides with customizable settings such as typing speed, errors, and breaks.
当前为
- // ==UserScript==
- // @name Human-Typer by Warrior
- // @description Simulate human typing in Google Docs and Slides with customizable settings such as typing speed, errors, and breaks.
- // @version 1.1
- // @namespace http://yournamespace.com/human-typer
- // @match *://docs.google.com/document/*
- // @match *://docs.google.com/presentation/*
- // @include *://docs.google.com/document/*
- // @include *://docs.google.com/presentation/*
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- // Constants for typing speeds
- const typingSpeeds = {
- fast: { lower: 50, upper: 150 },
- medium: { lower: 60, upper: 220 },
- normal: { lower: 70, upper: 200 },
- slow: { lower: 80, upper: 240 }
- };
- // Variables
- let typingInProgress = false;
- let cancelTyping = false;
- // Create the "Human Typer" button
- const createHumanTyperButton = () => {
- const button = document.createElement('button');
- button.textContent = 'Human Typer';
- button.style.position = 'fixed';
- button.style.bottom = '10px';
- button.style.right = '10px';
- button.style.backgroundColor = 'black';
- button.style.color = 'white';
- button.style.padding = '10px';
- button.style.border = 'none';
- button.style.borderRadius = '5px';
- button.style.cursor = 'pointer';
- button.addEventListener('click', showOverlay);
- document.body.appendChild(button);
- };
- // Function to display the overlay for user input
- const showOverlay = () => {
- // Create overlay elements
- const overlay = document.createElement('div');
- overlay.style.position = 'fixed';
- overlay.style.bottom = '10px';
- overlay.style.right = '10px';
- overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
- overlay.style.padding = '10px';
- overlay.style.borderRadius = '5px';
- overlay.style.zIndex = '9999';
- const textarea = document.createElement('textarea');
- textarea.placeholder = 'Enter your text...';
- textarea.style.width = '200px';
- textarea.style.height = '100px';
- textarea.style.marginBottom = '10px';
- const speedSelect = document.createElement('select');
- for (const speed in typingSpeeds) {
- const option = document.createElement('option');
- option.value = speed;
- option.textContent = speed.charAt(0).toUpperCase() + speed.slice(1);
- speedSelect.appendChild(option);
- }
- const startButton = document.createElement('button');
- startButton.textContent = 'Start';
- startButton.addEventListener('click', () => {
- const speed = speedSelect.value;
- const userText = textarea.value.trim();
- overlay.remove();
- startTyping(userText, speed);
- });
- // Append elements to overlay
- overlay.appendChild(textarea);
- overlay.appendChild(speedSelect);
- overlay.appendChild(startButton);
- document.body.appendChild(overlay);
- };
- // Function to start typing with the selected speed
- const startTyping = (text, speed) => {
- if (typingInProgress) return;
- const speedValues = typingSpeeds[speed] || typingSpeeds.normal;
- const iframe = document.querySelector('.docs-texteventtarget-iframe');
- const activeElement = iframe.contentDocument.activeElement;
- typingInProgress = true;
- // Simulate typing
- (async () => {
- for (let i = 0; i < text.length; i++) {
- if (cancelTyping) break;
- activeElement.value += text[i];
- await new Promise(resolve => setTimeout(resolve, Math.random() * (speedValues.upper - speedValues.lower) + speedValues.lower));
- // Simulate mistakes
- if (Math.random() < 0.05) {
- activeElement.value += text[i]; // Add a mistake
- await new Promise(resolve => setTimeout(resolve, Math.random() * (speedValues.upper - speedValues.lower) + speedValues.lower));
- activeElement.value = activeElement.value.slice(0, -1); // Correct the mistake
- }
- }
- typingInProgress = false;
- })();
- };
- // Initialize the Human Typer button
- createHumanTyperButton();
- })();