Unfortunately, I currently don't have the source code for this online but I'll post it once I stop procrastinating.
"Mr. Universe"- Episode Six
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
var words = document.getElementById('wordlist').innerHTML.split(/\|/),
input = document.getElementById('inputfield'),
pressEvent = document.createEvent("KeyboardEvent"),
pressSpace = function () {
pressEvent.initKeyEvent("keyup", true, true, window, false, false, false, false, 32, false);
input.dispatchEvent(pressEvent);
},
go = function () {
var i = 0, j = words.length;
for (; i < j; ++i) {
input.value += words[i];
pressSpace();
}
};
go();
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
var words = document.getElementById('wordlist').innerHTML.split(/\|/),
input = document.getElementById('inputfield'),
timer = document.getElementById('timer'),
pressEvent = document.createEvent("KeyboardEvent"),
pressSpace = function () {
pressEvent.initKeyEvent("keyup", true, true, window, false, false, false, false, 32, false);
input.dispatchEvent(pressEvent);
},
go = function (delay) {
var current = 0,
worker = setInterval(function () {
if (current == words.length || timer.className) {
clearInterval(worker);
return;
}
input.value += words[current++];
pressSpace();
}, delay);
};
go(60000 / words.length);