Created
July 1, 2014 17:28
-
-
Save pedroxs/5aed2d3d8603547f444a 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
| /* | |
| * helper function for fast typing on | |
| * http://10fastfingers.com/ | |
| * | |
| * 200 ms seems good enough | |
| */ | |
| function Gambi(interval) { | |
| var timerId, start, stop, getId, currentWord; | |
| start = function() { | |
| timerId = window.setInterval(function() { | |
| var word = jQuery('span.highlight'); | |
| if(!currentWord || currentWord.text() !== word.text()) { | |
| currentWord = word; | |
| jQuery('#inputfield').val(currentWord.text()); | |
| } | |
| }, interval); | |
| }; | |
| stop = function() { | |
| window.clearInterval(timerId); | |
| }; | |
| getId = function() { return timerId; }; | |
| return { | |
| id: getId, | |
| start: start, | |
| stop: stop | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment