Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions js_includes/DashedSentence.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ jqueryWidget: {
this.utils.setTimeout(wordTimeout, this.wordTime);
}
else if (this.mode == "self-paced reading") {
var t = this;
var keyDown = false;
// keep track of pressed keys
var t = this;
// Inlining this to minimize function calls in code for updating screen after space is pressed.
/* function goToNext(time) {
t.recordSprResult(time, t.currentWord);
Expand All @@ -177,8 +179,10 @@ jqueryWidget: {
this.safeBind($(document), 'keydown', function(e) {
var time = new Date().getTime();
var code = e.keyCode;

if (code == 32) {

// only continue if the key was released
if (code == 32 && !keyDown) {
keyDown = true;
// *** goToNext() ***
// t.recordSprResult(time, t.currentWord);
var word = t.currentWord;
Expand All @@ -205,6 +209,12 @@ jqueryWidget: {
return true;
}
});

// once the space key is released, allow its use again
this.safeBind($(document), 'keyup', function(e) {
var code = e.keyCode;
keyDown = false;
})

// For iPhone/iPod touch -- add button for going to next word.
if (isIPhone) {
Expand Down