PennController for IBEX › Forums › Support › Bidirectional self-paced reading › Reply To: Bidirectional self-paced reading
July 7, 2022 at 1:57 pm
#8262
Jeremy
Keymaster
Hi Jun,
You’ll have to edit DashedSentence.js in the Modules folder and replace the conditional on "self-paced reading"
toward the top with a simple if (this.mode == "self-paced reading") this.sprResults = [];
. Then replace the safeBind
piece of code further down with this:
this.safeBind($(document), 'keydown', function(e) { var time = new Date().getTime(); var code = e.keyCode; if (code == 37 || code == 39) { var word = t.currentWord; if (word > 0 && word <= t.stoppingPoint) t.sprResults.push([time,t.previousTime,word]); t.previousTime = time; if (code == 37){ if (code != t.lastKey) t.currentWord--; if (t.currentWord < t.stoppingPoint) t.blankWord(t.currentWord); if (t.currentWord - 1 >= 0) t.showWord(t.currentWord - 1); t.currentWord--; if (t.currentWord<0) t.currentWord = 0; } else if (code == 39){ if (t.currentWord>0 && code != t.lastKey) t.currentWord++; if (t.currentWord - 1 >= 0) t.blankWord(t.currentWord - 1); if (t.currentWord < t.stoppingPoint) t.showWord(t.currentWord); t.currentWord++; if (t.currentWord > t.stoppingPoint) { t.processSprResults(); t.finishedCallback(t.resultsLines); } } t.lastKey = code; return false; // *** } else { return true; } });
And the processSprResults
piece of code toward the end of the script with this:
processSprResults: function () { for (var i = 0; i < this.sprResults.length; ++i) { var n = this.sprResults[i][2]; this.resultsLines.push([ ["Word number", n], ["Word", csv_url_encode(this.words[n-1]||"")], ["Reading time", this.sprResults[i][0] - this.sprResults[i][1]], ["Newline?", (! this.display == "in place") && boolToInt(((n+1) < this.wordOSpans.length) && (this.wordOSpans[n].offset().top != this.wordOSpans[n+1].offset().top))], ["Sentence (or sentence MD5)", this.sentenceDesc] ]); } }
Jeremy