Skip to content

Instantly share code, notes, and snippets.

@Mlocik97
Last active October 3, 2022 15:58
Show Gist options
  • Save Mlocik97/d16f971822e0d631ea81bcd4bc277257 to your computer and use it in GitHub Desktop.
Save Mlocik97/d16f971822e0d631ea81bcd4bc277257 to your computer and use it in GitHub Desktop.
10ff.net hack
const overlayNode = document.getElementsByClassName("overlayer").item(0);
const timeout = 20;
const config = {
subtree: true,
characterData: true,
};
const layerObserver = new MutationObserver(mutated);
function mutated(mutations) {
mutations.forEach(function (mutation) {
if (mutation.target.wholeText == "false") {
const inputField = document.getElementsByTagName("input")[0];
const inputEvent = new InputEvent("input");
const interval = setInterval(() => {
try {
let word = document.querySelector(".highlight").textContent;
for (let i = 0; i < word.length; i++) {
inputField.value += word[i];
inputField.dispatchEvent(inputEvent);
setTimeout(timeout);
}
inputField.value += " ";
inputField.dispatchEvent(inputEvent);
inputField.value = "";
} catch {
clearInterval(interval);
}
}, timeout);
}
});
}
layerObserver.observe(overlayNode, config);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment