Monkeytype helper

Allows to type really FAST!!! Press "Right Arrow" to toggle auto-typing bot, customize your typing speed, works in any mode and language

  1. // ==UserScript==
  2. // @name Monkeytype helper
  3. // @author Murka
  4. // @description Allows to type really FAST!!! Press "Right Arrow" to toggle auto-typing bot, customize your typing speed, works in any mode and language
  5. // @icon https://i.imgur.com/fUjylt3.png
  6. // @version 0.2
  7. // @match *://monkeytype.com/*
  8. // @run-at document-start
  9. // @grant none
  10. // @license MIT
  11. // @namespace https://gf.qytechs.cn/users/919633
  12. // ==/UserScript==
  13. /* jshint esversion:6 */
  14.  
  15. /*
  16. Author: Murka
  17. Github: https://github.com/Murka007
  18. Discord: https://discord.gg/sG9cyfGPj5
  19. Greasyfork: https://gf.qytechs.cn/en/users/919633
  20.  
  21. READ BEFORE USING:
  22. - It will not save statistics to your account
  23. - Log out of your account before using this script and reload the page
  24. - This script is intended to show vulnerabilities and maximum typing speed that can be achieved by using additional software
  25. - Press `Arrow Right` to enable/disable a script
  26. More info:
  27. - Modify `MIN_DELAY` and `MAX_DELAY` variables in the code to change your typing speed
  28. - Works in any mode and language
  29. */
  30.  
  31. (function() {
  32. "use strict";
  33.  
  34. // Minimum and maximum delay (ms)
  35. const MIN_DELAY = 0;
  36. const MAX_DELAY = 10;
  37. const TOGGLE_KEY = "ArrowRight";
  38. const log = console.log;
  39.  
  40. function random(min, max) {
  41. return Math.floor(Math.random() * (max - min + 1) + min);
  42. }
  43.  
  44. let toggle = false;
  45. function canType() {
  46. const typingTest = document.getElementById("typingTest");
  47. const isHidden = typingTest.classList.contains("hidden");
  48. if (isHidden) toggle = false;
  49. return toggle && !isHidden;
  50. }
  51.  
  52. function getNextCharacter() {
  53. const currentWord = document.querySelector(".word.active");
  54. for (const letter of currentWord.children) {
  55. if (letter.className === "") return letter.textContent;
  56. }
  57. return " ";
  58. }
  59.  
  60. const InputEvents = {};
  61. function pressKey(key) {
  62. const wordsInput = document.getElementById("wordsInput");
  63. const KeyboardEvent = Object.assign({}, DEFAULT_INPUT_OPTIONS, { target: wordsInput, data: key });
  64. const InputEvent = Object.assign({}, DEFAULT_KEY_OPTIONS, { target: wordsInput, key: key });
  65.  
  66. wordsInput.value += key;
  67. InputEvents.beforeinput(InputEvent);
  68. InputEvents.input(InputEvent);
  69. InputEvents.keyup(KeyboardEvent);
  70. }
  71.  
  72. function typeCharacter() {
  73. if (!canType()) {
  74. log("STOPPED TYPING TEST");
  75. return;
  76. }
  77.  
  78. pressKey(getNextCharacter());
  79. setTimeout(typeCharacter, random(MIN_DELAY, MAX_DELAY));
  80. }
  81.  
  82. window.addEventListener("keydown", function(event) {
  83. if (event.code === TOGGLE_KEY) {
  84. event.preventDefault();
  85.  
  86. if (event.repeat) return;
  87. toggle = !toggle;
  88. if (toggle) {
  89. log("STARTED TYPING TEST");
  90. typeCharacter();
  91. }
  92. }
  93. })
  94.  
  95. // Intercept when JQuery attached an addEventListener to the Input element
  96. function hook(element) {
  97. element.addEventListener = new Proxy(element.addEventListener, {
  98. apply(target, _this, args) {
  99. const [type, listener, ...options] = args;
  100. if (_this.id === "wordsInput") {
  101. InputEvents[type] = listener;
  102. }
  103. return target.apply(_this, args);
  104. }
  105. })
  106. }
  107. hook(HTMLInputElement.prototype);
  108.  
  109. const DEFAULT_KEY_OPTIONS = {
  110. key: "", code: "", keyCode: 0, which: 0, isTrusted: true, altKey: false,
  111. bubbles: true, cancelBubble: false, cancelable: true, charCode: 0,
  112. composed: true, ctrlKey: false, currentTarget: null, defaultPrevented: false,
  113. detail: 0, eventPhase: 0, isComposing: false, location: 0, metaKey: false,
  114. path: null, repeat: false, returnValue: true, shiftKey: false, srcElement: null,
  115. target: null, timeStamp: 6338.5, type: "", view: window,
  116. };
  117.  
  118. const DEFAULT_INPUT_OPTIONS = {
  119. isTrusted: true, bubbles: true, cancelBubble: false, cancelable: false,
  120. composed: true, data: "", dataTransfer: null, defaultPrevented: false,
  121. detail: 0, eventPhase: 0, inputType: "insertText", isComposing: false,
  122. path: null, returnValue: true, sourceCapabilities: null, srcElement: null,
  123. target: null, currentTarget: null, timeStamp: 11543, type: "input",
  124. view: null, which: 0
  125. };
  126.  
  127. })();

QingJ © 2025

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