Answers for "typeracer hack code"

0

typeracer hack code

(() => {
	const typeDelay = 20;

	const txtInput = document.querySelector('.txtInput');
	const textElmParent = document.querySelector(
		'#gwt-uid-15 > table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(1) > td > table > tbody > tr:nth-child(1) > td > div > div:nth-child(1)'
	);
	
	function typeChars(chars, callback) {
		if (chars.length > 0) {
			txtInput.value += chars[0];
			window.setTimeout(() => typeChars(chars.slice(1), callback), typeDelay);
		} else {
			window.setTimeout(callback, typeDelay);
		}
	}
	
	let text = '';
	for (let i = 1, textFragment; (textFragment = textElmParent.querySelector(`:nth-child(${i})`)) !== null; i++) {
		text += textFragment.innerText;
	}
	
	typeChars(text, () => console.log('Done!'));
})();
Posted by: Guest on September-28-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language