From eb3fb3d66265134b104a3b088bec389e185243ba Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Mon, 27 Jun 2016 17:04:00 -0400 Subject: [PATCH] more plugin.info work (#270) --- plugins/jspsych-survey-text.js | 19 ++++- plugins/jspsych-text.js | 21 +++++ plugins/jspsych-video.js | 44 +++++++++- plugins/jspsych-visual-search-circle.js | 100 ++++++++++++++++++----- plugins/jspsych-vsl-animate-occlusion.js | 2 +- 5 files changed, 160 insertions(+), 26 deletions(-) diff --git a/plugins/jspsych-survey-text.js b/plugins/jspsych-survey-text.js index eb37147f..b0cf3057 100644 --- a/plugins/jspsych-survey-text.js +++ b/plugins/jspsych-survey-text.js @@ -14,7 +14,7 @@ jsPsych.plugins['survey-text'] = (function() { var plugin = {}; plugin.info = { - name: 'survey-multi-choice', + name: 'survey-text', description: '', parameters: { questions: { @@ -24,10 +24,23 @@ jsPsych.plugins['survey-text'] = (function() { no_function: false, description: '' }, - labels: { + premable: { type: [jsPsych.plugins.parameterType.STRING], + default: '', + no_function: false, + description: '' + }, + rows: { + type: [jsPsych.plugins.parameterType.INT], array: true, - default: undefined, + default: 1, + no_function: false, + description: '' + }, + columns: { + type: [jsPsych.plugins.parameterType.INT], + array: true, + default: 40, no_function: false, description: '' } diff --git a/plugins/jspsych-text.js b/plugins/jspsych-text.js index 7d3cd5bb..93437649 100644 --- a/plugins/jspsych-text.js +++ b/plugins/jspsych-text.js @@ -13,6 +13,27 @@ jsPsych.plugins.text = (function() { var plugin = {}; + plugin.info = { + name: 'text', + description: '', + parameters: { + text: { + type: [jsPsych.plugins.parameterType.STRING], + default: undefined, + no_function: false, + description: '' + }, + cont_key: { + type: [jsPsych.plugins.parameterType.KEYCODE, jsPsych.plugins.parameterType.SELECT], + options: ['mouse'], + array: true, + default: undefined, + no_function: false, + description: '' + } + } + } + plugin.trial = function(display_element, trial) { trial.cont_key = trial.cont_key || []; diff --git a/plugins/jspsych-video.js b/plugins/jspsych-video.js index 7915ae8c..a7626d3a 100644 --- a/plugins/jspsych-video.js +++ b/plugins/jspsych-video.js @@ -11,7 +11,49 @@ jsPsych.plugins.video = (function() { var plugin = {}; - //jsPsych.pluginAPI.registerPreload('single-stim', 'stimulus', 'image'); + plugin.info = { + name: 'video', + description: '', + parameters: { + sources: { + type: [jsPsych.plugins.parameterType.STRING], + array: true, + default: undefined, + no_function: false, + description: '' + }, + width: { + type: [jsPsych.plugins.parameterType.INT], + default: undefined, + no_function: false, + description: '' + }, + height: { + type: [jsPsych.plugins.parameterType.INT], + default: undefined, + no_function: false, + description: '' + }, + autoplay: { + type: [jsPsych.plugins.parameterType.BOOL], + default: true, + no_function: false, + description: '' + }, + controls: { + type: [jsPsych.plugins.parameterType.BOOL], + default: false, + no_function: false, + description: '' + }, + prompt: { + type: [jsPsych.plugins.parameterType.STRING], + default: '', + no_function: false, + description: '' + } + } + } plugin.trial = function(display_element, trial) { diff --git a/plugins/jspsych-visual-search-circle.js b/plugins/jspsych-visual-search-circle.js index d2f0bbc7..2d137448 100644 --- a/plugins/jspsych-visual-search-circle.js +++ b/plugins/jspsych-visual-search-circle.js @@ -22,28 +22,86 @@ jsPsych.plugins["visual-search-circle"] = (function() { jsPsych.pluginAPI.registerPreload('visual-search-circle', 'foil', 'image'); jsPsych.pluginAPI.registerPreload('visual-search-circle', 'fixation_image', 'image'); - plugin.create = function(params) { - - var trials = new Array(params.target_present.length); - - for (var i = 0; i < trials.length; i++) { - trials[i] = {}; - trials[i].target_present = params.target_present[i]; - trials[i].set_size = params.set_size[i]; - trials[i].target = params.target; - trials[i].foil = params.foil; - trials[i].fixation_image = params.fixation_image; - trials[i].target_size = params.target_size || [50, 50]; - trials[i].fixation_size = params.fixation_size || [16, 16]; - trials[i].circle_diameter = params.circle_diameter || 250; - trials[i].target_present_key = params.target_present_key || 74; - trials[i].target_absent_key = params.target_absent_key || 70; - trials[i].timing_max_search = (typeof params.timing_max_search === 'undefined') ? -1 : params.timing_max_search; - trials[i].timing_fixation = (typeof params.timing_fixation === 'undefined') ? 1000 : params.timing_fixation; + plugin.info = { + name: 'visual-search-circle', + description: '', + parameters: { + target: { + type: [jsPsych.plugins.parameterType.STRING], + default: undefined, + no_function: false, + description: '' + }, + foil: { + type: [jsPsych.plugins.parameterType.STRING], + default: undefined, + no_function: false, + description: '' + }, + fixation_image: { + type: [jsPsych.plugins.parameterType.STRING], + default: undefined, + no_function: false, + description: '' + }, + set_size: { + type: [jsPsych.plugins.parameterType.INT], + default: undefined, + no_function: false, + description: '' + }, + target_present: { + type: [jsPsych.plugins.parameterType.BOOL], + default: true, + no_function: false, + description: '' + }, + target_size: { + type: [jsPsych.plugins.parameterType.INT], + array: true, + default: 50, + no_function: false, + description: '' + }, + fixation_size: { + type: [jsPsych.plugins.parameterType.INT], + array: true, + default: 16, + no_function: false, + description: '' + }, + circle_diameter: { + type: [jsPsych.plugins.parameterType.INT], + default: 250, + no_function: false, + description: '' + }, + target_present_key: { + type: [jsPsych.plugins.parameterType.KEYCODE], + default: 'j', + no_function: false, + description: '' + }, + target_absent_key: { + type: [jsPsych.plugins.parameterType.KEYCODE], + default: 'f', + no_function: false, + description: '' + }, + timing_max_search: { + type: [jsPsych.plugins.parameterType.INT], + default: -1, + no_function: false, + description: '' + }, + timing_fixation: { + type: [jsPsych.plugins.parameterType.INT], + default: 1000, + no_function: false, + description: '' + } } - - return trials; - }; + } plugin.trial = function(display_element, trial) { diff --git a/plugins/jspsych-vsl-animate-occlusion.js b/plugins/jspsych-vsl-animate-occlusion.js index ac028c01..824ab46a 100644 --- a/plugins/jspsych-vsl-animate-occlusion.js +++ b/plugins/jspsych-vsl-animate-occlusion.js @@ -7,7 +7,7 @@ * * Josh de Leeuw * - * documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-vsl-animate-occlusion + * documentation: docs.jspsych.org * */