Skip to content

Instantly share code, notes, and snippets.

@thegamerx1
Forked from SitanHuang/typeracer.hack.js
Last active July 26, 2022 04:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thegamerx1/22e6d6ceb4c2d8001fbaee792062ea6a to your computer and use it in GitHub Desktop.
Save thegamerx1/22e6d6ceb4c2d8001fbaee792062ea6a to your computer and use it in GitHub Desktop.
Typeracer 100% hack
function sleep(ms) {return new Promise(resolve => setTimeout(resolve, ms));}
function triggerKeyboardEvent(e,t,n){var c=document.createEventObject?document.createEventObject():document.createEvent("Events");c.initEvent&&c.initEvent(n,!0,!0),c.keyCode=t,c.which=t,e.dispatchEvent?e.dispatchEvent(c):e.fireEvent("onkeydown",c)}
$=$$
content = $('table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(1) > td > table > tbody > tr:nth-child(1) > td > div > div')[3].textContent.split('');
i = 0;
function a() {
if (i == content.length) return;
input = $('table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td > input')[0]
input.focus()
input.value += content[i++];
triggerKeyboardEvent(input, input.value.charCodeAt(0), "keydown")
input.click()
triggerKeyboardEvent(input, input.value.charCodeAt(0), "keypress")
triggerKeyboardEvent(input, input.value.charCodeAt(0), "keyup")
setTimeout(a, 50 * Math.random())
}
function checkFlag() {
checkfor = $('div.popupContent > table > tbody > tr > td > table > tbody > tr > td > div.timeDisplay > span.time')[0].textContent
checkfor = checkfor.replace(/([:])/g, "")
if (checkfor == 0) {
setTimeout(a, 550)
} else {
console.log(checkfor)
window.setTimeout(checkFlag, 250)
}
}
checkFlag()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment