Created
April 17, 2020 16:13
-
-
Save 0x04/f1440ea85aa3cb7c551f148ac9d23630 to your computer and use it in GitHub Desktop.
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
var hackInput = document.querySelector('#inputfield') | |
var hackHighlight = null | |
var hackCurrent = 0 | |
var hackInterval = 0 | |
function hack() { | |
hackHighlight = document.querySelector('#row1 .highlight') | |
if (!hackHighlight) { | |
clearInterval(hackInterval) | |
return | |
} | |
hackType() | |
} | |
function hackType() { | |
var down = new $.Event('keydown') | |
var up = new $.Event('keyup') | |
var value = hackHighlight.innerText.slice(0, hackCurrent + 1) | |
if (hackCurrent < hackHighlight.innerText.length) { | |
down.which = up.which = hackHighlight.innerText.slice(hackCurrent++, 1) | |
} else { | |
down.which = up.which = 32 | |
value += ' ' | |
hackCurrent = 0 | |
} | |
console.info(value) | |
$(document).trigger(down) | |
$(hackInput).val(value) | |
$(hackInput).trigger(up) | |
$(document).trigger(up) | |
} | |
hackInterval = setInterval(hack, 25) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment