Nice post! I did something similar but in JS 1.8/jQuery. Now my attempt feels a bit more clumpsy :-)
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)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice post! I did something similar but in JS 1.8/jQuery. Now my attempt feels a bit more clumpsy :-)