Created
June 2, 2020 22:20
-
-
Save zavan/c86a12d2ce78c1301dc97572aa1e2d90 to your computer and use it in GitHub Desktop.
Fooling typing.com and breaking records
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Just open a test page on typing.com and run this on the browser console: | |
// Tested on Safari. | |
// If you get errors, increase the setTimeout time. | |
$('.letter').each(function(i) { | |
setTimeout(() => { | |
const text = $(this).text(); | |
let char = text; | |
let charCode = char.charCodeAt(0); | |
if (text.trim() === '') { | |
char = ' '; | |
charCode = 32; | |
} | |
console.log(`Typing "${char}" (${charCode}) - ${i}`); | |
let e = $.Event('keydown'); | |
e.type = 'keydown'; | |
e.key = char; | |
e.which = e.keyCode = charCode; | |
e.isTrusted = true; | |
e.preventDefault = function() {}; | |
e.stopPropagation = function() {}; | |
e.originalEvent = Object.assign({}, e); | |
$('.js-input-box').trigger(e); | |
}, i*10); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment