Skip to content

Instantly share code, notes, and snippets.

@zavan
Created June 2, 2020 22:20
Show Gist options
  • Save zavan/c86a12d2ce78c1301dc97572aa1e2d90 to your computer and use it in GitHub Desktop.
Save zavan/c86a12d2ce78c1301dc97572aa1e2d90 to your computer and use it in GitHub Desktop.
Fooling typing.com and breaking records
// 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