mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-12 16:48:12 +00:00
commit
ac5c707516
1997
jspsych.js
1997
jspsych.js
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@
|
|||||||
return trials;
|
return trials;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -114,17 +114,17 @@
|
|||||||
|
|
||||||
jsPsych.pluginAPI.cancelKeyboardResponse(response_listener);
|
jsPsych.pluginAPI.cancelKeyboardResponse(response_listener);
|
||||||
|
|
||||||
block.writeData($.extend({}, {
|
jsPsych.data.write($.extend({}, {
|
||||||
"animation_sequence": JSON.stringify(animation_sequence),
|
"animation_sequence": JSON.stringify(animation_sequence),
|
||||||
"responses": JSON.stringify(responses)
|
"responses": JSON.stringify(responses)
|
||||||
}, trial.data));
|
}, trial.data));
|
||||||
|
|
||||||
if(trial.timing_post_trial > 0){
|
if(trial.timing_post_trial > 0){
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
} else {
|
} else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -21,15 +21,15 @@
|
|||||||
return trials;
|
return trials;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
var return_val = trial.func.apply({}, [trial.args]);
|
var return_val = trial.func.apply({}, [trial.args]);
|
||||||
if (typeof return_val !== 'undefined') {
|
if (typeof return_val !== 'undefined') {
|
||||||
block.writeData($.extend({},{
|
jsPsych.data.write($.extend({},{
|
||||||
value: return_val
|
value: return_val
|
||||||
},trial.data));
|
},trial.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
};
|
};
|
||||||
|
|
||||||
return plugin;
|
return plugin;
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
return trials;
|
return trials;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -135,7 +135,7 @@
|
|||||||
"key_press": info.key
|
"key_press": info.key
|
||||||
};
|
};
|
||||||
|
|
||||||
block.writeData($.extend({}, trial_data, trial.data));
|
jsPsych.data.write($.extend({}, trial_data, trial.data));
|
||||||
|
|
||||||
jsPsych.pluginAPI.cancelKeyboardResponse(keyboard_listener);
|
jsPsych.pluginAPI.cancelKeyboardResponse(keyboard_listener);
|
||||||
|
|
||||||
@ -148,10 +148,10 @@
|
|||||||
display_element.html(''); // clear everything
|
display_element.html(''); // clear everything
|
||||||
if(trial.timing_post_trial > 0){
|
if(trial.timing_post_trial > 0){
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
} else {
|
} else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
var cat_trial_complete = false;
|
var cat_trial_complete = false;
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial, part) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -95,7 +95,7 @@
|
|||||||
"key_press": info.key
|
"key_press": info.key
|
||||||
};
|
};
|
||||||
|
|
||||||
block.writeData($.extend({}, trial_data, trial.data));
|
jsPsych.data.write($.extend({}, trial_data, trial.data));
|
||||||
|
|
||||||
display_element.html('');
|
display_element.html('');
|
||||||
|
|
||||||
@ -157,10 +157,10 @@
|
|||||||
display_element.html("");
|
display_element.html("");
|
||||||
if (trial.timing_post_trial > 0) {
|
if (trial.timing_post_trial > 0) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
} else {
|
} else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
return trials;
|
return trials;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -116,7 +116,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
block.writeData($.extend({}, {
|
jsPsych.data.write($.extend({}, {
|
||||||
"init_locations": JSON.stringify(init_locations),
|
"init_locations": JSON.stringify(init_locations),
|
||||||
"moves": JSON.stringify(moves),
|
"moves": JSON.stringify(moves),
|
||||||
"final_locations": JSON.stringify(final_locations),
|
"final_locations": JSON.stringify(final_locations),
|
||||||
@ -127,11 +127,11 @@
|
|||||||
display_element.html("");
|
display_element.html("");
|
||||||
if (trial.timing_post_trial > 0) {
|
if (trial.timing_post_trial > 0) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
@ -29,7 +29,7 @@ documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-html
|
|||||||
return trials;
|
return trials;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -46,7 +46,7 @@ documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-html
|
|||||||
var finish = function() {
|
var finish = function() {
|
||||||
if (trial.check_fn && !trial.check_fn(display_element)) return;
|
if (trial.check_fn && !trial.check_fn(display_element)) return;
|
||||||
if (trial.cont_key) $(document).unbind('keydown', key_listener);
|
if (trial.cont_key) $(document).unbind('keydown', key_listener);
|
||||||
block.writeData({
|
jsPsych.data.write({
|
||||||
rt: (new Date()).getTime() - t0,
|
rt: (new Date()).getTime() - t0,
|
||||||
url: trial.url
|
url: trial.url
|
||||||
});
|
});
|
||||||
@ -56,12 +56,12 @@ documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-html
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
display_element.empty();
|
display_element.empty();
|
||||||
display_element.show();
|
display_element.show();
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing);
|
}, trial.timing);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
display_element.empty();
|
display_element.empty();
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (trial.cont_btn) $('#' + trial.cont_btn).click(finish);
|
if (trial.cont_btn) $('#' + trial.cont_btn).click(finish);
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
return trials;
|
return trials;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -257,7 +257,7 @@
|
|||||||
var n_diff = arrayDifferences(trial.configurations, lineIsVisible);
|
var n_diff = arrayDifferences(trial.configurations, lineIsVisible);
|
||||||
var correct = (n_diff === 0);
|
var correct = (n_diff === 0);
|
||||||
|
|
||||||
block.writeData($.extend({}, {
|
jsPsych.data.write($.extend({}, {
|
||||||
"configuration": JSON.stringify(lineIsVisible),
|
"configuration": JSON.stringify(lineIsVisible),
|
||||||
"target_configuration": JSON.stringify(trial.configurations),
|
"target_configuration": JSON.stringify(trial.configurations),
|
||||||
"rt": response_time,
|
"rt": response_time,
|
||||||
@ -302,11 +302,11 @@
|
|||||||
// next trial
|
// next trial
|
||||||
if (trial.timing_post_trial > 0) {
|
if (trial.timing_post_trial > 0) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
var sd_trial_complete = false;
|
var sd_trial_complete = false;
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial, part) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -122,16 +122,16 @@
|
|||||||
"stimulus_2": trial.b_path,
|
"stimulus_2": trial.b_path,
|
||||||
"key_press": info.key
|
"key_press": info.key
|
||||||
};
|
};
|
||||||
block.writeData($.extend({}, trial_data, trial.data));
|
jsPsych.data.write($.extend({}, trial_data, trial.data));
|
||||||
|
|
||||||
display_element.html('');
|
display_element.html('');
|
||||||
|
|
||||||
if (trial.timing_post_trial > 0) {
|
if (trial.timing_post_trial > 0) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
} else {
|
} else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
var sim_trial_complete = false;
|
var sim_trial_complete = false;
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -63,7 +63,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (trial.show_response == "FIRST_STIMULUS") {
|
if (trial.show_response == "FIRST_STIMULUS") {
|
||||||
show_response_slider(display_element, trial, block);
|
show_response_slider(display_element, trial);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@ -91,7 +91,7 @@
|
|||||||
$('#jspsych_sim_stim').css('visibility', 'visible');
|
$('#jspsych_sim_stim').css('visibility', 'visible');
|
||||||
|
|
||||||
if (trial.show_response == "SECOND_STIMULUS") {
|
if (trial.show_response == "SECOND_STIMULUS") {
|
||||||
show_response_slider(display_element, trial, block);
|
show_response_slider(display_element, trial);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trial.timing_second_stim > 0) {
|
if (trial.timing_second_stim > 0) {
|
||||||
@ -99,7 +99,7 @@
|
|||||||
if (!sim_trial_complete) {
|
if (!sim_trial_complete) {
|
||||||
$("#jspsych_sim_stim").css('visibility', 'hidden');
|
$("#jspsych_sim_stim").css('visibility', 'hidden');
|
||||||
if (trial.show_response == "POST_STIMULUS") {
|
if (trial.show_response == "POST_STIMULUS") {
|
||||||
show_response_slider(display_element, trial, block);
|
show_response_slider(display_element, trial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, trial.timing_second_stim);
|
}, trial.timing_second_stim);
|
||||||
@ -107,7 +107,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function show_response_slider(display_element, trial, block) {
|
function show_response_slider(display_element, trial) {
|
||||||
|
|
||||||
var startTime = (new Date()).getTime();
|
var startTime = (new Date()).getTime();
|
||||||
|
|
||||||
@ -195,7 +195,7 @@
|
|||||||
var response_time = endTime - startTime;
|
var response_time = endTime - startTime;
|
||||||
sim_trial_complete = true;
|
sim_trial_complete = true;
|
||||||
var score = $("#slider").slider("value");
|
var score = $("#slider").slider("value");
|
||||||
block.writeData($.extend({}, {
|
jsPsych.data.write($.extend({}, {
|
||||||
"sim_score": score,
|
"sim_score": score,
|
||||||
"rt": response_time,
|
"rt": response_time,
|
||||||
"stimulus": trial.a_path,
|
"stimulus": trial.a_path,
|
||||||
@ -205,10 +205,10 @@
|
|||||||
display_element.html('');
|
display_element.html('');
|
||||||
if (trial.timing_post_trial > 0) {
|
if (trial.timing_post_trial > 0) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
} else {
|
} else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -85,7 +85,7 @@
|
|||||||
"key_press": info.key
|
"key_press": info.key
|
||||||
};
|
};
|
||||||
|
|
||||||
block.writeData($.extend({}, trial_data, trial.data));
|
jsPsych.data.write($.extend({}, trial_data, trial.data));
|
||||||
|
|
||||||
// clear the display
|
// clear the display
|
||||||
display_element.html('');
|
display_element.html('');
|
||||||
@ -93,10 +93,10 @@
|
|||||||
// move on to the next trial
|
// move on to the next trial
|
||||||
if (trial.timing_post_trial > 0) {
|
if (trial.timing_post_trial > 0) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
} else {
|
} else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
return trials;
|
return trials;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -143,7 +143,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// save data
|
// save data
|
||||||
block.writeData($.extend({}, {
|
jsPsych.data.write($.extend({}, {
|
||||||
"rt": response_time
|
"rt": response_time
|
||||||
}, question_data, trial.data));
|
}, question_data, trial.data));
|
||||||
|
|
||||||
@ -151,9 +151,9 @@
|
|||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
if(trial.timing_post_trial > 0){
|
if(trial.timing_post_trial > 0){
|
||||||
setTimeout(function(){ block.next(); }, trial.timing_post_trial);
|
setTimeout(function(){ jsPsych.finishTrial(); }, trial.timing_post_trial);
|
||||||
} else {
|
} else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
return trials;
|
return trials;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -70,7 +70,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// save data
|
// save data
|
||||||
block.writeData($.extend({}, {
|
jsPsych.data.write($.extend({}, {
|
||||||
"rt": response_time
|
"rt": response_time
|
||||||
}, question_data, trial.data));
|
}, question_data, trial.data));
|
||||||
|
|
||||||
@ -78,9 +78,9 @@
|
|||||||
|
|
||||||
// next trial
|
// next trial
|
||||||
if(trial.timing_post_trial > 0){
|
if(trial.timing_post_trial > 0){
|
||||||
setTimeout(function(){ block.next(); }, trial.timing_post_trial);
|
setTimeout(function(){ jsPsych.finishTrial(); }, trial.timing_post_trial);
|
||||||
} else {
|
} else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
return trials;
|
return trials;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -45,12 +45,12 @@
|
|||||||
|
|
||||||
if (trial.timing_post_trial > 0) {
|
if (trial.timing_post_trial > 0) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
} // call block.next() to advance the experiment after a delay.
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -73,7 +73,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function save_data(key, rt) {
|
function save_data(key, rt) {
|
||||||
block.writeData($.extend({}, {
|
jsPsych.data.write($.extend({}, {
|
||||||
"rt": rt,
|
"rt": rt,
|
||||||
"key_press": key
|
"key_press": key
|
||||||
}, trial.data));
|
}, trial.data));
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
return trials;
|
return trials;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
trial = jsPsych.pluginAPI.normalizeTrialVariables(trial);
|
trial = jsPsych.pluginAPI.normalizeTrialVariables(trial);
|
||||||
|
|
||||||
@ -169,15 +169,15 @@
|
|||||||
|
|
||||||
// this line merges together the trial_data object and the generic
|
// this line merges together the trial_data object and the generic
|
||||||
// data object (trial.data), and then stores them.
|
// data object (trial.data), and then stores them.
|
||||||
block.writeData($.extend({}, trial_data, trial.data));
|
jsPsych.data.write($.extend({}, trial_data, trial.data));
|
||||||
|
|
||||||
// go to next trial
|
// go to next trial
|
||||||
if(trial.timing_post_trial > 0){
|
if(trial.timing_post_trial > 0){
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
} else {
|
} else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
return trials;
|
return trials;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -144,18 +144,18 @@
|
|||||||
|
|
||||||
jsPsych.pluginAPI.cancelKeyboardResponse(key_listener);
|
jsPsych.pluginAPI.cancelKeyboardResponse(key_listener);
|
||||||
|
|
||||||
block.writeData($.extend({}, {
|
jsPsych.data.write($.extend({}, {
|
||||||
"stimuli": JSON.stringify(trial.stims),
|
"stimuli": JSON.stringify(trial.stims),
|
||||||
"responses": JSON.stringify(responses)
|
"responses": JSON.stringify(responses)
|
||||||
}, trial.data));
|
}, trial.data));
|
||||||
|
|
||||||
if (trial.timing_post_trial > 0) {
|
if (trial.timing_post_trial > 0) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
return trials;
|
return trials;
|
||||||
};
|
};
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -48,17 +48,17 @@
|
|||||||
|
|
||||||
display_element.html('');
|
display_element.html('');
|
||||||
|
|
||||||
block.writeData($.extend({}, {
|
jsPsych.data.write($.extend({}, {
|
||||||
"stimuli": JSON.stringify(trial.stimuli)
|
"stimuli": JSON.stringify(trial.stimuli)
|
||||||
}, trial.data));
|
}, trial.data));
|
||||||
|
|
||||||
if (trial.timing_post_trial > 0) {
|
if (trial.timing_post_trial > 0) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
var xab_trial_complete = false;
|
var xab_trial_complete = false;
|
||||||
|
|
||||||
plugin.trial = function(display_element, block, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// if any trial variables are functions
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -162,7 +162,7 @@
|
|||||||
"stimulus_b": trial.b_path,
|
"stimulus_b": trial.b_path,
|
||||||
"key_press": info.key
|
"key_press": info.key
|
||||||
};
|
};
|
||||||
block.writeData($.extend({}, trial_data, trial.data));
|
jsPsych.data.write($.extend({}, trial_data, trial.data));
|
||||||
|
|
||||||
display_element.html(''); // remove all
|
display_element.html(''); // remove all
|
||||||
|
|
||||||
@ -171,10 +171,10 @@
|
|||||||
// move on to the next trial after timing_post_trial milliseconds
|
// move on to the next trial after timing_post_trial milliseconds
|
||||||
if (trial.timing_post_trial > 0) {
|
if (trial.timing_post_trial > 0) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}, trial.timing_post_trial);
|
}, trial.timing_post_trial);
|
||||||
} else {
|
} else {
|
||||||
block.next();
|
jsPsych.finishTrial();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user