This commit is contained in:
Becky Gilbert 2021-05-18 15:22:15 -07:00
commit b528c4663f
4 changed files with 61 additions and 4 deletions

View File

@ -108,7 +108,7 @@ jsPsych.init({
JavaScript keyboard events make a distinction between uppercase and lowercase key responses (e.g. 'a' and 'A'). Often the researcher just cares about which physical key was pressed, and not whether the key press would result in an uppercase letter (for instance, if CapsLock is on or if the Shift key is held down). For this reason, jsPsych converts all key choice parameters and key responses as lowercase by default. This makes it easier to specify key choices (e.g. `choices: ['a']`, instead of `choices: ['a','A']`), and it makes it easier to check and score a participant's response.
There may be situations when you want key choices and responses to be case-sensitive. You can change this by setting the `case_sensitive` parameter to `true` in `jsPsych.init`.
There may be situations when you want key choices and responses to be case-sensitive. You can change this by setting the `case_sensitive_responses` parameter to `true` in `jsPsych.init`.
```js
// use case-sensitive key choices and responses,
@ -116,7 +116,7 @@ There may be situations when you want key choices and responses to be case-sensi
// and will be recorded this way in the data
jsPsych.init({
timeline: [...],
case_sensitive: true
case_sensitive_responses: true
});
```
@ -146,4 +146,4 @@ jsPsych.init({
{type: 'webgazer'}
]
});
```
```

View File

@ -1,4 +1,4 @@
# jspsych-webgazer-calibrate
# jspsych-webgazer-validate
This plugin can be used to measure the accuracy and precision of gaze predictions made by the [WebGazer extension](/extensions/jspsych-ext-webgazer). For a narrative description of eye tracking with jsPsych, see the [eye tracking overview](/overview/eye-tracking).

View File

@ -0,0 +1,15 @@
var calibration = {
timeline: [{
type: 'html-keyboard-response',
stimulus: `<div style="width:200px; height: 200px; background: white;"></div>`,
trial_duration: 200,
post_trial_gap: 100
}],
loop_function: function(data){
if(data.values()[0].response == ' '){
return false;
} else {
return true;
}
}
}

View File

@ -0,0 +1,42 @@
<!doctype html>
<html>
<head>
<script src="../../jspsych.js"></script>
<script src="../../plugins/jspsych-html-keyboard-response.js"></script>
<script src="calibration-timeline.js"></script>
<link rel="stylesheet" type="text/css" href="../../css/jspsych.css">
<style>
html, body { background: black; color: white;}
</style>
</head>
<body>
</body>
<script>
var start_calibration = {
type: 'html-keyboard-response',
stimulus: 'Press any key to start calibration. Press spacebar when calibration is complete.'
}
var start = {
type: 'html-keyboard-response',
stimulus: 'Press any key to start the test.'
}
var trial = {
type: 'html-keyboard-response',
stimulus: `<div style="width:200px; height: 200px; background: white;"></div>`,
trial_duration: 500,
post_trial_gap: 250
}
var loop = {
timeline: [trial],
repetitions: 10
}
jsPsych.init({
timeline: [start_calibration, calibration, start, loop]
})
</script>
</html>