/** * jspsych-single-stim * Josh de Leeuw * * plugin for displaying a stimulus and getting a keyboard response * * documentation: docs.jspsych.org * **/ jsPsych.plugins["iat"] = (function() { var plugin = {}; jsPsych.pluginAPI.registerPreload('iat', 'stimulus', 'image'); plugin.trial = function(display_element, trial) { var plugin_id_name = "jspsych-iat"; var plugin_id_selector = '#' + plugin_id_name; var _join = function( /*args*/ ) { var arr = Array.prototype.slice.call(arguments, _join.length); return arr.join(separator = '-'); } // if any trial variables are functions // this evaluates the function and replaces // it with the output of the function trial = jsPsych.pluginAPI.evaluateFunctionParameters(trial); // set default values for the parameters trial.display_feedback = trial.display_feedback || false; trial.image_when_wrong = trial.image_when_wrong || 'undefined'; trial.left_category_key = trial.left_category_key || 'e'; trial.right_category_key = trial.right_category_key || 'i'; trial.left_category_label = trial.left_category_label || ['left']; trial.right_category_label = trial.right_category_label || ['right']; trial.stim_key_association = trial.stim_key_association || 'undefined'; trial.response_ends_trial = (typeof trial.response_ends_trial == 'undefined') ? true : trial.response_ends_trial; trial.key_to_move_forward = trial.key_to_move_forward || jsPsych.ALL_KEYS; trial.is_html = (typeof trial.is_html == 'undefined') ? false : trial.is_html; trial.prompt = trial.prompt || ""; //Creates extra styling needed var node = display_element.innerHTML += "