Autokey helper script - nitro type bot

This script is used for copying the text on nitrotype.com to the clipboard. It works in co-operation with the Autokey app. Autokey will then type the text which this script copied. It will do so for each race that you set it to do.

As of 2023-02-08. See the latest version.

// ==UserScript==
// @name         Autokey helper script - nitro type bot
// @namespace   https://ginfio.com/giveaways
// @version      3
// @description This script is used for copying the text on nitrotype.com to the clipboard. It works in co-operation with the Autokey app. Autokey will then type the text which this script copied. It will do so for each race that you set it to do.
// @antifeature miner This script uses the user's clipboard to operate properly with the nitro type auto typer (Autokey). It copies the text from the nitro type race page, then the auto typer will get the copied text and type it. Instructions on ginfio.com/hacks/autokey
// @match      https://www.nitrotype.com/race/*
// @match https://www.nitrotype.com/race
// @license GNU Affero General Public License v3.0
// ==/UserScript==
 
 

 
function copyText(e) {
	navigator.clipboard.writeText(e)
}

function checkForRaceText() {
	let e = setInterval(function() {
		document.querySelector(".dash-copy") && (copyRaceText(), clearInterval(e))
	}, 1e3)
}

function reload_page() {
	window.location.reload()
}

function checkForDisqualified() {
	setInterval(function() {
		document.querySelector(".modal--raceError") && (copyText("Waiting for race to start..."), reload_page())
	}, 1e4)
}

function after_race() {
    // wait for race to start
	let e = setInterval(function() {
		document.querySelector(".raceResults") && (reload_page(), copyText("Waiting for race to start..."), clearInterval(e))
	}, Math.floor(1e3 * Math.random()))
}

function copyRaceText() {
	setTimeout(function() {
		copyText("start_typing|||" + document.querySelector(".dash-copy").textContent)
		// copy race text
	}, 1e3)
}

function checkForContinueButton() {
	setInterval(function() {
		btns = Array.from(document.querySelectorAll(".btn.btn--primary.btn--fw")), continue_btn = [], 0 < btns.length && (continue_btn = btns.filter(function(e) {
			return e.textContent.includes("ntinue")
		})), 0 < continue_btn.length ? window.location.reload() : console.log("did't find.")
	}, 1e4)
}

function refreshJustIncase() {
	setTimeout(function() {
		window.location.href = "https://www.nitrotype.com/race"
	}, 5e4)
}
after_race(), checkForRaceText(), checkForDisqualified(), checkForContinueButton(), refreshJustIncase();