Greasy Fork is available in English.

Nitro Type Bot

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

// ==UserScript==
// @name        Nitro Type Bot
// @namespace   https://singdev.wixsite.com/sing-developments
// @version     2
// @description This script is used for typing the text on nitrotype.com/race directly into the browser.
// @match       https://www.nitrotype.com/race/*
// @match       https://www.nitrotype.com/race
// @license MIT
// ==/UserScript==

function typeRaceText() {
    // Wait for the race text to become available
    let e = setInterval(function () {
        const raceTextElement = document.querySelector(".dash-copy");
        if (raceTextElement) {
            const raceText = raceTextElement.textContent;
            typeTextInBrowser(raceText, 80, 98);
            clearInterval(e);
        }
    }, 1000);
}

function typeTextInBrowser(text, wordsPerMinute, accuracy) {
    const inputElement = document.querySelector(".race-input-field");
    if (inputElement) {
        // Calculate typing delay based on words per minute
        const words = text.split(' ').filter(word => word.length > 0);
        const wordCount = words.length;
        const typingDelay = (60 / wordsPerMinute) * 1000; // Delay in milliseconds

        let currentIndex = 0;

        const typeNextWord = () => {
            if (currentIndex < wordCount) {
                const word = words[currentIndex];
                const typedCharacters = inputElement.value.length;
                const charactersToType = Math.ceil((word.length * accuracy) / 100);
                const characters = word.slice(0, charactersToType);
                inputElement.value += characters;
                inputElement.dispatchEvent(new Event("input"));
                currentIndex++;

                // Schedule the next word to be typed after the typing delay
                setTimeout(typeNextWord, typingDelay);
            }
        };

        // Start typing the first word
        typeNextWord();
    }
}

function checkForDisqualified() {
    setInterval(function () {
        const raceErrorModal = document.querySelector(".modal--raceError");
        if (raceErrorModal) {
            reloadPage();
        }
    }, 10000);
}

function reloadPage() {
    window.location.reload();
}

function checkForRaceResults() {
    // Wait for the race results
    let e = setInterval(function () {
        const raceResultsElement = document.querySelector(".raceResults");
        if (raceResultsElement) {
            reloadPage();
            clearInterval(e);
        }
    }, Math.floor(1000 * Math.random()));
}

function checkForContinueButton() {
    setInterval(function () {
        const continueButtons = document.querySelectorAll(".btn.btn--primary.btn--fw");
        const continueButton = Array.from(continueButtons).find(function (e) {
            return e.textContent.includes("ntinue");
        });
        if (continueButton) {
            reloadPage();
        } else {
            console.log("Didn't find continue button.");
        }
    }, 10000);
}

function refreshJustInCase() {
    setTimeout(function () {
        window.location.href = "https://www.nitrotype.com/race";
    }, 80000);
}

// Start the script by checking for race text
typeRaceText();
checkForDisqualified();
checkForRaceResults();
checkForContinueButton();
refreshJustInCase();