mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
1/21/2013
This commit is contained in:
parent
25509c9f86
commit
9651f983a2
@ -19,6 +19,8 @@
|
||||
trials[i]["a_path"] = stims[i];
|
||||
trials[i]["choices"] = params["choices"];
|
||||
// option to show image for fixed time interval, ignoring key responses
|
||||
// true = image will keep displaying after response
|
||||
// false = trial will immediately advance when response is recorded
|
||||
trials[i]["continue_afer_response"] = params["continue_after_response"] || true;
|
||||
// timing parameters
|
||||
trials[i]["timing_stim"] = params["timing_stim"] || -1; // if -1, then show indefinitely
|
||||
@ -61,16 +63,7 @@
|
||||
sikr_trial_complete = true;
|
||||
plugin.trial(display_element, block, trial, part+1);
|
||||
}
|
||||
|
||||
// hide image if timing is set
|
||||
if(trial.timing_stim > 0){
|
||||
setTimeout(function(){
|
||||
if(!sikr_trial_complete){
|
||||
$('#sikr_img').css('visibility','hidden');
|
||||
}
|
||||
}, trial.timing_stim);
|
||||
}
|
||||
|
||||
|
||||
var resp_func = function(e) {
|
||||
var flag = false;
|
||||
// check if the key is any of the options, or if it is an accidental keystroke
|
||||
@ -99,6 +92,15 @@
|
||||
}
|
||||
|
||||
$(document).keyup(resp_func);
|
||||
|
||||
// hide image if timing is set
|
||||
if(trial.timing_stim > 0){
|
||||
setTimeout(function(){
|
||||
if(!sikr_trial_complete){
|
||||
$('#sikr_img').css('visibility','hidden');
|
||||
}
|
||||
}, trial.timing_stim);
|
||||
}
|
||||
|
||||
// end trial if time limit is set
|
||||
if(trial.timing_response > 0)
|
||||
|
@ -47,7 +47,7 @@
|
||||
trials[i]["type"] = "text"; // must match plugin name
|
||||
trials[i]["text"] = params.text[i]; // text of all trials
|
||||
trials[i]["cont_key"] = params.cont_key || '13'; // keycode to press to advance screen, default is ENTER.
|
||||
trials[i]["timing"] = params.timing || [0]; // how long to delay between screens, default is no delay.
|
||||
trials[i]["timing_post_trial"] = params.timing_post_trial || 0; // how long to delay between screens, default is no delay.
|
||||
if(params.variables != undefined)
|
||||
{
|
||||
trials[i]["variables"] = params.variables[i]; // optional variables, defined as functions.
|
||||
@ -82,14 +82,14 @@
|
||||
{
|
||||
$(document).unbind('keyup',key_listener); // remove the response function, so that it doesn't get triggered again.
|
||||
display_element.html(''); // clear the display
|
||||
setTimeout(function(){block.next();}, trial.timing[0]); // call block.next() to advance the experiment after a delay.
|
||||
setTimeout(function(){block.next();}, trial.timing_post_trial); // call block.next() to advance the experiment after a delay.
|
||||
}
|
||||
}
|
||||
|
||||
var mouse_listener = function(e){
|
||||
display_element.unbind('click', mouse_listener); // remove the response function, so that it doesn't get triggered again.
|
||||
display_element.html(''); // clear the display
|
||||
setTimeout(function(){block.next();}, trial.timing[0]); // call block.next() to advance the experiment after a delay.
|
||||
setTimeout(function(){block.next();}, trial.timing_post_trial); // call block.next() to advance the experiment after a delay.
|
||||
}
|
||||
|
||||
// check if key is 'mouse'
|
||||
|
Loading…
Reference in New Issue
Block a user