fix timeline variables example

This commit is contained in:
Josh de Leeuw 2017-06-07 12:43:31 -04:00
parent 8a6267a1a5
commit 5183f46264

View File

@ -15,13 +15,13 @@
</head> </head>
<body> <body>
<div id="jspsych-target"></div>
</body> </body>
<script> <script>
var timeline_variables = [ var timeline_variables = [
{ v1: 'sound/sound.mp3', v2: 'Person A' }, { v1: 'img/happy_face_1.jpg', v2: 'Ann' },
{ v1: 'sound/hammer.mp3', v2: 'Person B' } { v1: 'img/happy_face_2.jpg', v2: 'Jackson' },
{ v1: 'img/happy_face_3.jpg', v2: 'Riley' }
]; ];
var node = { var node = {
@ -35,10 +35,10 @@
is_html: true is_html: true
}, },
{ {
type: 'single-audio', type: 'single-stim',
choices: [89, 78], // Y or N choices: [89, 78], // Y or N
stimulus: function() { return jsPsych.timelineVariable('v1'); }, stimulus: jsPsych.timelineVariable('v1'),
prompt: function() { return '<p class="center-content">Have you seen '+jsPsych.timelineVariable('v2')+ ' before? Y or N.</p>' } prompt: function() { return '<p class="center-content">Have you seen '+jsPsych.timelineVariable('v2', true)+ ' before? Y or N.</p>' }
} }
], ],
randomize_order: true, randomize_order: true,
@ -47,7 +47,7 @@
jsPsych.init({ jsPsych.init({
timeline: [node], timeline: [node],
preload_audio: ['sound/sound.mp3','sound/hammer.mp3'], preload_images: ['img/happy_face_1.jpg', 'img/happy_face_2.jpg', 'img/happy_face_3.jpg'],
on_finish: function() { on_finish: function() {
jsPsych.data.displayData(); jsPsych.data.displayData();
}, },