/** * jspsych-survey-multi-choice * a jspsych plugin for multiple choice survey questions * * Shane Martin * * documentation: docs.jspsych.org * */ jsPsych.plugins['survey-multi-choice'] = (function() { var plugin = {}; plugin.info = { name: 'survey-multi-choice', description: '', parameters: { questions: { type: [jsPsych.plugins.parameterType.STRING], array: true, default: undefined, no_function: false, description: '' }, options: { type: [jsPsych.plugins.parameterType.STRING], array: true, default: undefined, no_function: false, description: '' }, required: { type: [jsPsych.plugins.parameterType.BOOL], array: true, default: false, no_function: false, description: '' }, horitzontal: { type: [jsPsych.plugins.parameterType.BOOL], default: false, no_function: false, description: '' }, preamble: { type: [jsPsych.plugins.parameterType.STRING], default: '', no_function: false, description: '' } } } plugin.trial = function(display_element, trial) { var plugin_id_name = "jspsych-survey-multi-choice"; var plugin_id_selector = '#' + plugin_id_name; var _join = function( /*args*/ ) { var arr = Array.prototype.slice.call(arguments, _join.length); return arr.join(separator = '-'); } // trial defaults trial.preamble = typeof trial.preamble == 'undefined' ? "" : trial.preamble; trial.required = typeof trial.required == 'undefined' ? null : trial.required; trial.horizontal = typeof trial.required == 'undefined' ? false : trial.horizontal; // if any trial variables are functions // this evaluates the function and replaces // it with the output of the function trial = jsPsych.pluginAPI.evaluateFunctionParameters(trial); // inject CSS for trial var node = display_element.innerHTML += '