mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00

1 - Modified animation library to allow for prompt to be displayed while animation is displayed. Prompt is optional. 2 - Added two categorization plugins, one for training and one for testing. 3 - Started fixing IE issues. Two major problems have been identified and started to be corrected. First: setTimeout() behaves differently in IE; optional parameters mean different things. Starting to rewrite all setTimeout calls so they work cross-browser. Second: Some of the plugins were using .setAttribute to give a class to an image, so that it could later be removed. IE and others have different methods to do this. Fix is to use jQuery for all of this, which has cross-browser methods. 4 - As a result of 3B, I'm going to deprecate the jsPsych.showImage and jsPsych.showImages functions. They seemed out of place anyways.
28 lines
664 B
JavaScript
Executable File
28 lines
664 B
JavaScript
Executable File
function text_create(params)
|
|
{
|
|
var trials = new Array(params.text.length);
|
|
for(var i = 0; i < trials.length; i++)
|
|
{
|
|
trials[i] = {};
|
|
trials[i]["type"] = "text";
|
|
trials[i]["text"] = params.text[i];
|
|
trials[i]["cont_key"] = params.cont_key;
|
|
trials[i]["timing"] = params.timing;
|
|
}
|
|
return trials;
|
|
}
|
|
|
|
function text_trial($this, block, trial, part)
|
|
{
|
|
$this.html(trial.text);
|
|
var key_listener = function(e) {
|
|
if(e.which==trial.cont_key)
|
|
{
|
|
flag = true;
|
|
$(document).unbind('keyup',key_listener);
|
|
$this.html('');
|
|
setTimeout(function(){block.next();}, trial.timing[0]);
|
|
}
|
|
}
|
|
$(document).keyup(key_listener);
|
|
} |