change cont_key to choices in text plugin for consistency

This commit is contained in:
Josh de Leeuw 2016-08-12 17:01:16 -04:00
parent 2efa5fefeb
commit 2132163127
4 changed files with 8 additions and 8 deletions

View File

@ -9,7 +9,7 @@ This table lists the parameters associated with this plugin. Parameters with a d
Parameter | Type | Default Value | Description
----------|------|---------------|------------
text | string | *undefined* | A string containing HTML formatted text (no HTML code is necessary, but it is allowed).
cont_key | array or `'mouse'` | [ ] | This array contains the keys that the subject is allowed to press in order to advance to the next trial. Keys can be specified as their [numeric key code](http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes) or as characters (e.g. `'a'`, `'q'`). The default value of an empty array means that all keys will be accepted as valid responses. If the value of `'mouse'` is used, then clicking the mouse will advance to the next trial.
choices | array or `'mouse'` | [ ] | This array contains the keys that the subject is allowed to press in order to advance to the next trial. Keys can be specified as their [numeric key code](http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes) or as characters (e.g. `'a'`, `'q'`). The default value of an empty array means that all keys will be accepted as valid responses. If the value of `'mouse'` is used, then clicking the mouse will advance to the next trial.
## Data Generated

View File

@ -23,7 +23,7 @@ jsPsych.plugins.text = (function() {
no_function: false,
description: ''
},
cont_key: {
choices: {
type: [jsPsych.plugins.parameterType.KEYCODE, jsPsych.plugins.parameterType.SELECT],
options: ['mouse'],
array: true,
@ -36,7 +36,7 @@ jsPsych.plugins.text = (function() {
plugin.trial = function(display_element, trial) {
trial.cont_key = trial.cont_key || jsPsych.ALL_KEYS;
trial.choices = trial.choices || jsPsych.ALL_KEYS;
// if any trial variables are functions
// this evaluates the function and replaces
@ -73,13 +73,13 @@ jsPsych.plugins.text = (function() {
};
// check if key is 'mouse'
if (trial.cont_key == 'mouse') {
if (trial.choices == 'mouse') {
display_element.click(mouse_listener);
var start_time = (new Date()).getTime();
} else {
jsPsych.pluginAPI.getKeyboardResponse({
callback_function: after_response,
valid_responses: trial.cont_key,
valid_responses: trial.choices,
rt_method: 'date',
persist: false,
allow_held_key: false

View File

@ -11,7 +11,7 @@
var block = {
type: 'text',
text: 'Hello. This is in a loop. Press R to repeat this trial, or C to continue.',
cont_key: ['r','c']
choices: ['r','c']
}
var loop_node = {
@ -28,7 +28,7 @@
var pre_if_trial = {
type: 'text',
text: 'The next trial is in a conditional statement. Press S to skip it, or V to view it.',
cont_key: ['s','v']
choices: ['s','v']
}
var if_trial = {

View File

@ -15,7 +15,7 @@
var block_1 = {
type: 'text',
text: 'This trial should display. Click to continue.',
cont_key: 'mouse'
choices: 'mouse'
}
jsPsych.init({