Nitro Type Bot

This script is used for typing the text on nitrotype.com/race directly into the browser.

  1. // ==UserScript==
  2. // @name Nitro Type Bot
  3. // @namespace https://singdev.wixsite.com/sing-developments
  4. // @version 2
  5. // @description This script is used for typing the text on nitrotype.com/race directly into the browser.
  6. // @match https://www.nitrotype.com/race/*
  7. // @match https://www.nitrotype.com/race
  8. // @license MIT
  9. // ==/UserScript==
  10.  
  11. function typeRaceText() {
  12. // Wait for the race text to become available
  13. let e = setInterval(function () {
  14. const raceTextElement = document.querySelector(".dash-copy");
  15. if (raceTextElement) {
  16. const raceText = raceTextElement.textContent;
  17. typeTextInBrowser(raceText, 80, 98);
  18. clearInterval(e);
  19. }
  20. }, 1000);
  21. }
  22.  
  23. function typeTextInBrowser(text, wordsPerMinute, accuracy) {
  24. const inputElement = document.querySelector(".race-input-field");
  25. if (inputElement) {
  26. // Calculate typing delay based on words per minute
  27. const words = text.split(' ').filter(word => word.length > 0);
  28. const wordCount = words.length;
  29. const typingDelay = (60 / wordsPerMinute) * 1000; // Delay in milliseconds
  30.  
  31. let currentIndex = 0;
  32.  
  33. const typeNextWord = () => {
  34. if (currentIndex < wordCount) {
  35. const word = words[currentIndex];
  36. const typedCharacters = inputElement.value.length;
  37. const charactersToType = Math.ceil((word.length * accuracy) / 100);
  38. const characters = word.slice(0, charactersToType);
  39. inputElement.value += characters;
  40. inputElement.dispatchEvent(new Event("input"));
  41. currentIndex++;
  42.  
  43. // Schedule the next word to be typed after the typing delay
  44. setTimeout(typeNextWord, typingDelay);
  45. }
  46. };
  47.  
  48. // Start typing the first word
  49. typeNextWord();
  50. }
  51. }
  52.  
  53. function checkForDisqualified() {
  54. setInterval(function () {
  55. const raceErrorModal = document.querySelector(".modal--raceError");
  56. if (raceErrorModal) {
  57. reloadPage();
  58. }
  59. }, 10000);
  60. }
  61.  
  62. function reloadPage() {
  63. window.location.reload();
  64. }
  65.  
  66. function checkForRaceResults() {
  67. // Wait for the race results
  68. let e = setInterval(function () {
  69. const raceResultsElement = document.querySelector(".raceResults");
  70. if (raceResultsElement) {
  71. reloadPage();
  72. clearInterval(e);
  73. }
  74. }, Math.floor(1000 * Math.random()));
  75. }
  76.  
  77. function checkForContinueButton() {
  78. setInterval(function () {
  79. const continueButtons = document.querySelectorAll(".btn.btn--primary.btn--fw");
  80. const continueButton = Array.from(continueButtons).find(function (e) {
  81. return e.textContent.includes("ntinue");
  82. });
  83. if (continueButton) {
  84. reloadPage();
  85. } else {
  86. console.log("Didn't find continue button.");
  87. }
  88. }, 10000);
  89. }
  90.  
  91. function refreshJustInCase() {
  92. setTimeout(function () {
  93. window.location.href = "https://www.nitrotype.com/race";
  94. }, 80000);
  95. }
  96.  
  97. // Start the script by checking for race text
  98. typeRaceText();
  99. checkForDisqualified();
  100. checkForRaceResults();
  101. checkForContinueButton();
  102. refreshJustInCase();