mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-12 16:48:12 +00:00
change cont_key to choices in text plugin for consistency
This commit is contained in:
parent
2efa5fefeb
commit
2132163127
@ -9,7 +9,7 @@ This table lists the parameters associated with this plugin. Parameters with a d
|
|||||||
Parameter | Type | Default Value | Description
|
Parameter | Type | Default Value | Description
|
||||||
----------|------|---------------|------------
|
----------|------|---------------|------------
|
||||||
text | string | *undefined* | A string containing HTML formatted text (no HTML code is necessary, but it is allowed).
|
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
|
## Data Generated
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ jsPsych.plugins.text = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
cont_key: {
|
choices: {
|
||||||
type: [jsPsych.plugins.parameterType.KEYCODE, jsPsych.plugins.parameterType.SELECT],
|
type: [jsPsych.plugins.parameterType.KEYCODE, jsPsych.plugins.parameterType.SELECT],
|
||||||
options: ['mouse'],
|
options: ['mouse'],
|
||||||
array: true,
|
array: true,
|
||||||
@ -36,7 +36,7 @@ jsPsych.plugins.text = (function() {
|
|||||||
|
|
||||||
plugin.trial = function(display_element, trial) {
|
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
|
// if any trial variables are functions
|
||||||
// this evaluates the function and replaces
|
// this evaluates the function and replaces
|
||||||
@ -73,13 +73,13 @@ jsPsych.plugins.text = (function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// check if key is 'mouse'
|
// check if key is 'mouse'
|
||||||
if (trial.cont_key == 'mouse') {
|
if (trial.choices == 'mouse') {
|
||||||
display_element.click(mouse_listener);
|
display_element.click(mouse_listener);
|
||||||
var start_time = (new Date()).getTime();
|
var start_time = (new Date()).getTime();
|
||||||
} else {
|
} else {
|
||||||
jsPsych.pluginAPI.getKeyboardResponse({
|
jsPsych.pluginAPI.getKeyboardResponse({
|
||||||
callback_function: after_response,
|
callback_function: after_response,
|
||||||
valid_responses: trial.cont_key,
|
valid_responses: trial.choices,
|
||||||
rt_method: 'date',
|
rt_method: 'date',
|
||||||
persist: false,
|
persist: false,
|
||||||
allow_held_key: false
|
allow_held_key: false
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
var block = {
|
var block = {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
text: 'Hello. This is in a loop. Press R to repeat this trial, or C to continue.',
|
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 = {
|
var loop_node = {
|
||||||
@ -28,7 +28,7 @@
|
|||||||
var pre_if_trial = {
|
var pre_if_trial = {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
text: 'The next trial is in a conditional statement. Press S to skip it, or V to view it.',
|
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 = {
|
var if_trial = {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
var block_1 = {
|
var block_1 = {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
text: 'This trial should display. Click to continue.',
|
text: 'This trial should display. Click to continue.',
|
||||||
cont_key: 'mouse'
|
choices: 'mouse'
|
||||||
}
|
}
|
||||||
|
|
||||||
jsPsych.init({
|
jsPsych.init({
|
||||||
|
Loading…
Reference in New Issue
Block a user