fix to use evaluateTimelineVariable

This commit is contained in:
jade 2024-11-20 01:51:41 -05:00
parent 6470d4092c
commit 2f859b8887
4 changed files with 7 additions and 7 deletions

View File

@ -387,7 +387,7 @@ Rather than repeating a question format within the same trial, perhaps you want
elements: [ elements: [
{ {
type: "text", type: "text",
title: `Enter a word related to ${jsPsych.timelineVariable('word').toUpperCase()}:`, title: `Enter a word related to ${jsPsych.evaluteTimelineVariable('word').toUpperCase()}:`,
autocomplete: "off" autocomplete: "off"
} }
], ],
@ -416,7 +416,7 @@ Rather than repeating a question format within the same trial, perhaps you want
// Create question using timeline variables // Create question using timeline variables
const page = survey.addNewPage('page1'); const page = survey.addNewPage('page1');
const question = page.addNewQuestion('text'); const question = page.addNewQuestion('text');
question.title = `Enter a word related to ${jsPsych.timelineVariable('word').toUpperCase()}`; question.title = `Enter a word related to ${jsPsych.evaluateTimelineVariable('word').toUpperCase()}`;
question.autocomplete = "off"; question.autocomplete = "off";
// Set survey-level parameters // Set survey-level parameters
survey.showQuestionNumbers = false; survey.showQuestionNumbers = false;

View File

@ -32,7 +32,7 @@
type: jsPsychHtmlKeyboardResponse, type: jsPsychHtmlKeyboardResponse,
stimulus: ()=>{ stimulus: ()=>{
let html = `<div style="width:100vw; height:100vh; position: relative;"> let html = `<div style="width:100vw; height:100vh; position: relative;">
<div style="width:15px; height:15px; border-radius:15px; background-color: #000; position:absolute; top: ${jsPsych.timelineVariable('y')}%; left: ${jsPsych.timelineVariable('x')}%;"></div> <div style="width:15px; height:15px; border-radius:15px; background-color: #000; position:absolute; top: ${jsPsych.evaluateTimelineVariable('y')}%; left: ${jsPsych.evaluateTimelineVariable('x')}%;"></div>
</div>`; </div>`;
return html; return html;
}, },

View File

@ -109,8 +109,8 @@
stimulus: function () { stimulus: function () {
return( return(
`<div style="position: relative; width: 400px; height: 400px;"> `<div style="position: relative; width: 400px; height: 400px;">
<div style="position: absolute; top:${jsPsych.timelineVariable('top', true)}%; left: ${jsPsych.timelineVariable('left', true)}%"> <div style="position: absolute; top:${jsPsych.evaluateTimelineVariable('top', true)}%; left: ${jsPsych.evaluateTimelineVariable('left', true)}%">
<span id="arrow-target" style="font-size: 40px; transform: translate(-50%, -50%);">${jsPsych.timelineVariable('direction', true) == 'left' ? '⬅' : '➡'}</span> <span id="arrow-target" style="font-size: 40px; transform: translate(-50%, -50%);">${jsPsych.evaluateTimelineVariable('direction', true) == 'left' ? '⬅' : '➡'}</span>
</div> </div>
</div>` </div>`
) )

View File

@ -100,7 +100,7 @@
type: jsPsychHtmlKeyboardResponse, type: jsPsychHtmlKeyboardResponse,
stimulus: function () { stimulus: function () {
var html = ` var html = `
<div style="display:flex;width:70%;margin:auto;justify-content:space-around;"><span>${jsPsych.timelineVariable('word1')}</span><span>${jsPsych.timelineVariable('word2')}</span></div>`; <div style="display:flex;width:70%;margin:auto;justify-content:space-around;"><span>${jsPsych.evaluateTimelineVariable('word1')}</span><span>${jsPsych.evaluateTimelineVariable('word2')}</span></div>`;
return html; return html;
}, },
choices: ['f', 'j'], choices: ['f', 'j'],
@ -112,7 +112,7 @@
survey_json: function () { survey_json: function () {
const last_response = jsPsych.data.getLastTrialData().values()[0].response; const last_response = jsPsych.data.getLastTrialData().values()[0].response;
const response_type = (last_response === 'j') ? "RELATED" : "NOT RELATED"; const response_type = (last_response === 'j') ? "RELATED" : "NOT RELATED";
const question_text = `You said that the words "${jsPsych.timelineVariable('word1')}" and "${jsPsych.timelineVariable('word2')}" are ${response_type}. Please explain your answer.`; const question_text = `You said that the words "${jsPsych.evaluateTimelineVariable('word1')}" and "${jsPsych.evaluateTimelineVariable('word2')}" are ${response_type}. Please explain your answer.`;
const survey_json = { const survey_json = {
showQuestionNumbers: false, showQuestionNumbers: false,
completeText: "Next", completeText: "Next",