Bidirectional self-paced reading

PennController for IBEX Forums Support Bidirectional self-paced reading

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #8253
    JunLyu
    Participant

    Hi Jeremy,

    I wonder how we can make a self-paced reading task bidirectional, where participants can regress to the previous regions. What things should change based on a typical mono-directional self-paced reading script? Also, any links/resources would be greatly appreciated!

    Thank you!
    Jun

    #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

    #8264
    JunLyu
    Participant

    Thank you!! I will try that.

    #10619
    jjgreen
    Participant

    I just tried doing this, but the words all show up on the screen together, and only disappear once I’ve moved past them. Any suggestions?

    Here’s my simple implementation: https://farm.pcibex.net/r/GgVLoq/

    #10623
    Jeremy
    Keymaster

    Hi,

    Since you’ve created a new controller instead of just editing DashedSentence.js, you’ll need to create a file in the Aesthetics folder named BidirectionalDashedSentence.css in which you paste the same rules that already exist in DashedSentence.css

    Jeremy

    #10665
    jjgreen
    Participant

    Oh I see. Thank you!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.