Inside the _shared are some helper js files, some libraries we call. Some of these are completely external, like jquery and raphael, some of them are written by members of the lab, like mmturkey and utils.
exp.structure=["i0", "instructions", "familiarization", "one_slider", "multi_slider", 'subj_info', 'thanks'];
defines the logical flow of the experiment. Always start with i0 (the consent slide) and move on from there. The functions that use this structure to navigate through the experiment are in stream-V2.js and exp-V2.js. Each slide has several parts:
- the code in the
startfunction is run at the beginning of that block
- if there is a
presentdata structure (which can be a list of objects of any kind), each of these will be passed in, one at a time, to
present_handle, for each trial in that block
present_handlehas the parameter
presentdata structure, and this code is run at the beginning of every trial.
- the code in
buttonis called directly from the html where the button is defined.
_salways refers to the current slide, so you can reference any function you define as a property of the slide by using the
endfunction is run at the end of the block
- you can define any other functions you want inside the slide and call them either with
We've provided a progress bar, which required that you calculate the total number of questions in your experiment (just run
exp.nQs = utils.get_exp_length(); inside the
init function, at some point after
exp.structure is defined). Turkers like this a lot.