TypeRacer 作弊工具

此脚本图一乐,正常情况不应该使用本脚本

  1. // ==UserScript==
  2. // @name typeracer.com - Cheats
  3. // @name:zh-CN TypeRacer 作弊工具
  4. // @namespace Violentmonkey Scripts
  5. // @match https://play.typeracer.com/
  6. // @grant GM_registerMenuCommand
  7. // @grant GM_getValue
  8. // @version 0.3
  9. // @author -
  10. // @license 0BSD
  11. // @description You shouldn't use this script or you are going to be banned from taking races.
  12. // @description:zh-CN 此脚本图一乐,正常情况不应该使用本脚本
  13. // ==/UserScript==
  14. 'use strict';
  15.  
  16. /*
  17. * This config is for Chinese typing.
  18. {
  19. "speed_c": 300,
  20. "speed_v": 45
  21. }*/
  22.  
  23. let el;
  24.  
  25. const press = (() => {
  26. const conf2 = {
  27. inputType: "insertText",
  28. };
  29. function type(key) {
  30. el.value += key;
  31. conf2.data = key;
  32. el.dispatchEvent(new InputEvent("input", conf2));
  33. }
  34. return type;
  35. })();
  36.  
  37. const delay = n => new Promise(sol => setTimeout(sol, n));
  38.  
  39. let _stop = false;
  40.  
  41. async function main () {
  42. const txt = document.querySelector(".inputPanel div").innerText;
  43. el = document.querySelector(".txtInput");
  44. for (const t of txt) {
  45. if (_stop) return;
  46. await delay(GM_getValue("speed_c", 100) + Math.trunc(Math.random() * GM_getValue("speed_v", 30)));
  47. press(t);
  48. }
  49. }
  50.  
  51. const stop = () => _stop = true
  52. const start = () => (_stop = false, main());
  53. GM_registerMenuCommand("停止 Stop", stop);
  54. GM_registerMenuCommand("启动 Start", start);