Reply To: varying word presentation depending on length

PennController for IBEX Forums Support varying word presentation depending on length Reply To: varying word presentation depending on length

#6377
Jeremy
Keymaster

Hi Yana,

I think you’re doing the right thing inserting your code in the wordPauseTimeout function, but when I open the js file I see that line 152 is part of the wordTimeout function, so I just want to make sure you’re editing the right function.

However I’m afraid that directly modifying t.wordTime will cause problems after encountering the first over-12-character word, because the subsequent words will inherit the extra duration. Here is how I rewrote the whole if statement, and it seems to be working smoothly:

if (this.mode == "speeded acceptability") {
    var t = this;
    function wordTimeout() {
        t.blankWord(t.currentWord);
        ++(t.currentWord);
        if (t.currentWord >= t.stoppingPoint)
            t.finishedCallback([[["Sentence (or sentence MD5)", t.sentenceDesc]]]);
        else
            t.utils.setTimeout(wordPauseTimeout, t.wordPauseTime);
    }
    function wordPauseTimeout() {
        t.showWord(t.currentWord);
        t.utils.clearTimeout(wordPauseTimeout);
        let duration = t.wordTime;
        if (t.words[t.currentWord].length > 12) {
            var extraTime = (t.words[t.currentWord].length - 12) * 200;
            duration += extraTime;
        }
        t.utils.setTimeout(wordTimeout, duration);
    }
    wordPauseTimeout();
}

I used 200 so I could clearly tell when the extra time was added to the normal display time. For reference, here are the parameters I used to test the DashedSentence:

{
  s: "Extralongitudinal is not a word that makes much anticonstitutional sense",
  wordTime: 250,
  mode: "speeded acceptability"
}

Jeremy