/** * jspsych-survey-likert * a jspsych plugin for measuring items on a likert scale * * Josh de Leeuw * * documentation: docs.jspsych.org * */ jsPsych.plugins['survey-likert'] = (function() { var plugin = {}; plugin.info = { name: 'survey-likert', description: '', parameters: { questions: { type: [jsPsych.plugins.parameterType.STRING], array: true, default: undefined, no_function: false, description: '' }, labels: { 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: '' }, button_label: { type: [jsPsych.plugins.parameterType.STRING], default: 'Next', no_function: false, description: '' } } } plugin.trial = function(display_element, trial) { // default parameters for the trial trial.preamble = typeof trial.preamble === 'undefined' ? "" : trial.preamble; trial.required = typeof trial.required === 'undefined' ? false : trial.required; trial.button_label = typeof trial.button_label === 'undefined' ? 'Next' : trial.button_label; // if any trial variables are functions // this evaluates the function and replaces // it with the output of the function trial = jsPsych.pluginAPI.evaluateFunctionParameters(trial); var html = ""; // inject CSS for trial html += ''; // show preamble text html += '