more plugin.info work (#270)

This commit is contained in:
Josh de Leeuw 2016-06-27 17:04:00 -04:00
parent e17882c46a
commit eb3fb3d662
5 changed files with 160 additions and 26 deletions

View File

@ -14,7 +14,7 @@ jsPsych.plugins['survey-text'] = (function() {
var plugin = {}; var plugin = {};
plugin.info = { plugin.info = {
name: 'survey-multi-choice', name: 'survey-text',
description: '', description: '',
parameters: { parameters: {
questions: { questions: {
@ -24,10 +24,23 @@ jsPsych.plugins['survey-text'] = (function() {
no_function: false, no_function: false,
description: '' description: ''
}, },
labels: { premable: {
type: [jsPsych.plugins.parameterType.STRING], type: [jsPsych.plugins.parameterType.STRING],
default: '',
no_function: false,
description: ''
},
rows: {
type: [jsPsych.plugins.parameterType.INT],
array: true, array: true,
default: undefined, default: 1,
no_function: false,
description: ''
},
columns: {
type: [jsPsych.plugins.parameterType.INT],
array: true,
default: 40,
no_function: false, no_function: false,
description: '' description: ''
} }

View File

@ -13,6 +13,27 @@ jsPsych.plugins.text = (function() {
var plugin = {}; 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) { plugin.trial = function(display_element, trial) {
trial.cont_key = trial.cont_key || []; trial.cont_key = trial.cont_key || [];

View File

@ -11,7 +11,49 @@ jsPsych.plugins.video = (function() {
var plugin = {}; 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) { plugin.trial = function(display_element, trial) {

View File

@ -22,28 +22,86 @@ jsPsych.plugins["visual-search-circle"] = (function() {
jsPsych.pluginAPI.registerPreload('visual-search-circle', 'foil', 'image'); jsPsych.pluginAPI.registerPreload('visual-search-circle', 'foil', 'image');
jsPsych.pluginAPI.registerPreload('visual-search-circle', 'fixation_image', 'image'); jsPsych.pluginAPI.registerPreload('visual-search-circle', 'fixation_image', 'image');
plugin.create = function(params) { plugin.info = {
name: 'visual-search-circle',
var trials = new Array(params.target_present.length); description: '',
parameters: {
for (var i = 0; i < trials.length; i++) { target: {
trials[i] = {}; type: [jsPsych.plugins.parameterType.STRING],
trials[i].target_present = params.target_present[i]; default: undefined,
trials[i].set_size = params.set_size[i]; no_function: false,
trials[i].target = params.target; description: ''
trials[i].foil = params.foil; },
trials[i].fixation_image = params.fixation_image; foil: {
trials[i].target_size = params.target_size || [50, 50]; type: [jsPsych.plugins.parameterType.STRING],
trials[i].fixation_size = params.fixation_size || [16, 16]; default: undefined,
trials[i].circle_diameter = params.circle_diameter || 250; no_function: false,
trials[i].target_present_key = params.target_present_key || 74; description: ''
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; fixation_image: {
trials[i].timing_fixation = (typeof params.timing_fixation === 'undefined') ? 1000 : params.timing_fixation; 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) { plugin.trial = function(display_element, trial) {

View File

@ -7,7 +7,7 @@
* *
* Josh de Leeuw * Josh de Leeuw
* *
* documentation: https://github.com/jodeleeuw/jsPsych/wiki/jspsych-vsl-animate-occlusion * documentation: docs.jspsych.org
* *
*/ */