Skip to content

Instantly share code, notes, and snippets.

@stanographer
Forked from morinted/README.md
Last active July 19, 2021 13:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stanographer/04303156582960e1782d3edd81236469 to your computer and use it in GitHub Desktop.
Save stanographer/04303156582960e1782d3edd81236469 to your computer and use it in GitHub Desktop.
Remove TypeRacer Input limit

This script removes the input length limit which can trip up Plover users.

Simply install the script into TamperMonkey (Chrome) or GreaseMonkey (Firefox) and get racing.

The script was created by community member nimble

// ==UserScript==
// @name Typeracer - No input limit
// @namespace https://opensteno.org/
// @version 0.2
// @description no more TypeRacer length limit
// @author nimble
// @match https://play.typeracer.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
let inputBox = document.getElementsByClassName('txtInput');
const inputOptions = {
attributes: true,
attributeList: ['maxLength'],
};
const bodyOptions = {
childList: true,
subtree: true,
};
const maxLengthObserver = new MutationObserver(mutations => {
mutations.forEach(mutation => {
mutation.target.removeAttribute('maxlength');
});
});
new MutationObserver(() => {
for (let node of inputBox) {
maxLengthObserver.observe(node, inputOptions);
}
}).observe(document.body, bodyOptions);
})();
@user202729
Copy link

subTree should be subtree. JavaScript is case-sensitive. (however the current script still works because it isn't necessary to listen for subtree changes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment