mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
better timing parameter names #425
This commit is contained in:
parent
d920d40cfd
commit
756c88a07f
@ -445,7 +445,7 @@ None.
|
|||||||
|
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
Resumes the experiment after a call to `jsPsych.pauseExperiment()`. If the post trial delay (`timing_post_trial`) has not yet been reached, then the experiment will not continue until the delay is finished. For example, if `timing_post_trial` was 10,000ms and `jsPsych.resumeExperiment()` was called 6,000ms after the previous trial finished, then the experiment would not continue for another 4,000ms.
|
Resumes the experiment after a call to `jsPsych.pauseExperiment()`. If the post trial delay (`post_trial_gap`) has not yet been reached, then the experiment will not continue until the delay is finished. For example, if `post_trial_gap` was 10,000ms and `jsPsych.resumeExperiment()` was called 6,000ms after the previous trial finished, then the experiment would not continue for another 4,000ms.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
|
@ -29,13 +29,13 @@ Note the use of the data parameter to add a property `stimulus_type` with the va
|
|||||||
|
|
||||||
The default inter-trial interval (ITI) in jsPsych is 0 ms. This can be adjusted at the experiment-wide level by changing the `default_iti` parameter in `jsPsych.init()`.
|
The default inter-trial interval (ITI) in jsPsych is 0 ms. This can be adjusted at the experiment-wide level by changing the `default_iti` parameter in `jsPsych.init()`.
|
||||||
|
|
||||||
The ITI can also be controlled at the trial level through the `timing_post_trial` parameter. Setting this parameter to a positive integer *x* will cause a blank screen to display after the trial for *x* milliseconds.
|
The ITI can also be controlled at the trial level through the `post_trial_gap` parameter. Setting this parameter to a positive integer *x* will cause a blank screen to display after the trial for *x* milliseconds.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var trial = {
|
var trial = {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
text: 'There will be a 1.5 second blank screen after this trial.',
|
text: 'There will be a 1.5 second blank screen after this trial.',
|
||||||
timing_post_trial: 1500
|
post_trial_gap: 1500
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ This table lists the parameters associated with this plugin. Parameters with a d
|
|||||||
Parameter | Type | Default Value | Description
|
Parameter | Type | Default Value | Description
|
||||||
----------|------|---------------|------------
|
----------|------|---------------|------------
|
||||||
func | function | *undefined* | The function to call.
|
func | function | *undefined* | The function to call.
|
||||||
timing_post_trial | numeric | 0 | Unlike other plugins where the default value of this parameter is 1,000ms, the default here is 0.
|
post_trial_gap | numeric | 0 | Unlike other plugins where the default value of this parameter is 1,000ms, the default here is 0.
|
||||||
|
|
||||||
|
|
||||||
## Data Generated
|
## Data Generated
|
||||||
|
@ -23,13 +23,13 @@ var single_stim_trial = {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Here's an exampe of overriding the default value for `timing_post_trial`:
|
Here's an exampe of overriding the default value for `post_trial_gap`:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var single_stim_trial = {
|
var single_stim_trial = {
|
||||||
type: 'single-stim',
|
type: 'single-stim',
|
||||||
stimulus: 'images/happy_face.jpg',
|
stimulus: 'images/happy_face.jpg',
|
||||||
timing_post_trial: 2000
|
post_trial_gap: 2000
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ In addition, there is a set of parameters that can be specified for any plugin.
|
|||||||
|
|
||||||
Parameter | Type | Default Value | Description
|
Parameter | Type | Default Value | Description
|
||||||
----------|------|---------------|------------
|
----------|------|---------------|------------
|
||||||
timing_post_trial | numeric | 1000 | Sets the time, in milliseconds, between the current trial and the next trial.
|
post_trial_gap | numeric | 1000 | Sets the time, in milliseconds, between the current trial and the next trial.
|
||||||
on_finish | function | *undefined* | A callback function to execute when the trial finishes. See [this page](../features/callbacks.md) for more details.
|
on_finish | function | *undefined* | A callback function to execute when the trial finishes. See [this page](../features/callbacks.md) for more details.
|
||||||
data | object | *undefined* | An object containing additional data to store for the trial. See [this page](../features/data.md) for more details.
|
data | object | *undefined* | An object containing additional data to store for the trial. See [this page](../features/data.md) for more details.
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ timeline.push(instructions);
|
|||||||
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
||||||
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
||||||
"<p>Press any key to begin.</p>",
|
"<p>Press any key to begin.</p>",
|
||||||
timing_post_trial: 2000
|
post_trial_gap: 2000
|
||||||
};
|
};
|
||||||
timeline.push(instructions);
|
timeline.push(instructions);
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ timeline.push(blue_trial, orange_trial);
|
|||||||
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
||||||
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
||||||
"<p>Press any key to begin.</p>",
|
"<p>Press any key to begin.</p>",
|
||||||
timing_post_trial: 2000
|
post_trial_gap: 2000
|
||||||
};
|
};
|
||||||
timeline.push(instructions);
|
timeline.push(instructions);
|
||||||
|
|
||||||
@ -369,7 +369,7 @@ What happens when the experiment reaches the test procedure? jsPsych will run th
|
|||||||
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
||||||
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
||||||
"<p>Press any key to begin.</p>",
|
"<p>Press any key to begin.</p>",
|
||||||
timing_post_trial: 2000
|
post_trial_gap: 2000
|
||||||
};
|
};
|
||||||
timeline.push(instructions);
|
timeline.push(instructions);
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ var test_procedure = {
|
|||||||
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
||||||
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
||||||
"<p>Press any key to begin.</p>",
|
"<p>Press any key to begin.</p>",
|
||||||
timing_post_trial: 2000
|
post_trial_gap: 2000
|
||||||
};
|
};
|
||||||
timeline.push(instructions);
|
timeline.push(instructions);
|
||||||
|
|
||||||
@ -568,7 +568,7 @@ In the code above, we replaced the `timing_response: 1000` parameter in `fixatio
|
|||||||
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
||||||
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
||||||
"<p>Press any key to begin.</p>",
|
"<p>Press any key to begin.</p>",
|
||||||
timing_post_trial: 2000
|
post_trial_gap: 2000
|
||||||
};
|
};
|
||||||
timeline.push(instructions);
|
timeline.push(instructions);
|
||||||
|
|
||||||
@ -664,7 +664,7 @@ jsPsych.init({
|
|||||||
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
||||||
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
||||||
"<p>Press any key to begin.</p>",
|
"<p>Press any key to begin.</p>",
|
||||||
timing_post_trial: 2000
|
post_trial_gap: 2000
|
||||||
};
|
};
|
||||||
timeline.push(instructions);
|
timeline.push(instructions);
|
||||||
|
|
||||||
@ -790,7 +790,7 @@ var fixation = {
|
|||||||
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
||||||
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
||||||
"<p>Press any key to begin.</p>",
|
"<p>Press any key to begin.</p>",
|
||||||
timing_post_trial: 2000
|
post_trial_gap: 2000
|
||||||
};
|
};
|
||||||
timeline.push(instructions);
|
timeline.push(instructions);
|
||||||
|
|
||||||
@ -900,7 +900,7 @@ The `data.key_press` value is a numeric key code indicating which key the subjec
|
|||||||
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
||||||
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
||||||
"<p>Press any key to begin.</p>",
|
"<p>Press any key to begin.</p>",
|
||||||
timing_post_trial: 2000
|
post_trial_gap: 2000
|
||||||
};
|
};
|
||||||
timeline.push(instructions);
|
timeline.push(instructions);
|
||||||
|
|
||||||
@ -1026,7 +1026,7 @@ This code is available in the examples folder in the jsPsych download. It is cal
|
|||||||
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
||||||
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
||||||
"<p>Press any key to begin.</p>",
|
"<p>Press any key to begin.</p>",
|
||||||
timing_post_trial: 2000
|
post_trial_gap: 2000
|
||||||
};
|
};
|
||||||
timeline.push(instructions);
|
timeline.push(instructions);
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
"<p>Press the left arrow key if the middle arrow is pointing left. (<)</p>"+
|
"<p>Press the left arrow key if the middle arrow is pointing left. (<)</p>"+
|
||||||
"<p>Press the right arrow key if the middle arrow is pointing right. (>)</p>"+
|
"<p>Press the right arrow key if the middle arrow is pointing right. (>)</p>"+
|
||||||
"<p>Press any key to begin.</p>",
|
"<p>Press any key to begin.</p>",
|
||||||
timing_post_trial: 1000
|
post_trial_gap: 1000
|
||||||
};
|
};
|
||||||
|
|
||||||
/*defining stimuli*/
|
/*defining stimuli*/
|
||||||
@ -67,7 +67,7 @@
|
|||||||
}
|
}
|
||||||
data.correct = correct;
|
data.correct = correct;
|
||||||
},
|
},
|
||||||
timing_post_trial: function() {
|
post_trial_gap: function() {
|
||||||
return Math.floor(Math.random() * 1500) + 500;
|
return Math.floor(Math.random() * 1500) + 500;
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
"<div class='float: right;'><img src='img/orange.png'></img>" +
|
||||||
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
"<p class='small'><strong>Press the J key</strong></p></div>" +
|
||||||
"<p>Press any key to begin.</p>",
|
"<p>Press any key to begin.</p>",
|
||||||
timing_post_trial: 2000
|
post_trial_gap: 2000
|
||||||
};
|
};
|
||||||
timeline.push(instructions);
|
timeline.push(instructions);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
func: function(){ return Date.now(); }
|
func: function(){ return Date.now(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// this is to check if the plugin specific default for timing_post_trial works.
|
// this is to check if the plugin specific default for post_trial_gap works.
|
||||||
// if it does, then the return values should be nearly identical.
|
// if it does, then the return values should be nearly identical.
|
||||||
var next_trial = {
|
var next_trial = {
|
||||||
type: 'call-function',
|
type: 'call-function',
|
||||||
|
@ -18,7 +18,7 @@ var welcome_block = {
|
|||||||
'complete an Implicit Association Test (IAT) in which you ' +
|
'complete an Implicit Association Test (IAT) in which you ' +
|
||||||
'will be asked to sort pictures and words into groups as ' +
|
'will be asked to sort pictures and words into groups as ' +
|
||||||
'fast as you can.</p><p>Press any key to begin.</p>',
|
'fast as you can.</p><p>Press any key to begin.</p>',
|
||||||
timing_post_trial: 1500
|
post_trial_gap: 1500
|
||||||
};
|
};
|
||||||
|
|
||||||
var category_block = {
|
var category_block = {
|
||||||
@ -36,7 +36,7 @@ var category_block = {
|
|||||||
"<img src='img/age/yf5.jpg'></img> " + "<img src='img/age/ym2.jpg'></img> " +
|
"<img src='img/age/yf5.jpg'></img> " + "<img src='img/age/ym2.jpg'></img> " +
|
||||||
"<img src='img/age/ym3.jpg'></img> " + "<img src='img/age/ym5.jpg'></img><br><br>" +
|
"<img src='img/age/ym3.jpg'></img> " + "<img src='img/age/ym5.jpg'></img><br><br>" +
|
||||||
"Press any key to continue.</p>",
|
"Press any key to continue.</p>",
|
||||||
timing_post_trial: 1500
|
post_trial_gap: 1500
|
||||||
};
|
};
|
||||||
|
|
||||||
var instructions_block = {
|
var instructions_block = {
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
'width: 210px; height: 210px;"></div></div>',
|
'width: 210px; height: 210px;"></div></div>',
|
||||||
is_html: true,
|
is_html: true,
|
||||||
choices: ['c'],
|
choices: ['c'],
|
||||||
timing_post_trial: 1250,
|
post_trial_gap: 1250,
|
||||||
prompt: '<p>Study the size of this square carefully. On the next screen you will have to recreate it. When you are ready, press C.</p>'
|
prompt: '<p>Study the size of this square carefully. On the next screen you will have to recreate it. When you are ready, press C.</p>'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,14 +77,14 @@
|
|||||||
is_html: true,
|
is_html: true,
|
||||||
choices: jsPsych.NO_KEYS,
|
choices: jsPsych.NO_KEYS,
|
||||||
timing_response: 500,
|
timing_response: 500,
|
||||||
timing_post_trial: 0
|
post_trial_gap: 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'single-stim',
|
type: 'single-stim',
|
||||||
stimulus: function(){ return "<p class='stimulus'>"+jsPsych.timelineVariable('word')+"</p>"; },
|
stimulus: function(){ return "<p class='stimulus'>"+jsPsych.timelineVariable('word')+"</p>"; },
|
||||||
is_html: true,
|
is_html: true,
|
||||||
choices: ['y','n'],
|
choices: ['y','n'],
|
||||||
timing_post_trial: 500,
|
post_trial_gap: 500,
|
||||||
data: function(){
|
data: function(){
|
||||||
return {
|
return {
|
||||||
word_validity: jsPsych.timelineVariable('word_validity'),
|
word_validity: jsPsych.timelineVariable('word_validity'),
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
var first = {
|
var first = {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
text: 'first trial! experiment will pause for 2s in between trials. press any key.',
|
text: 'first trial! experiment will pause for 2s in between trials. press any key.',
|
||||||
timing_post_trial: 0,
|
post_trial_gap: 0,
|
||||||
on_finish: function(){
|
on_finish: function(){
|
||||||
jsPsych.pauseExperiment();
|
jsPsych.pauseExperiment();
|
||||||
setTimeout(jsPsych.resumeExperiment, 2000);
|
setTimeout(jsPsych.resumeExperiment, 2000);
|
||||||
|
@ -228,15 +228,15 @@ window.jsPsych = (function() {
|
|||||||
opts.on_data_update(trial_data_values);
|
opts.on_data_update(trial_data_values);
|
||||||
|
|
||||||
// wait for iti
|
// wait for iti
|
||||||
if (typeof current_trial.timing_post_trial == 'undefined') {
|
if (typeof current_trial.post_trial_gap == 'undefined') {
|
||||||
if (opts.default_iti > 0) {
|
if (opts.default_iti > 0) {
|
||||||
setTimeout(nextTrial, opts.default_iti);
|
setTimeout(nextTrial, opts.default_iti);
|
||||||
} else {
|
} else {
|
||||||
nextTrial();
|
nextTrial();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (current_trial.timing_post_trial > 0) {
|
if (current_trial.post_trial_gap > 0) {
|
||||||
setTimeout(nextTrial, current_trial.timing_post_trial);
|
setTimeout(nextTrial, current_trial.post_trial_gap);
|
||||||
} else {
|
} else {
|
||||||
nextTrial();
|
nextTrial();
|
||||||
}
|
}
|
||||||
@ -816,7 +816,7 @@ window.jsPsych = (function() {
|
|||||||
|
|
||||||
// keys that are always protected
|
// keys that are always protected
|
||||||
var always_protected = ['on_finish'];
|
var always_protected = ['on_finish'];
|
||||||
var common_across_plugins = ['data', 'timing_post_trial'];
|
var common_across_plugins = ['data', 'post_trial_gap'];
|
||||||
|
|
||||||
var keys = Object.keys(trial);
|
var keys = Object.keys(trial);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ jsPsych.plugins["audio-keyboard-response"] = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_response: {
|
trial_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: -1,
|
default: -1,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
@ -64,7 +64,7 @@ jsPsych.plugins["audio-keyboard-response"] = (function() {
|
|||||||
trial.choices = trial.choices || jsPsych.ALL_KEYS;
|
trial.choices = trial.choices || jsPsych.ALL_KEYS;
|
||||||
trial.response_ends_trial = (typeof trial.response_ends_trial === 'undefined') ? true : trial.response_ends_trial;
|
trial.response_ends_trial = (typeof trial.response_ends_trial === 'undefined') ? true : trial.response_ends_trial;
|
||||||
trial.trial_ends_after_audio = (typeof trial.trial_ends_after_audio === 'undefined') ? false : trial.trial_ends_after_audio;
|
trial.trial_ends_after_audio = (typeof trial.trial_ends_after_audio === 'undefined') ? false : trial.trial_ends_after_audio;
|
||||||
trial.timing_response = trial.timing_response || -1; // if -1, then wait for response forever
|
trial.trial_duration = trial.trial_duration || -1; // if -1, then wait for response forever
|
||||||
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
||||||
|
|
||||||
// setup stimulus
|
// setup stimulus
|
||||||
@ -177,10 +177,10 @@ jsPsych.plugins["audio-keyboard-response"] = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// end trial if time limit is set
|
// end trial if time limit is set
|
||||||
if (trial.timing_response > 0) {
|
if (trial.trial_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
end_trial();
|
end_trial();
|
||||||
}, trial.timing_response);
|
}, trial.trial_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -29,7 +29,7 @@ jsPsych.plugins['call-function'] = (function() {
|
|||||||
// a rare case where we override the default experiment level
|
// a rare case where we override the default experiment level
|
||||||
// value of this parameter, since this plugin should be invisible
|
// value of this parameter, since this plugin should be invisible
|
||||||
// to the subject of the experiment
|
// to the subject of the experiment
|
||||||
trial.timing_post_trial = typeof trial.timing_post_trial == 'undefined' ? 0 : trial.timing_post_trial
|
trial.post_trial_gap = typeof trial.post_trial_gap == 'undefined' ? 0 : trial.post_trial_gap
|
||||||
|
|
||||||
var return_val = trial.func();
|
var return_val = trial.func();
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ jsPsych.plugins["categorize-animation"] = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_feedback_duration: {
|
feedback_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 2000,
|
default: 2000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
@ -97,7 +97,7 @@ jsPsych.plugins["categorize-animation"] = (function() {
|
|||||||
trial.incorrect_text = trial.incorrect_text || "Wrong.";
|
trial.incorrect_text = trial.incorrect_text || "Wrong.";
|
||||||
trial.allow_response_before_complete = trial.allow_response_before_complete || false;
|
trial.allow_response_before_complete = trial.allow_response_before_complete || false;
|
||||||
trial.frame_time = trial.frame_time || 500;
|
trial.frame_time = trial.frame_time || 500;
|
||||||
trial.timing_feedback_duration = trial.timing_feedback_duration || 2000;
|
trial.feedback_duration = trial.feedback_duration || 2000;
|
||||||
trial.prompt = (typeof trial.prompt === 'undefined') ? '' : trial.prompt;
|
trial.prompt = (typeof trial.prompt === 'undefined') ? '' : trial.prompt;
|
||||||
|
|
||||||
var animate_frame = -1;
|
var animate_frame = -1;
|
||||||
@ -160,7 +160,7 @@ jsPsych.plugins["categorize-animation"] = (function() {
|
|||||||
timeoutSet = true;
|
timeoutSet = true;
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
endTrial();
|
endTrial();
|
||||||
}, trial.timing_feedback_duration);
|
}, trial.feedback_duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,19 +81,19 @@ jsPsych.plugins['categorize-html'] = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_stim: {
|
stimulus_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: -1,
|
default: -1,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_response: {
|
trial_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: -1,
|
default: -1,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_feedback_duration: {
|
feedback_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 2000,
|
default: 2000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
@ -115,17 +115,17 @@ jsPsych.plugins['categorize-html'] = (function() {
|
|||||||
trial.show_feedback_on_timeout = (typeof trial.show_feedback_on_timeout === 'undefined') ? false : trial.show_feedback_on_timeout;
|
trial.show_feedback_on_timeout = (typeof trial.show_feedback_on_timeout === 'undefined') ? false : trial.show_feedback_on_timeout;
|
||||||
trial.timeout_message = trial.timeout_message || "<p>Please respond faster.</p>";
|
trial.timeout_message = trial.timeout_message || "<p>Please respond faster.</p>";
|
||||||
// timing params
|
// timing params
|
||||||
trial.timing_stim = trial.timing_stim || -1; // default is to show image until response
|
trial.stimulus_duration = trial.stimulus_duration || -1; // default is to show image until response
|
||||||
trial.timing_response = trial.timing_response || -1; // default is no max response time
|
trial.trial_duration = trial.trial_duration || -1; // default is no max response time
|
||||||
trial.timing_feedback_duration = trial.timing_feedback_duration || 2000;
|
trial.feedback_duration = trial.feedback_duration || 2000;
|
||||||
|
|
||||||
display_element.innerHTML = '<div id="jspsych-categorize-html-stimulus" class="jspsych-categorize-html-stimulus">'+trial.stimulus+'</div>';
|
display_element.innerHTML = '<div id="jspsych-categorize-html-stimulus" class="jspsych-categorize-html-stimulus">'+trial.stimulus+'</div>';
|
||||||
|
|
||||||
// hide image after time if the timing parameter is set
|
// hide image after time if the timing parameter is set
|
||||||
if (trial.timing_stim > 0) {
|
if (trial.stimulus_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
display_element.querySelector('#jspsych-categorize-html-stimulus').style.visibility = 'hidden';
|
display_element.querySelector('#jspsych-categorize-html-stimulus').style.visibility = 'hidden';
|
||||||
}, trial.timing_stim);
|
}, trial.stimulus_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if prompt is set, show prompt
|
// if prompt is set, show prompt
|
||||||
@ -171,13 +171,13 @@ jsPsych.plugins['categorize-html'] = (function() {
|
|||||||
allow_held_key: false
|
allow_held_key: false
|
||||||
});
|
});
|
||||||
|
|
||||||
if (trial.timing_response > 0) {
|
if (trial.trial_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
after_response({
|
after_response({
|
||||||
key: -1,
|
key: -1,
|
||||||
rt: -1
|
rt: -1
|
||||||
});
|
});
|
||||||
}, trial.timing_response);
|
}, trial.trial_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
function doFeedback(correct, timeout) {
|
function doFeedback(correct, timeout) {
|
||||||
@ -219,7 +219,7 @@ jsPsych.plugins['categorize-html'] = (function() {
|
|||||||
} else {
|
} else {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
endTrial();
|
endTrial();
|
||||||
}, trial.timing_feedback_duration);
|
}, trial.feedback_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -83,19 +83,19 @@ jsPsych.plugins['categorize-image'] = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_stim: {
|
stimulus_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: -1,
|
default: -1,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_response: {
|
trial_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: -1,
|
default: -1,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_feedback_duration: {
|
feedback_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 2000,
|
default: 2000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
@ -117,17 +117,17 @@ jsPsych.plugins['categorize-image'] = (function() {
|
|||||||
trial.show_feedback_on_timeout = (typeof trial.show_feedback_on_timeout === 'undefined') ? false : trial.show_feedback_on_timeout;
|
trial.show_feedback_on_timeout = (typeof trial.show_feedback_on_timeout === 'undefined') ? false : trial.show_feedback_on_timeout;
|
||||||
trial.timeout_message = trial.timeout_message || "<p>Please respond faster.</p>";
|
trial.timeout_message = trial.timeout_message || "<p>Please respond faster.</p>";
|
||||||
// timing params
|
// timing params
|
||||||
trial.timing_stim = trial.timing_stim || -1; // default is to show image until response
|
trial.stimulus_duration = trial.stimulus_duration || -1; // default is to show image until response
|
||||||
trial.timing_response = trial.timing_response || -1; // default is no max response time
|
trial.trial_duration = trial.trial_duration || -1; // default is no max response time
|
||||||
trial.timing_feedback_duration = trial.timing_feedback_duration || 2000;
|
trial.feedback_duration = trial.feedback_duration || 2000;
|
||||||
|
|
||||||
display_element.innerHTML = '<img id="jspsych-categorize-image-stimulus" class="jspsych-categorize-image-stimulus" src="'+trial.stimulus+'"></img>';
|
display_element.innerHTML = '<img id="jspsych-categorize-image-stimulus" class="jspsych-categorize-image-stimulus" src="'+trial.stimulus+'"></img>';
|
||||||
|
|
||||||
// hide image after time if the timing parameter is set
|
// hide image after time if the timing parameter is set
|
||||||
if (trial.timing_stim > 0) {
|
if (trial.stimulus_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
display_element.querySelector('#jspsych-categorize-image-stimulus').style.visibility = 'hidden';
|
display_element.querySelector('#jspsych-categorize-image-stimulus').style.visibility = 'hidden';
|
||||||
}, trial.timing_stim);
|
}, trial.stimulus_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if prompt is set, show prompt
|
// if prompt is set, show prompt
|
||||||
@ -173,13 +173,13 @@ jsPsych.plugins['categorize-image'] = (function() {
|
|||||||
allow_held_key: false
|
allow_held_key: false
|
||||||
});
|
});
|
||||||
|
|
||||||
if (trial.timing_response > 0) {
|
if (trial.trial_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
after_response({
|
after_response({
|
||||||
key: -1,
|
key: -1,
|
||||||
rt: -1
|
rt: -1
|
||||||
});
|
});
|
||||||
}, trial.timing_response);
|
}, trial.trial_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
function doFeedback(correct, timeout) {
|
function doFeedback(correct, timeout) {
|
||||||
@ -221,7 +221,7 @@ jsPsych.plugins['categorize-image'] = (function() {
|
|||||||
} else {
|
} else {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
endTrial();
|
endTrial();
|
||||||
}, trial.timing_feedback_duration);
|
}, trial.feedback_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
trial.right_category_label = trial.right_category_label || ['right'];
|
trial.right_category_label = trial.right_category_label || ['right'];
|
||||||
trial.stim_key_association = trial.stim_key_association || 'undefined';
|
trial.stim_key_association = trial.stim_key_association || 'undefined';
|
||||||
trial.response_ends_trial = (typeof trial.response_ends_trial == 'undefined') ? true : trial.response_ends_trial;
|
trial.response_ends_trial = (typeof trial.response_ends_trial == 'undefined') ? true : trial.response_ends_trial;
|
||||||
trial.timing_response = trial.timing_response || -1;
|
trial.trial_duration = trial.trial_duration || -1;
|
||||||
trial.key_to_move_forward = trial.key_to_move_forward || jsPsych.ALL_KEYS;
|
trial.key_to_move_forward = trial.key_to_move_forward || jsPsych.ALL_KEYS;
|
||||||
|
|
||||||
var html_str = "";
|
var html_str = "";
|
||||||
@ -206,10 +206,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// end trial if time limit is set
|
// end trial if time limit is set
|
||||||
if (trial.timing_response > 0 && trial.response_ends_trial != true) {
|
if (trial.trial_duration > 0 && trial.response_ends_trial != true) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
end_trial();
|
end_trial();
|
||||||
}, trial.timing_response);
|
}, trial.trial_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
trial.right_category_label = trial.right_category_label || ['right'];
|
trial.right_category_label = trial.right_category_label || ['right'];
|
||||||
trial.stim_key_association = trial.stim_key_association || 'undefined';
|
trial.stim_key_association = trial.stim_key_association || 'undefined';
|
||||||
trial.response_ends_trial = (typeof trial.response_ends_trial == 'undefined') ? true : trial.response_ends_trial;
|
trial.response_ends_trial = (typeof trial.response_ends_trial == 'undefined') ? true : trial.response_ends_trial;
|
||||||
trial.timing_response = trial.timing_response || -1;
|
trial.trial_duration = trial.trial_duration || -1;
|
||||||
trial.key_to_move_forward = trial.key_to_move_forward || jsPsych.ALL_KEYS;
|
trial.key_to_move_forward = trial.key_to_move_forward || jsPsych.ALL_KEYS;
|
||||||
|
|
||||||
var html_str = "";
|
var html_str = "";
|
||||||
@ -206,10 +206,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// end trial if time limit is set
|
// end trial if time limit is set
|
||||||
if (trial.timing_response > 0 && trial.response_ends_trial != true) {
|
if (trial.trial_duration > 0 && trial.response_ends_trial != true) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
end_trial();
|
end_trial();
|
||||||
}, trial.timing_response);
|
}, trial.trial_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -42,19 +42,19 @@ jsPsych.plugins['same-different-image'] = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_first_stim: {
|
first_stim_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 1000,
|
default: 1000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_gap: {
|
gap_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 500,
|
default: 500,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_second_stim: {
|
second_stim_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 1000,
|
default: 1000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
@ -75,18 +75,18 @@ jsPsych.plugins['same-different-image'] = (function() {
|
|||||||
trial.same_key = trial.same_key || 81; // default is 'q'
|
trial.same_key = trial.same_key || 81; // default is 'q'
|
||||||
trial.different_key = trial.different_key || 80; // default is 'p'
|
trial.different_key = trial.different_key || 80; // default is 'p'
|
||||||
trial.advance_key = trial.advance_key || jsPsych.ALL_KEYS
|
trial.advance_key = trial.advance_key || jsPsych.ALL_KEYS
|
||||||
trial.timing_first_stim = trial.timing_first_stim || 1000; // if -1, the first stim is shown until any key is pressed
|
trial.first_stim_duration = trial.first_stim_duration || 1000; // if -1, the first stim is shown until any key is pressed
|
||||||
trial.timing_second_stim = trial.timing_second_stim || 1000; // if -1, then second stim is shown until response.
|
trial.second_stim_duration = trial.second_stim_duration || 1000; // if -1, then second stim is shown until response.
|
||||||
trial.timing_gap = trial.timing_gap || 500;
|
trial.gap_duration = trial.gap_duration || 500;
|
||||||
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
||||||
|
|
||||||
display_element.innerHTML = '<div class="jspsych-same-different-stimulus">'+trial.stimuli[0]+'</div>';
|
display_element.innerHTML = '<div class="jspsych-same-different-stimulus">'+trial.stimuli[0]+'</div>';
|
||||||
|
|
||||||
var first_stim_info;
|
var first_stim_info;
|
||||||
if (trial.timing_first_stim > 0) {
|
if (trial.first_stim_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
showBlankScreen();
|
showBlankScreen();
|
||||||
}, trial.timing_first_stim);
|
}, trial.first_stim_duration);
|
||||||
} else {
|
} else {
|
||||||
function afterKeyboardResponse(info) {
|
function afterKeyboardResponse(info) {
|
||||||
first_stim_info = info;
|
first_stim_info = info;
|
||||||
@ -106,7 +106,7 @@ jsPsych.plugins['same-different-image'] = (function() {
|
|||||||
|
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
showSecondStim();
|
showSecondStim();
|
||||||
}, trial.timing_gap);
|
}, trial.gap_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSecondStim() {
|
function showSecondStim() {
|
||||||
@ -114,10 +114,10 @@ jsPsych.plugins['same-different-image'] = (function() {
|
|||||||
display_element.innerHTML += '<div class="jspsych-same-different-stimulus">'+trial.stimuli[1]+'</div>';
|
display_element.innerHTML += '<div class="jspsych-same-different-stimulus">'+trial.stimuli[1]+'</div>';
|
||||||
|
|
||||||
|
|
||||||
if (trial.timing_second_stim > 0) {
|
if (trial.second_stim_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
display_element.querySelector('.jspsych-same-different-stimulus').style.visibility = 'hidden';
|
display_element.querySelector('.jspsych-same-different-stimulus').style.visibility = 'hidden';
|
||||||
}, trial.timing_second_stim);
|
}, trial.second_stim_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
//show prompt here
|
//show prompt here
|
||||||
|
@ -44,19 +44,19 @@ jsPsych.plugins['same-different-image'] = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_first_stim: {
|
first_stim_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 1000,
|
default: 1000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_gap: {
|
gap_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 500,
|
default: 500,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_second_stim: {
|
second_stim_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 1000,
|
default: 1000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
@ -77,18 +77,18 @@ jsPsych.plugins['same-different-image'] = (function() {
|
|||||||
trial.same_key = trial.same_key || 81; // default is 'q'
|
trial.same_key = trial.same_key || 81; // default is 'q'
|
||||||
trial.different_key = trial.different_key || 80; // default is 'p'
|
trial.different_key = trial.different_key || 80; // default is 'p'
|
||||||
trial.advance_key = trial.advance_key || jsPsych.ALL_KEYS
|
trial.advance_key = trial.advance_key || jsPsych.ALL_KEYS
|
||||||
trial.timing_first_stim = trial.timing_first_stim || 1000; // if -1, the first stim is shown until any key is pressed
|
trial.first_stim_duration = trial.first_stim_duration || 1000; // if -1, the first stim is shown until any key is pressed
|
||||||
trial.timing_second_stim = trial.timing_second_stim || 1000; // if -1, then second stim is shown until response.
|
trial.second_stim_duration = trial.second_stim_duration || 1000; // if -1, then second stim is shown until response.
|
||||||
trial.timing_gap = trial.timing_gap || 500;
|
trial.gap_duration = trial.gap_duration || 500;
|
||||||
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
||||||
|
|
||||||
display_element.innerHTML = '<img class="jspsych-same-different-stimulus" src="'+trial.stimuli[0]+'"></img>';
|
display_element.innerHTML = '<img class="jspsych-same-different-stimulus" src="'+trial.stimuli[0]+'"></img>';
|
||||||
|
|
||||||
var first_stim_info;
|
var first_stim_info;
|
||||||
if (trial.timing_first_stim > 0) {
|
if (trial.first_stim_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
showBlankScreen();
|
showBlankScreen();
|
||||||
}, trial.timing_first_stim);
|
}, trial.first_stim_duration);
|
||||||
} else {
|
} else {
|
||||||
function afterKeyboardResponse(info) {
|
function afterKeyboardResponse(info) {
|
||||||
first_stim_info = info;
|
first_stim_info = info;
|
||||||
@ -108,7 +108,7 @@ jsPsych.plugins['same-different-image'] = (function() {
|
|||||||
|
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
showSecondStim();
|
showSecondStim();
|
||||||
}, trial.timing_gap);
|
}, trial.gap_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSecondStim() {
|
function showSecondStim() {
|
||||||
@ -116,10 +116,10 @@ jsPsych.plugins['same-different-image'] = (function() {
|
|||||||
display_element.innerHTML += '<img class="jspsych-same-different-stimulus" src="'+trial.stimuli[1]+'"></img>';
|
display_element.innerHTML += '<img class="jspsych-same-different-stimulus" src="'+trial.stimuli[1]+'"></img>';
|
||||||
|
|
||||||
|
|
||||||
if (trial.timing_second_stim > 0) {
|
if (trial.second_stim_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
display_element.querySelector('.jspsych-same-different-stimulus').style.visibility = 'hidden';
|
display_element.querySelector('.jspsych-same-different-stimulus').style.visibility = 'hidden';
|
||||||
}, trial.timing_second_stim);
|
}, trial.second_stim_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
//show prompt here
|
//show prompt here
|
||||||
|
@ -18,8 +18,8 @@ jsPsych.plugins["serial-reaction-time-mouse"] = (function() {
|
|||||||
trial.grid_square_size = trial.grid_square_size || 100;
|
trial.grid_square_size = trial.grid_square_size || 100;
|
||||||
trial.target_color = trial.target_color || "#999";
|
trial.target_color = trial.target_color || "#999";
|
||||||
trial.response_ends_trial = (typeof trial.response_ends_trial === 'undefined') ? true : trial.response_ends_trial;
|
trial.response_ends_trial = (typeof trial.response_ends_trial === 'undefined') ? true : trial.response_ends_trial;
|
||||||
trial.timing_pre_target = (typeof trial.timing_pre_target === 'undefined') ? 0 : trial.timing_pre_target;
|
trial.pre_target_duration = (typeof trial.pre_target_duration === 'undefined') ? 0 : trial.pre_target_duration;
|
||||||
trial.timing_max_duration = trial.timing_max_duration || -1; // if -1, then wait for response forever
|
trial.trial_duration = trial.trial_duration || -1; // if -1, then wait for response forever
|
||||||
trial.fade_duration = (typeof trial.fade_duration === 'undefined') ? -1 : trial.fade_duration;
|
trial.fade_duration = (typeof trial.fade_duration === 'undefined') ? -1 : trial.fade_duration;
|
||||||
trial.allow_nontarget_responses = (typeof trial.allow_nontarget_responses === 'undefined') ? false : trial.allow_nontarget_responses;
|
trial.allow_nontarget_responses = (typeof trial.allow_nontarget_responses === 'undefined') ? false : trial.allow_nontarget_responses;
|
||||||
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
||||||
@ -36,12 +36,12 @@ jsPsych.plugins["serial-reaction-time-mouse"] = (function() {
|
|||||||
display_element.innerHTML = stimulus;
|
display_element.innerHTML = stimulus;
|
||||||
|
|
||||||
|
|
||||||
if(trial.timing_pre_target <= 0){
|
if(trial.pre_target_duration <= 0){
|
||||||
showTarget();
|
showTarget();
|
||||||
} else {
|
} else {
|
||||||
jsPsych.pluginAPI.setTimeout(function(){
|
jsPsych.pluginAPI.setTimeout(function(){
|
||||||
showTarget();
|
showTarget();
|
||||||
}, trial.timing_pre_target);
|
}, trial.pre_target_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
//show prompt if there is one
|
//show prompt if there is one
|
||||||
@ -87,8 +87,8 @@ jsPsych.plugins["serial-reaction-time-mouse"] = (function() {
|
|||||||
display_element.querySelector('#jspsych-serial-reaction-time-stimulus-cell-'+trial.target[0]+'-'+trial.target[1]).style.backgroundColor = trial.target_color;
|
display_element.querySelector('#jspsych-serial-reaction-time-stimulus-cell-'+trial.target[0]+'-'+trial.target[1]).style.backgroundColor = trial.target_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(trial.timing_max_duration > -1){
|
if(trial.trial_duration > -1){
|
||||||
jsPsych.pluginAPI.setTimeout(endTrial, trial.timing_max_duration);
|
jsPsych.pluginAPI.setTimeout(endTrial, trial.trial_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ jsPsych.plugins["serial-reaction-time"] = (function() {
|
|||||||
trial.grid_square_size = trial.grid_square_size || 100;
|
trial.grid_square_size = trial.grid_square_size || 100;
|
||||||
trial.target_color = trial.target_color || "#999";
|
trial.target_color = trial.target_color || "#999";
|
||||||
trial.response_ends_trial = (typeof trial.response_ends_trial === 'undefined') ? true : trial.response_ends_trial;
|
trial.response_ends_trial = (typeof trial.response_ends_trial === 'undefined') ? true : trial.response_ends_trial;
|
||||||
trial.timing_pre_target = (typeof trial.timing_pre_target === 'undefined') ? 0 : trial.timing_pre_target;
|
trial.pre_target_duration = (typeof trial.pre_target_duration === 'undefined') ? 0 : trial.pre_target_duration;
|
||||||
trial.timing_max_duration = trial.timing_max_duration || -1; // if -1, then wait for response forever
|
trial.trial_duration = trial.trial_duration || -1; // if -1, then wait for response forever
|
||||||
trial.show_response_feedback = (typeof trial.show_response_feedback === 'undefined') ? false : trial.show_response_feedback;
|
trial.show_response_feedback = (typeof trial.show_response_feedback === 'undefined') ? false : trial.show_response_feedback;
|
||||||
trial.feedback_duration = (typeof trial.feedback_duration === 'undefined') ? 200 : trial.feedback_duration;
|
trial.feedback_duration = (typeof trial.feedback_duration === 'undefined') ? 200 : trial.feedback_duration;
|
||||||
trial.fade_duration = (typeof trial.fade_duration === 'undefined') ? -1 : trial.fade_duration;
|
trial.fade_duration = (typeof trial.fade_duration === 'undefined') ? -1 : trial.fade_duration;
|
||||||
@ -36,12 +36,12 @@ jsPsych.plugins["serial-reaction-time"] = (function() {
|
|||||||
var stimulus = this.stimulus(trial.grid, trial.grid_square_size);
|
var stimulus = this.stimulus(trial.grid, trial.grid_square_size);
|
||||||
display_element.innerHTML = stimulus;
|
display_element.innerHTML = stimulus;
|
||||||
|
|
||||||
if(trial.timing_pre_target <= 0){
|
if(trial.pre_target_duration <= 0){
|
||||||
showTarget();
|
showTarget();
|
||||||
} else {
|
} else {
|
||||||
jsPsych.pluginAPI.setTimeout(function(){
|
jsPsych.pluginAPI.setTimeout(function(){
|
||||||
showTarget();
|
showTarget();
|
||||||
}, trial.timing_pre_target);
|
}, trial.pre_target_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
//show prompt if there is one
|
//show prompt if there is one
|
||||||
@ -71,8 +71,8 @@ jsPsych.plugins["serial-reaction-time"] = (function() {
|
|||||||
allow_held_key: false
|
allow_held_key: false
|
||||||
});
|
});
|
||||||
|
|
||||||
if(trial.timing_max_duration > -1){
|
if(trial.trial_duration > -1){
|
||||||
jsPsych.pluginAPI.setTimeout(showFeedback, trial.timing_max_duration);
|
jsPsych.pluginAPI.setTimeout(showFeedback, trial.trial_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,13 @@ jsPsych.plugins.video = (function() {
|
|||||||
array: true,
|
array: true,
|
||||||
default: undefined,
|
default: undefined,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: 'The video file to play.'
|
||||||
},
|
},
|
||||||
width: {
|
width: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: undefined,
|
default: undefined,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: 'The width of the video in pixels.'
|
||||||
},
|
},
|
||||||
height: {
|
height: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
|
@ -86,13 +86,13 @@ jsPsych.plugins["visual-search-circle"] = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_max_search: {
|
trial_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: -1,
|
default: -1,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_fixation: {
|
fixation_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 1000,
|
default: 1000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
@ -109,8 +109,8 @@ jsPsych.plugins["visual-search-circle"] = (function() {
|
|||||||
trial.circle_diameter = trial.circle_diameter || 250;
|
trial.circle_diameter = trial.circle_diameter || 250;
|
||||||
trial.target_present_key = trial.target_present_key || 74;
|
trial.target_present_key = trial.target_present_key || 74;
|
||||||
trial.target_absent_key = trial.target_absent_key || 70;
|
trial.target_absent_key = trial.target_absent_key || 70;
|
||||||
trial.timing_max_search = (typeof trial.timing_max_search === 'undefined') ? -1 : trial.timing_max_search;
|
trial.trial_duration = (typeof trial.trial_duration === 'undefined') ? -1 : trial.trial_duration;
|
||||||
trial.timing_fixation = (typeof trial.timing_fixation === 'undefined') ? 1000 : trial.timing_fixation;
|
trial.fixation_duration = (typeof trial.fixation_duration === 'undefined') ? 1000 : trial.fixation_duration;
|
||||||
|
|
||||||
// circle params
|
// circle params
|
||||||
var diam = trial.circle_diameter; // pixels
|
var diam = trial.circle_diameter; // pixels
|
||||||
@ -161,7 +161,7 @@ jsPsych.plugins["visual-search-circle"] = (function() {
|
|||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
// after wait is over
|
// after wait is over
|
||||||
show_search_array();
|
show_search_array();
|
||||||
}, trial.timing_fixation);
|
}, trial.fixation_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_search_array() {
|
function show_search_array() {
|
||||||
@ -213,9 +213,9 @@ jsPsych.plugins["visual-search-circle"] = (function() {
|
|||||||
allow_held_key: false
|
allow_held_key: false
|
||||||
});
|
});
|
||||||
|
|
||||||
if (trial.timing_max_search > -1) {
|
if (trial.trial_duration > -1) {
|
||||||
|
|
||||||
if (trial.timing_max_search == 0) {
|
if (trial.trial_duration == 0) {
|
||||||
if (!trial_over) {
|
if (!trial_over) {
|
||||||
|
|
||||||
jsPsych.pluginAPI.cancelKeyboardResponse(key_listener);
|
jsPsych.pluginAPI.cancelKeyboardResponse(key_listener);
|
||||||
@ -248,7 +248,7 @@ jsPsych.plugins["visual-search-circle"] = (function() {
|
|||||||
|
|
||||||
end_trial(rt, correct, key_press);
|
end_trial(rt, correct, key_press);
|
||||||
}
|
}
|
||||||
}, trial.timing_max_search);
|
}, trial.trial_duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,13 +62,13 @@ jsPsych.plugins['vsl-animate-occlusion'] = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_cycle: {
|
cycle_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 1000,
|
default: 1000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_pre_movement: {
|
pre_movement_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 500,
|
default: 500,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
@ -80,13 +80,13 @@ jsPsych.plugins['vsl-animate-occlusion'] = (function() {
|
|||||||
plugin.trial = function(display_element, trial) {
|
plugin.trial = function(display_element, trial) {
|
||||||
|
|
||||||
// default trial parameters
|
// default trial parameters
|
||||||
trial.timing_cycle = trial.timing_cycle || 1000;
|
trial.cycle_duration = trial.cycle_duration || 1000;
|
||||||
trial.canvas_size = trial.canvas_size || [400, 400];
|
trial.canvas_size = trial.canvas_size || [400, 400];
|
||||||
trial.image_size = trial.image_size || [100, 100];
|
trial.image_size = trial.image_size || [100, 100];
|
||||||
trial.initial_direction = trial.initial_direction || "left";
|
trial.initial_direction = trial.initial_direction || "left";
|
||||||
trial.occlude_center = (typeof trial.occlude_center === 'undefined') ? true : trial.occlude_center;
|
trial.occlude_center = (typeof trial.occlude_center === 'undefined') ? true : trial.occlude_center;
|
||||||
trial.choices = trial.choices || jsPsych.ALL_KEYS;
|
trial.choices = trial.choices || jsPsych.ALL_KEYS;
|
||||||
trial.timing_pre_movement = (typeof trial.timing_pre_movement === 'undefined') ? 500 : trial.timing_pre_movement;
|
trial.pre_movement_duration = (typeof trial.pre_movement_duration === 'undefined') ? 500 : trial.pre_movement_duration;
|
||||||
|
|
||||||
// variable to keep track of timing info and responses
|
// variable to keep track of timing info and responses
|
||||||
var start_time = 0;
|
var start_time = 0;
|
||||||
@ -97,23 +97,23 @@ jsPsych.plugins['vsl-animate-occlusion'] = (function() {
|
|||||||
params: {
|
params: {
|
||||||
x: trial.canvas_size[0] - trial.image_size[0]
|
x: trial.canvas_size[0] - trial.image_size[0]
|
||||||
},
|
},
|
||||||
ms: trial.timing_cycle / 2
|
ms: trial.cycle_duration / 2
|
||||||
}, {
|
}, {
|
||||||
params: {
|
params: {
|
||||||
x: trial.canvas_size[0] / 2 - trial.image_size[0] / 2
|
x: trial.canvas_size[0] / 2 - trial.image_size[0] / 2
|
||||||
},
|
},
|
||||||
ms: trial.timing_cycle / 2
|
ms: trial.cycle_duration / 2
|
||||||
}],
|
}],
|
||||||
[{
|
[{
|
||||||
params: {
|
params: {
|
||||||
x: 0
|
x: 0
|
||||||
},
|
},
|
||||||
ms: trial.timing_cycle / 2
|
ms: trial.cycle_duration / 2
|
||||||
}, {
|
}, {
|
||||||
params: {
|
params: {
|
||||||
x: trial.canvas_size[0] / 2 - trial.image_size[0] / 2
|
x: trial.canvas_size[0] / 2 - trial.image_size[0] / 2
|
||||||
},
|
},
|
||||||
ms: trial.timing_cycle / 2
|
ms: trial.cycle_duration / 2
|
||||||
}]
|
}]
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -178,10 +178,10 @@ jsPsych.plugins['vsl-animate-occlusion'] = (function() {
|
|||||||
allow_held_key: false
|
allow_held_key: false
|
||||||
});
|
});
|
||||||
|
|
||||||
if (trial.timing_pre_movement > 0) {
|
if (trial.pre_movement_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
next_step();
|
next_step();
|
||||||
}, trial.timing_pre_movement);
|
}, trial.pre_movement_duration);
|
||||||
} else {
|
} else {
|
||||||
next_step();
|
next_step();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ jsPsych.plugins['vsl-grid-scene'] = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_duration: {
|
trial_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 2000,
|
default: 2000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
@ -48,14 +48,14 @@ jsPsych.plugins['vsl-grid-scene'] = (function() {
|
|||||||
|
|
||||||
// default parameter values
|
// default parameter values
|
||||||
trial.image_size = trial.image_size || [100, 100];
|
trial.image_size = trial.image_size || [100, 100];
|
||||||
trial.timing_duration = typeof trial.timing_duration === 'undefined' ? 2000 : trial.timing_duration;
|
trial.trial_duration = typeof trial.trial_duration === 'undefined' ? 2000 : trial.trial_duration;
|
||||||
|
|
||||||
|
|
||||||
display_element.innerHTML = plugin.generate_stimulus(trial.stimuli, trial.image_size);
|
display_element.innerHTML = plugin.generate_stimulus(trial.stimuli, trial.image_size);
|
||||||
|
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
endTrial();
|
endTrial();
|
||||||
}, trial.timing_duration);
|
}, trial.trial_duration);
|
||||||
|
|
||||||
function endTrial() {
|
function endTrial() {
|
||||||
|
|
||||||
|
@ -41,25 +41,25 @@ jsPsych.plugins['xab-html'] = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_x: {
|
x_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 1000,
|
default: 1000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_xab_gap: {
|
x_durationab_gap: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 1000,
|
default: 1000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_ab: {
|
ab_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: -1,
|
default: -1,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_response: {
|
trial_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: -1,
|
default: -1,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
@ -73,10 +73,10 @@ jsPsych.plugins['xab-html'] = (function() {
|
|||||||
// default trial values
|
// default trial values
|
||||||
trial.left_key = trial.left_key || 81; // defaults to 'q'
|
trial.left_key = trial.left_key || 81; // defaults to 'q'
|
||||||
trial.right_key = trial.right_key || 80; // defaults to 'p'
|
trial.right_key = trial.right_key || 80; // defaults to 'p'
|
||||||
trial.timing_x = trial.timing_x || 1000; // defaults to 1000msec.
|
trial.x_duration = trial.x_duration || 1000; // defaults to 1000msec.
|
||||||
trial.timing_xab_gap = trial.timing_xab_gap || 1000; // defaults to 1000msec.
|
trial.x_durationab_gap = trial.x_durationab_gap || 1000; // defaults to 1000msec.
|
||||||
trial.timing_ab = trial.timing_ab || -1; // defaults to -1, meaning infinite time on AB. If a positive number is used, then AB will only be displayed for that length.
|
trial.ab_duration = trial.ab_duration || -1; // defaults to -1, meaning infinite time on AB. If a positive number is used, then AB will only be displayed for that length.
|
||||||
trial.timing_response = trial.timing_response || -1; //
|
trial.trial_duration = trial.trial_duration || -1; //
|
||||||
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
||||||
|
|
||||||
// unpack the stimuli array
|
// unpack the stimuli array
|
||||||
@ -98,10 +98,10 @@ jsPsych.plugins['xab-html'] = (function() {
|
|||||||
display_element.innerHTML = '<div class="jspsych-xab-stimulus" >'+trial.x_path+'</div>';
|
display_element.innerHTML = '<div class="jspsych-xab-stimulus" >'+trial.x_path+'</div>';
|
||||||
|
|
||||||
|
|
||||||
// start a timer of length trial.timing_x to move to the next part of the trial
|
// start a timer of length trial.x_duration to move to the next part of the trial
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
showBlankScreen();
|
showBlankScreen();
|
||||||
}, trial.timing_x);
|
}, trial.x_duration);
|
||||||
|
|
||||||
|
|
||||||
function showBlankScreen() {
|
function showBlankScreen() {
|
||||||
@ -111,7 +111,7 @@ jsPsych.plugins['xab-html'] = (function() {
|
|||||||
// start timer
|
// start timer
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
showSecondStimulus();
|
showSecondStimulus();
|
||||||
}, trial.timing_xab_gap);
|
}, trial.x_durationab_gap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -133,25 +133,25 @@ jsPsych.plugins['xab-html'] = (function() {
|
|||||||
display_element.innerHTML += trial.prompt;
|
display_element.innerHTML += trial.prompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if timing_ab is > 0, then we hide the stimuli after timing_ab milliseconds
|
// if ab_duration is > 0, then we hide the stimuli after ab_duration milliseconds
|
||||||
if (trial.timing_ab > 0) {
|
if (trial.ab_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
var matches = display_element.querySelectorAll('.jspsych-xab-stimulus');
|
var matches = display_element.querySelectorAll('.jspsych-xab-stimulus');
|
||||||
for(var i=0; i<matches.length; i++){
|
for(var i=0; i<matches.length; i++){
|
||||||
matches[i].style.visibility = 'hidden';
|
matches[i].style.visibility = 'hidden';
|
||||||
}
|
}
|
||||||
}, trial.timing_ab);
|
}, trial.ab_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if timing_response > 0, then we end the trial after timing_response milliseconds
|
// if trial_duration > 0, then we end the trial after trial_duration milliseconds
|
||||||
if (trial.timing_response > 0) {
|
if (trial.trial_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
end_trial({
|
end_trial({
|
||||||
rt: -1,
|
rt: -1,
|
||||||
correct: false,
|
correct: false,
|
||||||
key: -1
|
key: -1
|
||||||
});
|
});
|
||||||
}, trial.timing_response);
|
}, trial.trial_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the function that triggers when a key is pressed.
|
// create the function that triggers when a key is pressed.
|
||||||
@ -193,7 +193,6 @@ jsPsych.plugins['xab-html'] = (function() {
|
|||||||
|
|
||||||
display_element.innerHTML = ''; // remove all
|
display_element.innerHTML = ''; // remove all
|
||||||
|
|
||||||
// move on to the next trial after timing_post_trial milliseconds
|
|
||||||
jsPsych.finishTrial(trial_data);
|
jsPsych.finishTrial(trial_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,25 +43,25 @@ jsPsych.plugins['xab-image'] = (function() {
|
|||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_x: {
|
x_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 1000,
|
default: 1000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_xab_gap: {
|
x_durationab_gap: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: 1000,
|
default: 1000,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_ab: {
|
ab_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: -1,
|
default: -1,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
description: ''
|
description: ''
|
||||||
},
|
},
|
||||||
timing_response: {
|
trial_duration: {
|
||||||
type: jsPsych.plugins.parameterType.INT,
|
type: jsPsych.plugins.parameterType.INT,
|
||||||
default: -1,
|
default: -1,
|
||||||
no_function: false,
|
no_function: false,
|
||||||
@ -75,10 +75,10 @@ jsPsych.plugins['xab-image'] = (function() {
|
|||||||
// default trial values
|
// default trial values
|
||||||
trial.left_key = trial.left_key || 81; // defaults to 'q'
|
trial.left_key = trial.left_key || 81; // defaults to 'q'
|
||||||
trial.right_key = trial.right_key || 80; // defaults to 'p'
|
trial.right_key = trial.right_key || 80; // defaults to 'p'
|
||||||
trial.timing_x = trial.timing_x || 1000; // defaults to 1000msec.
|
trial.x_duration = trial.x_duration || 1000; // defaults to 1000msec.
|
||||||
trial.timing_xab_gap = trial.timing_xab_gap || 1000; // defaults to 1000msec.
|
trial.x_durationab_gap = trial.x_durationab_gap || 1000; // defaults to 1000msec.
|
||||||
trial.timing_ab = trial.timing_ab || -1; // defaults to -1, meaning infinite time on AB. If a positive number is used, then AB will only be displayed for that length.
|
trial.ab_duration = trial.ab_duration || -1; // defaults to -1, meaning infinite time on AB. If a positive number is used, then AB will only be displayed for that length.
|
||||||
trial.timing_response = trial.timing_response || -1; //
|
trial.trial_duration = trial.trial_duration || -1; //
|
||||||
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
||||||
|
|
||||||
// unpack the stimuli array
|
// unpack the stimuli array
|
||||||
@ -100,10 +100,10 @@ jsPsych.plugins['xab-image'] = (function() {
|
|||||||
display_element.innerHTML = '<img class="jspsych-xab-stimulus" src="'+trial.x_path+'"></img>';
|
display_element.innerHTML = '<img class="jspsych-xab-stimulus" src="'+trial.x_path+'"></img>';
|
||||||
|
|
||||||
|
|
||||||
// start a timer of length trial.timing_x to move to the next part of the trial
|
// start a timer of length trial.x_duration to move to the next part of the trial
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
showBlankScreen();
|
showBlankScreen();
|
||||||
}, trial.timing_x);
|
}, trial.x_duration);
|
||||||
|
|
||||||
|
|
||||||
function showBlankScreen() {
|
function showBlankScreen() {
|
||||||
@ -113,7 +113,7 @@ jsPsych.plugins['xab-image'] = (function() {
|
|||||||
// start timer
|
// start timer
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
showSecondStimulus();
|
showSecondStimulus();
|
||||||
}, trial.timing_xab_gap);
|
}, trial.x_durationab_gap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -134,25 +134,25 @@ jsPsych.plugins['xab-image'] = (function() {
|
|||||||
display_element.innerHTML += trial.prompt;
|
display_element.innerHTML += trial.prompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if timing_ab is > 0, then we hide the stimuli after timing_ab milliseconds
|
// if ab_duration is > 0, then we hide the stimuli after ab_duration milliseconds
|
||||||
if (trial.timing_ab > 0) {
|
if (trial.ab_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
var matches = display_element.querySelectorAll('.jspsych-xab-stimulus');
|
var matches = display_element.querySelectorAll('.jspsych-xab-stimulus');
|
||||||
for(var i=0; i<matches.length; i++){
|
for(var i=0; i<matches.length; i++){
|
||||||
matches[i].style.visibility = 'hidden';
|
matches[i].style.visibility = 'hidden';
|
||||||
}
|
}
|
||||||
}, trial.timing_ab);
|
}, trial.ab_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if timing_response > 0, then we end the trial after timing_response milliseconds
|
// if trial_duration > 0, then we end the trial after trial_duration milliseconds
|
||||||
if (trial.timing_response > 0) {
|
if (trial.trial_duration > 0) {
|
||||||
jsPsych.pluginAPI.setTimeout(function() {
|
jsPsych.pluginAPI.setTimeout(function() {
|
||||||
end_trial({
|
end_trial({
|
||||||
rt: -1,
|
rt: -1,
|
||||||
correct: false,
|
correct: false,
|
||||||
key: -1
|
key: -1
|
||||||
});
|
});
|
||||||
}, trial.timing_response);
|
}, trial.trial_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the function that triggers when a key is pressed.
|
// create the function that triggers when a key is pressed.
|
||||||
@ -194,7 +194,6 @@ jsPsych.plugins['xab-image'] = (function() {
|
|||||||
|
|
||||||
display_element.innerHTML = ''; // remove all
|
display_element.innerHTML = ''; // remove all
|
||||||
|
|
||||||
// move on to the next trial after timing_post_trial milliseconds
|
|
||||||
jsPsych.finishTrial(trial_data);
|
jsPsych.finishTrial(trial_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user