mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
Pushing plugins with fixed formatting of comments
This commit is contained in:
parent
fbe642c50f
commit
7e7346caff
@ -1,19 +1,26 @@
|
|||||||
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
||||||
|
|
||||||
|
import { version } from "../package.json";
|
||||||
|
|
||||||
const info = <const>{
|
const info = <const>{
|
||||||
name: "html-video-response",
|
name: "html-video-response",
|
||||||
|
version: version,
|
||||||
parameters: {
|
parameters: {
|
||||||
/** The HTML string to be displayed */
|
/** The HTML string to be displayed */
|
||||||
stimulus: {
|
stimulus: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.HTML_STRING,
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
/** How long to show the stimulus. */
|
/** How long to display the stimulus in milliseconds. The visibility CSS property of the stimulus will be set to `hidden`
|
||||||
|
* after this time has elapsed. If this is null, then the stimulus will remain visible until the trial ends. */
|
||||||
stimulus_duration: {
|
stimulus_duration: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** How long to show the trial. */
|
/** The maximum length of the recording, in milliseconds. The default value is intentionally set low because of the
|
||||||
|
* potential to accidentally record very large data files if left too high. You can set this to `null` to allow the
|
||||||
|
* participant to control the length of the recording via the done button, but be careful with this option as it can
|
||||||
|
* lead to crashing the browser if the participant waits too long to stop the recording. */
|
||||||
recording_duration: {
|
recording_duration: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
default: 2000,
|
default: 2000,
|
||||||
@ -28,36 +35,85 @@ const info = <const>{
|
|||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
default: "Continue",
|
default: "Continue",
|
||||||
},
|
},
|
||||||
/** Label for the record again button (only used if allow_playback is true). */
|
/** The label for the record again button enabled when `allow_playback: true`.*/
|
||||||
record_again_button_label: {
|
record_again_button_label: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
default: "Record again",
|
default: "Record again",
|
||||||
},
|
},
|
||||||
/** Label for the button to accept the video recording (only used if allow_playback is true). */
|
/** The label for the accept button enabled when `allow_playback: true`. */
|
||||||
accept_button_label: {
|
accept_button_label: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
default: "Continue",
|
default: "Continue",
|
||||||
},
|
},
|
||||||
/** Whether or not to allow the participant to playback the recording and either accept or re-record. */
|
/** Whether to allow the participant to listen to their recording and decide whether to rerecord or not. If `true`,
|
||||||
|
* then the participant will be shown an interface to play their recorded video and click one of two buttons to
|
||||||
|
* either accept the recording or rerecord. If rerecord is selected, then stimulus will be shown again, as if the
|
||||||
|
* trial is starting again from the beginning. */
|
||||||
allow_playback: {
|
allow_playback: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
/** Whether or not to save the video URL to the trial data. */
|
/** If `true`, then an [Object URL](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) will be
|
||||||
|
* generated and stored for the recorded video. Only set this to `true` if you plan to reuse the recorded video
|
||||||
|
* later in the experiment, as it is a potentially memory-intensive feature. */
|
||||||
save_video_url: {
|
save_video_url: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
/** The time, since the onset of the stimulus, for the participant to click the done button. If the button is not clicked (or not enabled), then `rt` will be `null`. */
|
||||||
|
rt: {
|
||||||
|
type: ParameterType.INT,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
/** The HTML content that was displayed on the screen.*/
|
||||||
|
stimulus: {
|
||||||
|
type: ParameterType.HTML_STRING,
|
||||||
|
},
|
||||||
|
/** The base64-encoded video data. */
|
||||||
|
response: {
|
||||||
|
type: ParameterType.STRING,
|
||||||
|
},
|
||||||
|
/** A URL to a copy of the video data. */
|
||||||
|
video_url: {
|
||||||
|
type: ParameterType.STRING,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
type Info = typeof info;
|
type Info = typeof info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* html-video-response
|
*
|
||||||
* jsPsych plugin for displaying a stimulus and recording a video response through a camera
|
* This plugin displays HTML content and records video from the participant via a webcam.
|
||||||
|
*
|
||||||
|
* In order to get access to the camera, you need to use the [initialize-camera plugin](initialize-camera.md) on your timeline prior to using this plugin.
|
||||||
|
* Once access is granted for an experiment you do not need to get permission again.
|
||||||
|
*
|
||||||
|
* This plugin records video data in [base 64 format](https://developer.mozilla.org/en-US/docs/Glossary/Base64).
|
||||||
|
* This is a text-based representation of the video which can be coverted to various video formats using a variety of [online tools](https://www.google.com/search?q=base64+video+decoder) as well as in languages like python and R.
|
||||||
|
*
|
||||||
|
* **This plugin will generate a large amount of data, and you will need to be careful about how you handle this data.**
|
||||||
|
* Even a few seconds of video recording will add 10s of kB to jsPsych's data.
|
||||||
|
* Multiply this by a handful (or more) of trials, and the data objects will quickly get large.
|
||||||
|
* If you need to record a lot of video, either many trials worth or just a few trials with longer responses, we recommend that you save the data to your server immediately after the trial and delete the data in jsPsych's data object.
|
||||||
|
* See below for an example of how to do this.
|
||||||
|
*
|
||||||
|
* This plugin also provides the option to store the recorded video files as [Object URLs](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) via `save_video_url: true`.
|
||||||
|
* This will generate a URL that stores a copy of the recorded video, which can be used for subsequent playback during the experiment.
|
||||||
|
* See below for an example where the recorded video is used as the stimulus in a subsequent trial.
|
||||||
|
* This feature is turned off by default because it uses a relatively large amount of memory compared to most jsPsych features.
|
||||||
|
* If you are running an experiment where you need this feature and you are recording lots of video clips, you may want to manually revoke the URLs when you no longer need them using [`URL.revokeObjectURL(objectURL)`](https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL).
|
||||||
|
*
|
||||||
|
* !!! warning
|
||||||
|
* When recording from a camera your experiment will need to be running over `https://` protocol.
|
||||||
|
* If you try to run the experiment locally using the `file://` protocol or over `http://` protocol you will not
|
||||||
|
* be able to access the camera because of
|
||||||
|
* [potential security problems](https://blog.mozilla.org/webrtc/camera-microphone-require-https-in-firefox-68/).
|
||||||
|
*
|
||||||
* @author Josh de Leeuw
|
* @author Josh de Leeuw
|
||||||
* @see {@link https://www.jspsych.org/plugins/jspsych-html-video-response/ html-video-response plugin documentation on jspsych.org}
|
* @see {@link https://www.jspsych.org/latest/plugins/html-video-response/ html-video-response plugin documentation on jspsych.org}
|
||||||
*/
|
*/
|
||||||
class HtmlVideoResponsePlugin implements JsPsychPlugin<Info> {
|
class HtmlVideoResponsePlugin implements JsPsychPlugin<Info> {
|
||||||
static info = info;
|
static info = info;
|
||||||
|
@ -1,101 +1,125 @@
|
|||||||
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
||||||
|
|
||||||
|
import { version } from "../package.json";
|
||||||
|
|
||||||
const info = <const>{
|
const info = <const>{
|
||||||
name: "iat-html",
|
name: "iat-html",
|
||||||
|
version: version,
|
||||||
parameters: {
|
parameters: {
|
||||||
/** The HTML string to be displayed. */
|
/** The HTML string to be displayed. */
|
||||||
stimulus: {
|
stimulus: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.HTML_STRING,
|
||||||
pretty_name: "Stimulus",
|
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
/** Key press that is associated with the left category label.*/
|
/** Key press that is associated with the `left_category_label`. */
|
||||||
left_category_key: {
|
left_category_key: {
|
||||||
type: ParameterType.KEY,
|
type: ParameterType.KEY,
|
||||||
pretty_name: "Left category key",
|
|
||||||
default: "e",
|
default: "e",
|
||||||
},
|
},
|
||||||
/** Key press that is associated with the right category label. */
|
/** Key press that is associated with the `right_category_label`. */
|
||||||
right_category_key: {
|
right_category_key: {
|
||||||
type: ParameterType.KEY,
|
type: ParameterType.KEY,
|
||||||
pretty_name: "Right category key",
|
|
||||||
default: "i",
|
default: "i",
|
||||||
},
|
},
|
||||||
/** The label that is associated with the stimulus. Aligned to the left side of page */
|
/** An array that contains the words/labels associated with a certain stimulus. The labels are aligned to the left
|
||||||
|
* side of the page. */
|
||||||
left_category_label: {
|
left_category_label: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
pretty_name: "Left category label",
|
|
||||||
array: true,
|
array: true,
|
||||||
default: ["left"],
|
default: ["left"],
|
||||||
},
|
},
|
||||||
/** The label that is associated with the stimulus. Aligned to the right side of the page. */
|
/** An array that contains the words/labels associated with a certain stimulus. The labels are aligned to the right
|
||||||
|
* side of the page. */
|
||||||
right_category_label: {
|
right_category_label: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
pretty_name: "Right category label",
|
|
||||||
array: true,
|
array: true,
|
||||||
default: ["right"],
|
default: ["right"],
|
||||||
},
|
},
|
||||||
/** Array containing the key(s) that allow the user to advance to the next trial if their key press was incorrect. */
|
/** This array contains the characters the participant is allowed to press to move on to the next trial if their key
|
||||||
|
* press was incorrect and feedback was displayed. Can also have 'other key' as an option which will only allow the
|
||||||
|
* user to select the right key to move forward. */
|
||||||
key_to_move_forward: {
|
key_to_move_forward: {
|
||||||
type: ParameterType.KEYS,
|
type: ParameterType.KEYS,
|
||||||
pretty_name: "Key to move forward",
|
|
||||||
default: "ALL_KEYS",
|
default: "ALL_KEYS",
|
||||||
},
|
},
|
||||||
/** If true, then html when wrong will be displayed when user makes an incorrect key press. */
|
/** If `true`, then `html_when_wrong` and `wrong_image_name` is required. If `false`, `trial_duration` is needed
|
||||||
|
* and trial will continue automatically. */
|
||||||
display_feedback: {
|
display_feedback: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Display feedback",
|
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
/** The HTML to display when a user presses the wrong key. */
|
/** The content to display when a user presses the wrong key. */
|
||||||
html_when_wrong: {
|
html_when_wrong: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.HTML_STRING,
|
||||||
pretty_name: "HTML when wrong",
|
|
||||||
default: '<span style="color: red; font-size: 80px">X</span>',
|
default: '<span style="color: red; font-size: 80px">X</span>',
|
||||||
},
|
},
|
||||||
/** Instructions shown at the bottom of the page. */
|
/** Instructions about making a wrong key press and whether another key press is needed to continue. */
|
||||||
bottom_instructions: {
|
bottom_instructions: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.HTML_STRING,
|
||||||
pretty_name: "Bottom instructions",
|
|
||||||
default: "<p>If you press the wrong key, a red X will appear. Press any key to continue.</p>",
|
default: "<p>If you press the wrong key, a red X will appear. Press any key to continue.</p>",
|
||||||
},
|
},
|
||||||
/** If true, in order to advance to the next trial after a wrong key press the user will be forced to press the correct key. */
|
/** If this is `true` and the user presses the wrong key then they have to press the other key to continue. An example
|
||||||
|
* would be two keys 'e' and 'i'. If the key associated with the stimulus is 'e' and key 'i' was pressed, then
|
||||||
|
* pressing 'e' is needed to continue the trial. When this is `true`, then parameter `key_to_move_forward`
|
||||||
|
* is not used. If this is `true` and the user presses the wrong key then they have to press the other key to
|
||||||
|
* continue. An example would be two keys 'e' and 'i'. If the key associated with the stimulus is 'e' and key
|
||||||
|
* 'i' was pressed, then pressing 'e' is needed to continue the trial. When this is `true`, then parameter
|
||||||
|
* `key_to_move_forward` is not used. */
|
||||||
force_correct_key_press: {
|
force_correct_key_press: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Force correct key press",
|
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
/** Stimulus will be associated with either "left" or "right". */
|
/** Either 'left' or 'right'. This indicates whether the stimulus is associated with the key press and
|
||||||
|
* category on the left or right side of the page (`left_category_key` or `right_category_key`). */
|
||||||
stim_key_association: {
|
stim_key_association: {
|
||||||
type: ParameterType.SELECT,
|
type: ParameterType.SELECT,
|
||||||
pretty_name: "Stimulus key association",
|
|
||||||
options: ["left", "right"],
|
options: ["left", "right"],
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
/** If true, trial will end when user makes a response. */
|
/** If true, then the trial will end whenever the participant makes a response (assuming they make their
|
||||||
|
* response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will
|
||||||
|
* continue until the value for `trial_duration` is reached. You can use this parameter to force the participant
|
||||||
|
* to view a stimulus for a fixed amount of time, even if they respond before the time is complete. */
|
||||||
response_ends_trial: {
|
response_ends_trial: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Response ends trial",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
/** How long to show the trial. */
|
/** How long to wait for the participant to make a response before ending the trial in milliseconds. If the
|
||||||
|
* participant fails to make a response before this timer is reached, the participant's response will be
|
||||||
|
* recorded as `null` for the trial and the trial will end. If the value of this parameter is `null`, then
|
||||||
|
* the trial will wait for a response indefinitely. */
|
||||||
trial_duration: {
|
trial_duration: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Trial duration",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
/** The string containing the HTML-formatted content that the participant saw on this trial. */
|
||||||
|
stimulus: {
|
||||||
|
type: ParameterType.HTML_STRING,
|
||||||
|
},
|
||||||
|
/** Indicates which key the participant pressed. */
|
||||||
|
response: {
|
||||||
|
type: ParameterType.STRING,
|
||||||
|
},
|
||||||
|
/** Boolean indicating whether the user's key press was correct or incorrect for the given stimulus. */
|
||||||
|
correct: {
|
||||||
|
type: ParameterType.BOOL,
|
||||||
|
},
|
||||||
|
/** The response time in milliseconds for the participant to make a response. The time is measured from when the stimulus first appears on the screen until the participant's response. */
|
||||||
|
rt: {
|
||||||
|
type: ParameterType.INT,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
type Info = typeof info;
|
type Info = typeof info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **iat-html**
|
* This plugin runs a single trial of the [implicit association test (IAT)](https://implicit.harvard.edu/implicit/iatdetails.html), using HTML content as the stimulus.
|
||||||
*
|
|
||||||
* jsPsych plugin for running an IAT (Implicit Association Test) with an HTML-formatted stimulus
|
|
||||||
*
|
*
|
||||||
* @author Kristin Diep
|
* @author Kristin Diep
|
||||||
* @see {@link https://www.jspsych.org/plugins/jspsych-iat-html/ iat-html plugin documentation on jspsych.org}
|
* @see {@link https://www.jspsych.org/latest/plugins/iat-html/ iat-html plugin documentation on jspsych.org}
|
||||||
*/
|
*/
|
||||||
class IatHtmlPlugin implements JsPsychPlugin<Info> {
|
class IatHtmlPlugin implements JsPsychPlugin<Info> {
|
||||||
static info = info;
|
static info = info;
|
||||||
|
@ -1,101 +1,125 @@
|
|||||||
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
||||||
|
|
||||||
|
import { version } from "../package.json";
|
||||||
|
|
||||||
const info = <const>{
|
const info = <const>{
|
||||||
name: "iat-image",
|
name: "iat-image",
|
||||||
|
version: version,
|
||||||
parameters: {
|
parameters: {
|
||||||
/** The image to be displayed */
|
/** The stimulus to display. The path to an image. */
|
||||||
stimulus: {
|
stimulus: {
|
||||||
type: ParameterType.IMAGE,
|
type: ParameterType.IMAGE,
|
||||||
pretty_name: "Stimulus",
|
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
/** Key press that is associated with the left category label. */
|
/** Key press that is associated with the `left_category_label`. */
|
||||||
left_category_key: {
|
left_category_key: {
|
||||||
type: ParameterType.KEY,
|
type: ParameterType.KEY,
|
||||||
pretty_name: "Left category key",
|
|
||||||
default: "e",
|
default: "e",
|
||||||
},
|
},
|
||||||
/** Key press that is associated with the right category label. */
|
/** Key press that is associated with the `right_category_label`. */
|
||||||
right_category_key: {
|
right_category_key: {
|
||||||
type: ParameterType.KEY,
|
type: ParameterType.KEY,
|
||||||
pretty_name: "Right category key",
|
|
||||||
default: "i",
|
default: "i",
|
||||||
},
|
},
|
||||||
/** The label that is associated with the stimulus. Aligned to the left side of page. */
|
/** An array that contains the words/labels associated with a certain stimulus. The labels are aligned to the left
|
||||||
|
* side of the page. */
|
||||||
left_category_label: {
|
left_category_label: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
pretty_name: "Left category label",
|
|
||||||
array: true,
|
array: true,
|
||||||
default: ["left"],
|
default: ["left"],
|
||||||
},
|
},
|
||||||
/** The label that is associated with the stimulus. Aligned to the right side of the page. */
|
/** An array that contains the words/labels associated with a certain stimulus. The labels are aligned to the right
|
||||||
|
* side of the page. */
|
||||||
right_category_label: {
|
right_category_label: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
pretty_name: "Right category label",
|
|
||||||
array: true,
|
array: true,
|
||||||
default: ["right"],
|
default: ["right"],
|
||||||
},
|
},
|
||||||
/** Array containing the key(s) that allow the user to advance to the next trial if their key press was incorrect. */
|
/** This array contains the characters the participant is allowed to press to move on to the next trial if their key
|
||||||
|
* press was incorrect and feedback was displayed. Can also have 'other key' as an option which will only allow the
|
||||||
|
* user to select the right key to move forward. */
|
||||||
key_to_move_forward: {
|
key_to_move_forward: {
|
||||||
type: ParameterType.KEYS,
|
type: ParameterType.KEYS,
|
||||||
pretty_name: "Key to move forward",
|
|
||||||
default: "ALL_KEYS",
|
default: "ALL_KEYS",
|
||||||
},
|
},
|
||||||
/** If true, then html when wrong will be displayed when user makes an incorrect key press. */
|
/** If `true`, then `html_when_wrong` and `wrong_image_name` is required. If `false`, `trial_duration` is needed
|
||||||
|
* and trial will continue automatically. */
|
||||||
display_feedback: {
|
display_feedback: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Display feedback",
|
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
/** The HTML to display when a user presses the wrong key. */
|
/** The content to display when a user presses the wrong key. */
|
||||||
html_when_wrong: {
|
html_when_wrong: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.HTML_STRING,
|
||||||
pretty_name: "HTML when wrong",
|
|
||||||
default: '<span style="color: red; font-size: 80px">X</span>',
|
default: '<span style="color: red; font-size: 80px">X</span>',
|
||||||
},
|
},
|
||||||
/** Instructions shown at the bottom of the page. */
|
/** Instructions about making a wrong key press and whether another key press is needed to continue. */
|
||||||
bottom_instructions: {
|
bottom_instructions: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.HTML_STRING,
|
||||||
pretty_name: "Bottom instructions",
|
|
||||||
default: "<p>If you press the wrong key, a red X will appear. Press any key to continue.</p>",
|
default: "<p>If you press the wrong key, a red X will appear. Press any key to continue.</p>",
|
||||||
},
|
},
|
||||||
/** If true, in order to advance to the next trial after a wrong key press the user will be forced to press the correct key. */
|
/** If this is `true` and the user presses the wrong key then they have to press the other key to continue. An example
|
||||||
|
* would be two keys 'e' and 'i'. If the key associated with the stimulus is 'e' and key 'i' was pressed, then
|
||||||
|
* pressing 'e' is needed to continue the trial. When this is `true`, then parameter `key_to_move_forward`
|
||||||
|
* is not used. If this is `true` and the user presses the wrong key then they have to press the other key to
|
||||||
|
* continue. An example would be two keys 'e' and 'i'. If the key associated with the stimulus is 'e' and key
|
||||||
|
* 'i' was pressed, then pressing 'e' is needed to continue the trial. When this is `true`, then parameter
|
||||||
|
* `key_to_move_forward` is not used. */
|
||||||
force_correct_key_press: {
|
force_correct_key_press: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Force correct key press",
|
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
/** Stimulus will be associated with either "left" or "right". */
|
/** Either 'left' or 'right'. This indicates whether the stimulus is associated with the key press and
|
||||||
|
* category on the left or right side of the page (`left_category_key` or `right_category_key`). */
|
||||||
stim_key_association: {
|
stim_key_association: {
|
||||||
type: ParameterType.SELECT,
|
type: ParameterType.SELECT,
|
||||||
pretty_name: "Stimulus key association",
|
|
||||||
options: ["left", "right"],
|
options: ["left", "right"],
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
/** If true, trial will end when user makes a response. */
|
/** If true, then the trial will end whenever the participant makes a response (assuming they make their
|
||||||
|
* response before the cutoff specified by the `trial_duration` parameter). If false, then the trial will
|
||||||
|
* continue until the value for `trial_duration` is reached. You can use this parameter to force the participant
|
||||||
|
* to view a stimulus for a fixed amount of time, even if they respond before the time is complete. */
|
||||||
response_ends_trial: {
|
response_ends_trial: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Response ends trial",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
/** How long to show the trial. */
|
/** How long to wait for the participant to make a response before ending the trial in milliseconds. If the
|
||||||
|
* participant fails to make a response before this timer is reached, the participant's response will be
|
||||||
|
* recorded as `null` for the trial and the trial will end. If the value of this parameter is `null`, then
|
||||||
|
* the trial will wait for a response indefinitely. */
|
||||||
trial_duration: {
|
trial_duration: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Trial duration",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
/** The path to the image file that the participant saw on this trial. */
|
||||||
|
stimulus: {
|
||||||
|
type: ParameterType.STRING,
|
||||||
|
},
|
||||||
|
/** Indicates which key the participant pressed. */
|
||||||
|
response: {
|
||||||
|
type: ParameterType.STRING,
|
||||||
|
},
|
||||||
|
/** Boolean indicating whether the user's key press was correct or incorrect for the given stimulus. */
|
||||||
|
correct: {
|
||||||
|
type: ParameterType.BOOL,
|
||||||
|
},
|
||||||
|
/** The response time in milliseconds for the participant to make a response. The time is measured from when the stimulus first appears on the screen until the participant's response. */
|
||||||
|
rt: {
|
||||||
|
type: ParameterType.INT,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
type Info = typeof info;
|
type Info = typeof info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **iat-image**
|
* This plugin runs a single trial of the [implicit association test (IAT)](https://implicit.harvard.edu/implicit/iatdetails.html), using an image as the stimulus.
|
||||||
*
|
|
||||||
* jsPsych plugin for running an IAT (Implicit Association Test) with an image stimulus
|
|
||||||
*
|
*
|
||||||
* @author Kristin Diep
|
* @author Kristin Diep
|
||||||
* @see {@link https://www.jspsych.org/plugins/jspsych-iat-image/ iat-image plugin documentation on jspsych.org}
|
* @see {@link https://www.jspsych.org/latest/plugins/iat-image/ iat-image plugin documentation on jspsych.org}
|
||||||
*/
|
*/
|
||||||
class IatImagePlugin implements JsPsychPlugin<Info> {
|
class IatImagePlugin implements JsPsychPlugin<Info> {
|
||||||
static info = info;
|
static info = info;
|
||||||
|
@ -1,124 +1,144 @@
|
|||||||
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
||||||
|
|
||||||
|
import { version } from "../package.json";
|
||||||
|
|
||||||
const info = <const>{
|
const info = <const>{
|
||||||
name: "image-button-response",
|
name: "image-button-response",
|
||||||
|
version: version,
|
||||||
parameters: {
|
parameters: {
|
||||||
/** The image to be displayed */
|
/** The path of the image file to be displayed. */
|
||||||
stimulus: {
|
stimulus: {
|
||||||
type: ParameterType.IMAGE,
|
type: ParameterType.IMAGE,
|
||||||
pretty_name: "Stimulus",
|
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
/** Set the image height in pixels */
|
/** Set the height of the image in pixels. If left null (no value specified), then the image will display at its natural height. */
|
||||||
stimulus_height: {
|
stimulus_height: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Image height",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** Set the image width in pixels */
|
/** Set the width of the image in pixels. If left null (no value specified), then the image will display at its natural width. */
|
||||||
stimulus_width: {
|
stimulus_width: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Image width",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** Maintain the aspect ratio after setting width or height */
|
/** If setting *only* the width or *only* the height and this parameter is true, then the other dimension will be
|
||||||
|
* scaled to maintain the image's aspect ratio. */
|
||||||
maintain_aspect_ratio: {
|
maintain_aspect_ratio: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Maintain aspect ratio",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
/** Array containing the label(s) for the button(s). */
|
/** Labels for the buttons. Each different string in the array will generate a different button. */
|
||||||
choices: {
|
choices: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
pretty_name: "Choices",
|
|
||||||
default: undefined,
|
default: undefined,
|
||||||
array: true,
|
array: true,
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* A function that, given a choice and its index, returns the HTML string of that choice's
|
* ``(choice: string, choice_index: number)=>`<button class="jspsych-btn">${choice}</button>``; | A function that
|
||||||
* button.
|
* generates the HTML for each button in the `choices` array. The function gets the string and index of the item in
|
||||||
|
* the `choices` array and should return valid HTML. If you want to use different markup for each button, you can do
|
||||||
|
* that by using a conditional on either parameter. The default parameter returns a button element with the text
|
||||||
|
* label of the choice.
|
||||||
*/
|
*/
|
||||||
button_html: {
|
button_html: {
|
||||||
type: ParameterType.FUNCTION,
|
type: ParameterType.FUNCTION,
|
||||||
pretty_name: "Button HTML",
|
|
||||||
default: function (choice: string, choice_index: number) {
|
default: function (choice: string, choice_index: number) {
|
||||||
return `<button class="jspsych-btn">${choice}</button>`;
|
return `<button class="jspsych-btn">${choice}</button>`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/** Any content here will be displayed under the button. */
|
/** This string can contain HTML markup. Any content here will be displayed below the stimulus. The intention is that
|
||||||
|
* it can be used to provide a reminder about the action the participant is supposed to take (e.g., which key to press). */
|
||||||
prompt: {
|
prompt: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.HTML_STRING,
|
||||||
pretty_name: "Prompt",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** How long to show the stimulus. */
|
/** How long to show the stimulus for in milliseconds. If the value is null, then the stimulus will be shown until
|
||||||
|
* the participant makes a response. */
|
||||||
stimulus_duration: {
|
stimulus_duration: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Stimulus duration",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** How long to show the trial. */
|
/** How long to wait for the participant to make a response before ending the trial in milliseconds. If the participant
|
||||||
|
* fails to make a response before this timer is reached, the participant's response will be recorded as null for the
|
||||||
|
* trial and the trial will end. If the value of this parameter is null, the trial will wait for a response indefinitely. */
|
||||||
trial_duration: {
|
trial_duration: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Trial duration",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** The CSS layout for the buttons. Options: 'flex' or 'grid'. */
|
/** Setting to `'grid'` will make the container element have the CSS property `display: grid` and enable the use of
|
||||||
|
* `grid_rows` and `grid_columns`. Setting to `'flex'` will make the container element have the CSS property
|
||||||
|
* `display: flex`. You can customize how the buttons are laid out by adding inline CSS in the `button_html` parameter. */
|
||||||
button_layout: {
|
button_layout: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
pretty_name: "Button layout",
|
|
||||||
default: "grid",
|
default: "grid",
|
||||||
},
|
},
|
||||||
/** The number of grid rows when `button_layout` is "grid".
|
/**
|
||||||
* Setting to `null` will infer the number of rows based on the
|
* The number of rows in the button grid. Only applicable when `button_layout` is set to `'grid'`. If null, the
|
||||||
* number of columns and buttons.
|
* number of rows will be determined automatically based on the number of buttons and the number of columns.
|
||||||
*/
|
*/
|
||||||
grid_rows: {
|
grid_rows: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Grid rows",
|
|
||||||
default: 1,
|
default: 1,
|
||||||
},
|
},
|
||||||
/** The number of grid columns when `button_layout` is "grid".
|
/**
|
||||||
* Setting to `null` (default value) will infer the number of columns
|
* The number of columns in the button grid. Only applicable when `button_layout` is set to `'grid'`. If null, the
|
||||||
* based on the number of rows and buttons. */
|
* number of columns will be determined automatically based on the number of buttons and the number of rows.
|
||||||
|
*/
|
||||||
grid_columns: {
|
grid_columns: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Grid columns",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** If true, then trial will end when user responds. */
|
/** If true, then the trial will end whenever the participant makes a response (assuming they make their response
|
||||||
|
* before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until
|
||||||
|
* the value for `trial_duration` is reached. You can set this parameter to `false` to force the participant to
|
||||||
|
* view a stimulus for a fixed amount of time, even if they respond before the time is complete. */
|
||||||
response_ends_trial: {
|
response_ends_trial: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Response ends trial",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* If true, the image will be drawn onto a canvas element (prevents blank screen between consecutive images in some browsers).
|
* If true, the image will be drawn onto a canvas element. This prevents a blank screen (white flash) between consecutive image trials in some browsers, like Firefox and Edge.
|
||||||
* If false, the image will be shown via an img element.
|
* If false, the image will be shown via an img element, as in previous versions of jsPsych. If the stimulus is an **animated gif**, you must set this parameter to false, because the canvas rendering method will only present static images.
|
||||||
*/
|
*/
|
||||||
render_on_canvas: {
|
render_on_canvas: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Render on canvas",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
/** The delay of enabling button */
|
/** How long the button will delay enabling in milliseconds. */
|
||||||
enable_button_after: {
|
enable_button_after: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Enable button after",
|
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
/** The path of the image that was displayed. */
|
||||||
|
stimulus: {
|
||||||
|
type: ParameterType.STRING,
|
||||||
|
},
|
||||||
|
/** Indicates which button the participant pressed. The first button in the `choices` array is 0, the second is 1, and so on. */
|
||||||
|
response: {
|
||||||
|
type: ParameterType.INT,
|
||||||
|
},
|
||||||
|
/** The response time in milliseconds for the participant to make a response. The time is measured from when the stimulus first appears on the screen until the participant's response. */
|
||||||
|
rt: {
|
||||||
|
type: ParameterType.INT,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
type Info = typeof info;
|
type Info = typeof info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **image-button-response**
|
* This plugin displays an image and records responses generated with a button click. The stimulus can be displayed until
|
||||||
|
* a response is given, or for a pre-determined amount of time. The trial can be ended automatically if the participant
|
||||||
|
* has failed to respond within a fixed length of time. The button itself can be customized using HTML formatting.
|
||||||
*
|
*
|
||||||
* jsPsych plugin for displaying an image stimulus and getting a button response
|
* Image files can be automatically preloaded by jsPsych using the [`preload` plugin](preload.md). However, if you
|
||||||
|
* are using timeline variables or another dynamic method to specify the image stimulus, you will need to
|
||||||
|
* [manually preload](../overview/media-preloading.md#manual-preloading) the images.
|
||||||
*
|
*
|
||||||
* @author Josh de Leeuw
|
* @author Josh de Leeuw
|
||||||
* @see {@link https://www.jspsych.org/plugins/jspsych-image-button-response/ image-button-response plugin documentation on jspsych.org}
|
* @see {@link https://www.jspsych.org/latest/plugins/image-button-response/ image-button-response plugin documentation on jspsych.org}
|
||||||
*/
|
*/
|
||||||
class ImageButtonResponsePlugin implements JsPsychPlugin<Info> {
|
class ImageButtonResponsePlugin implements JsPsychPlugin<Info> {
|
||||||
static info = info;
|
static info = info;
|
||||||
|
@ -1,83 +1,108 @@
|
|||||||
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
||||||
|
|
||||||
|
import { version } from "../package.json";
|
||||||
|
|
||||||
const info = <const>{
|
const info = <const>{
|
||||||
name: "image-keyboard-response",
|
name: "image-keyboard-response",
|
||||||
|
version: version,
|
||||||
parameters: {
|
parameters: {
|
||||||
/** The image to be displayed */
|
/** The path of the image file to be displayed. */
|
||||||
stimulus: {
|
stimulus: {
|
||||||
type: ParameterType.IMAGE,
|
type: ParameterType.IMAGE,
|
||||||
pretty_name: "Stimulus",
|
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
/** Set the image height in pixels */
|
/** Set the height of the image in pixels. If left null (no value specified), then the image will display at its natural height. */
|
||||||
stimulus_height: {
|
stimulus_height: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Image height",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** Set the image width in pixels */
|
/** Set the width of the image in pixels. If left null (no value specified), then the image will display at its natural width. */
|
||||||
stimulus_width: {
|
stimulus_width: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Image width",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** Maintain the aspect ratio after setting width or height */
|
/** If setting *only* the width or *only* the height and this parameter is true, then the other dimension will be scaled
|
||||||
|
* to maintain the image's aspect ratio. */
|
||||||
maintain_aspect_ratio: {
|
maintain_aspect_ratio: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Maintain aspect ratio",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
/** Array containing the key(s) the subject is allowed to press to respond to the stimulus. */
|
/**his array contains the key(s) that the participant is allowed to press in order to respond to the stimulus. Keys should
|
||||||
|
* be specified as characters (e.g., `'a'`, `'q'`, `' '`, `'Enter'`, `'ArrowDown'`) - see
|
||||||
|
* [this page](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) and
|
||||||
|
* [this page (event.key column)](https://www.freecodecamp.org/news/javascript-keycode-list-keypress-event-key-codes/)
|
||||||
|
* for more examples. Any key presses that are not listed in the array will be ignored. The default value of `"ALL_KEYS"`
|
||||||
|
* means that all keys will be accepted as valid responses. Specifying `"NO_KEYS"` will mean that no responses are allowed. */
|
||||||
choices: {
|
choices: {
|
||||||
type: ParameterType.KEYS,
|
type: ParameterType.KEYS,
|
||||||
pretty_name: "Choices",
|
|
||||||
default: "ALL_KEYS",
|
default: "ALL_KEYS",
|
||||||
},
|
},
|
||||||
/** Any content here will be displayed below the stimulus. */
|
/**This string can contain HTML markup. Any content here will be displayed below the stimulus. The intention is that it can
|
||||||
|
* be used to provide a reminder about the action the participant is supposed to take (e.g., which key to press). */
|
||||||
prompt: {
|
prompt: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.HTML_STRING,
|
||||||
pretty_name: "Prompt",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** How long to show the stimulus. */
|
/** How long to show the stimulus for in milliseconds. If the value is `null`, then the stimulus will be shown until the
|
||||||
|
* participant makes a response. */
|
||||||
stimulus_duration: {
|
stimulus_duration: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Stimulus duration",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** How long to show trial before it ends */
|
/** How long to wait for the participant to make a response before ending the trial in milliseconds. If the participant
|
||||||
|
* fails to make a response before this timer is reached, the participant's response will be recorded as null for the
|
||||||
|
* trial and the trial will end. If the value of this parameter is `null`, then the trial will wait for a response indefinitely. */
|
||||||
trial_duration: {
|
trial_duration: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Trial duration",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** If true, trial will end when subject makes a response. */
|
/** If true, then the trial will end whenever the participant makes a response (assuming they make their response before
|
||||||
|
* the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the value for
|
||||||
|
* `trial_duration` is reached. You can set this parameter to `false` to force the participant to view a stimulus for a
|
||||||
|
* fixed amount of time, even if they respond before the time is complete. */
|
||||||
response_ends_trial: {
|
response_ends_trial: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Response ends trial",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* If true, the image will be drawn onto a canvas element (prevents blank screen between consecutive images in some browsers).
|
* If `true`, the image will be drawn onto a canvas element. This prevents a blank screen (white flash) between consecutive image trials in some browsers, like Firefox and Edge.
|
||||||
* If false, the image will be shown via an img element.
|
* If `false`, the image will be shown via an img element, as in previous versions of jsPsych. If the stimulus is an **animated gif**, you must set this parameter to false, because the canvas rendering method will only present static images.
|
||||||
*/
|
*/
|
||||||
render_on_canvas: {
|
render_on_canvas: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Render on canvas",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
/** The path of the image that was displayed. */
|
||||||
|
stimulus: {
|
||||||
|
type: ParameterType.STRING,
|
||||||
|
},
|
||||||
|
/** Indicates which key the participant pressed. */
|
||||||
|
response: {
|
||||||
|
type: ParameterType.STRING,
|
||||||
|
},
|
||||||
|
/** The response time in milliseconds for the participant to make a response. The time is measured from when the stimulus
|
||||||
|
* first appears on the screen until the participant's response. */
|
||||||
|
rt: {
|
||||||
|
type: ParameterType.INT,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
type Info = typeof info;
|
type Info = typeof info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **image-keyboard-response**
|
* This plugin displays an image and records responses generated with the keyboard. The stimulus can be displayed until a
|
||||||
|
* response is given, or for a pre-determined amount of time. The trial can be ended automatically if the participant has
|
||||||
|
* failed to respond within a fixed length of time.
|
||||||
*
|
*
|
||||||
* jsPsych plugin for displaying an image stimulus and getting a keyboard response
|
* Image files can be automatically preloaded by jsPsych using the [`preload` plugin](preload.md). However, if you are using
|
||||||
|
* timeline variables or another dynamic method to specify the image stimulus, you will need to
|
||||||
|
* [manually preload](../overview/media-preloading.md#manual-preloading) the images.
|
||||||
*
|
*
|
||||||
* @author Josh de Leeuw
|
* @author Josh de Leeuw
|
||||||
* @see {@link https://www.jspsych.org/plugins/jspsych-image-keyboard-response/ image-keyboard-response plugin documentation on jspsych.org}
|
* @see {@link https://www.jspsych.org/latest/plugins/image-keyboard-response/ image-keyboard-response plugin documentation on jspsych.org}
|
||||||
*/
|
*/
|
||||||
class ImageKeyboardResponsePlugin implements JsPsychPlugin<Info> {
|
class ImageKeyboardResponsePlugin implements JsPsychPlugin<Info> {
|
||||||
static info = info;
|
static info = info;
|
||||||
|
@ -1,127 +1,146 @@
|
|||||||
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
||||||
|
|
||||||
|
import { version } from "../package.json";
|
||||||
|
|
||||||
const info = <const>{
|
const info = <const>{
|
||||||
name: "image-slider-response",
|
name: "image-slider-response",
|
||||||
|
version: version,
|
||||||
parameters: {
|
parameters: {
|
||||||
/** The image to be displayed */
|
/** The path to the image file to be displayed. */
|
||||||
stimulus: {
|
stimulus: {
|
||||||
type: ParameterType.IMAGE,
|
type: ParameterType.IMAGE,
|
||||||
pretty_name: "Stimulus",
|
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
/** Set the image height in pixels */
|
/** Set the height of the image in pixels. If left null (no value specified), then the image will display at its natural height. */
|
||||||
stimulus_height: {
|
stimulus_height: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Image height",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** Set the image width in pixels */
|
/** Set the width of the image in pixels. If left null (no value specified), then the image will display at its natural width. */
|
||||||
stimulus_width: {
|
stimulus_width: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Image width",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** Maintain the aspect ratio after setting width or height */
|
/** If setting *only* the width or *only* the height and this parameter is true, then the other dimension will be scaled
|
||||||
|
* to maintain the image's aspect ratio. */
|
||||||
maintain_aspect_ratio: {
|
maintain_aspect_ratio: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Maintain aspect ratio",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
/** Sets the minimum value of the slider. */
|
/** Sets the minimum value of the slider. */
|
||||||
min: {
|
min: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Min slider",
|
|
||||||
default: 0,
|
default: 0,
|
||||||
},
|
},
|
||||||
/** Sets the maximum value of the slider */
|
/** Sets the maximum value of the slider. */
|
||||||
max: {
|
max: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Max slider",
|
|
||||||
default: 100,
|
default: 100,
|
||||||
},
|
},
|
||||||
/** Sets the starting value of the slider */
|
/** Sets the starting value of the slider. */
|
||||||
slider_start: {
|
slider_start: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Slider starting value",
|
|
||||||
default: 50,
|
default: 50,
|
||||||
},
|
},
|
||||||
/** Sets the step of the slider */
|
/** Sets the step of the slider. */
|
||||||
step: {
|
step: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Step",
|
|
||||||
default: 1,
|
default: 1,
|
||||||
},
|
},
|
||||||
/** Array containing the labels for the slider. Labels will be displayed at equidistant locations along the slider. */
|
/** abels displayed at equidistant locations on the slider. For example, two labels will be placed at the ends of the slider.
|
||||||
|
* Three labels would place two at the ends and one in the middle. Four will place two at the ends, and the other two will
|
||||||
|
* be at 33% and 67% of the slider width. */
|
||||||
labels: {
|
labels: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.STRING,
|
||||||
pretty_name: "Labels",
|
|
||||||
default: [],
|
default: [],
|
||||||
array: true,
|
array: true,
|
||||||
},
|
},
|
||||||
/** Width of the slider in pixels. */
|
/** Set the width of the slider in pixels. If left null, then the width will be equal to the widest element in the display. */
|
||||||
slider_width: {
|
slider_width: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Slider width",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** Label of the button to advance. */
|
/** Label of the button to advance/submit. */
|
||||||
button_label: {
|
button_label: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
pretty_name: "Button label",
|
|
||||||
default: "Continue",
|
default: "Continue",
|
||||||
array: false,
|
array: false,
|
||||||
},
|
},
|
||||||
/** If true, the participant will have to move the slider before continuing. */
|
/** If true, the participant must move the slider before clicking the continue button. */
|
||||||
require_movement: {
|
require_movement: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Require movement",
|
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
/** Any content here will be displayed below the slider. */
|
/** This string can contain HTML markup. Any content here will be displayed below the stimulus. The intention is that it can be
|
||||||
|
* used to provide a reminder about the action the participant is supposed to take (e.g., which key to press). */
|
||||||
prompt: {
|
prompt: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.HTML_STRING,
|
||||||
pretty_name: "Prompt",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** How long to show the stimulus. */
|
/** How long to show the stimulus for in milliseconds. If the value is null, then the stimulus will be shown until the participant
|
||||||
|
* makes a response. */
|
||||||
stimulus_duration: {
|
stimulus_duration: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Stimulus duration",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** How long to show the trial. */
|
/** How long to wait for the participant to make a response before ending the trial in milliseconds. If the participant
|
||||||
|
* fails to make a response before this timer is reached, the participant's response will be recorded as null for the trial
|
||||||
|
* and the trial will end. If the value of this parameter is null, then the trial will wait for a response indefinitely. */
|
||||||
trial_duration: {
|
trial_duration: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
pretty_name: "Trial duration",
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** If true, trial will end when user makes a response. */
|
/** If true, then the trial will end whenever the participant makes a response (assuming they make their response
|
||||||
|
* before the cutoff specified by the `trial_duration` parameter). If false, then the trial will continue until the
|
||||||
|
* value for `trial_duration` is reached. You can set this parameter to `false` to force the participant to view a
|
||||||
|
* stimulus for a fixed amount of time, even if they respond before the time is complete. */
|
||||||
response_ends_trial: {
|
response_ends_trial: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Response ends trial",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* If true, the image will be drawn onto a canvas element (prevents blank screen between consecutive images in some browsers).
|
* If true, the image will be drawn onto a canvas element. This prevents a blank screen (white flash) between
|
||||||
* If false, the image will be shown via an img element.
|
* consecutive image trials in some browsers, like Firefox and Edge.
|
||||||
|
* If false, the image will be shown via an img element, as in previous versions of jsPsych. If the stimulus is
|
||||||
|
* an **animated gif**, you must set this parameter to false, because the canvas rendering method will only present static images.
|
||||||
*/
|
*/
|
||||||
render_on_canvas: {
|
render_on_canvas: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Render on canvas",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
/** The path of the image that was displayed. */
|
||||||
|
stimulus: {
|
||||||
|
type: ParameterType.STRING,
|
||||||
|
},
|
||||||
|
/** The numeric value of the slider. */
|
||||||
|
response: {
|
||||||
|
type: ParameterType.INT,
|
||||||
|
},
|
||||||
|
/** The time in milliseconds for the participant to make a response. The time is measured from when the stimulus
|
||||||
|
* first appears on the screen until the participant's response. */
|
||||||
|
rt: {
|
||||||
|
type: ParameterType.INT,
|
||||||
|
},
|
||||||
|
/** The starting value of the slider. */
|
||||||
|
slider_start: {
|
||||||
|
type: ParameterType.INT,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
type Info = typeof info;
|
type Info = typeof info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **image-slider-response**
|
* This plugin displays and image and allows the participant to respond by dragging a slider.
|
||||||
*
|
*
|
||||||
* jsPsych plugin for showing an image stimulus and getting a slider response
|
* Image files can be automatically preloaded by jsPsych using the [`preload` plugin](preload.md). However, if you are
|
||||||
|
* using timeline variables or another dynamic method to specify the image stimulus, you will need
|
||||||
|
* to [manually preload](../overview/media-preloading.md#manual-preloading) the images.
|
||||||
*
|
*
|
||||||
* @author Josh de Leeuw
|
* @author Josh de Leeuw
|
||||||
* @see {@link https://www.jspsych.org/plugins/jspsych-image-slider-response/ image-slider-response plugin documentation on jspsych.org}
|
* @see {@link https://www.jspsych.org/latest/plugins/image-slider-response/ image-slider-response plugin documentation on jspsych.org}
|
||||||
*/
|
*/
|
||||||
class ImageSliderResponsePlugin implements JsPsychPlugin<Info> {
|
class ImageSliderResponsePlugin implements JsPsychPlugin<Info> {
|
||||||
static info = info;
|
static info = info;
|
||||||
|
@ -1,50 +1,73 @@
|
|||||||
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
||||||
|
|
||||||
|
import { version } from "../package.json";
|
||||||
|
|
||||||
const info = <const>{
|
const info = <const>{
|
||||||
name: "initialize-camera",
|
name: "initialize-camera",
|
||||||
|
version: version,
|
||||||
parameters: {
|
parameters: {
|
||||||
/** Message to display with the selection box */
|
/** The message to display when the user is presented with a dropdown list of available devices. */
|
||||||
device_select_message: {
|
device_select_message: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.HTML_STRING,
|
||||||
default: `<p>Please select the camera you would like to use.</p>`,
|
default: `<p>Please select the camera you would like to use.</p>`,
|
||||||
},
|
},
|
||||||
/** Label to use for the button that confirms selection */
|
/** The label for the select button. */
|
||||||
button_label: {
|
button_label: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
default: "Use this camera",
|
default: "Use this camera",
|
||||||
},
|
},
|
||||||
/** Set to `true` to include audio in the recording */
|
/** Set to `true` to include an audio track in the recordings. */
|
||||||
include_audio: {
|
include_audio: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
/** Desired width of the camera stream */
|
/** Request a specific width for the recording. This is not a guarantee that this width will be used, as it
|
||||||
|
* depends on the capabilities of the participant's device. Learn more about `MediaRecorder` constraints
|
||||||
|
* [here](https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API/Constraints#requesting_a_specific_value_for_a_setting). */
|
||||||
width: {
|
width: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** Desired height of the camera stream */
|
/** Request a specific height for the recording. This is not a guarantee that this height will be used, as it
|
||||||
|
* depends on the capabilities of the participant's device. Learn more about `MediaRecorder` constraints
|
||||||
|
* [here](https://developer.mozilla.org/en-US/docs/Web/API/Media_Streams_API/Constraints#requesting_a_specific_value_for_a_setting). */
|
||||||
height: {
|
height: {
|
||||||
type: ParameterType.INT,
|
type: ParameterType.INT,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
/** MIME type of the recording. Set as a full string, e.g., 'video/webm; codecs="vp8, vorbis"'. */
|
/** Set this to use a specific [MIME type](https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/mimeType) for the
|
||||||
|
* recording. Set the entire type, e.g., `'video/mp4; codecs="avc1.424028, mp4a.40.2"'`. */
|
||||||
mime_type: {
|
mime_type: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
/** The [device ID](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/deviceId) of the selected camera. */
|
||||||
|
device_id: {
|
||||||
|
type: ParameterType.STRING,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
type Info = typeof info;
|
type Info = typeof info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **initialize-camera**
|
* This plugin asks the participant to grant permission to access a camera.
|
||||||
|
* If multiple cameras are connected to the participant's device, then it allows the participant to pick which device to use.
|
||||||
|
* Once access is granted for an experiment you do not need to get permission again.
|
||||||
|
*
|
||||||
|
* Once the camera is selected with this plugin it can be accessed with
|
||||||
|
* [`jsPsych.pluginAPI.getCameraRecorder()`](../reference/jspsych-pluginAPI.md#getcamerarecorder).
|
||||||
|
*
|
||||||
|
* !!! warning
|
||||||
|
* When recording from a camera your experiment will need to be running over `https://` protocol. If you try to
|
||||||
|
* run the experiment locally using the `file://` protocol or over `http://` protocol you will not be able to access
|
||||||
|
* the microphone because of [potential security problems](https://blog.mozilla.org/webrtc/camera-microphone-require-https-in-firefox-68/).
|
||||||
*
|
*
|
||||||
* jsPsych plugin for getting permission to initialize a camera and setting properties of the recording.
|
|
||||||
*
|
*
|
||||||
* @author Josh de Leeuw
|
* @author Josh de Leeuw
|
||||||
* @see {@link https://www.jspsych.org/plugins/jspsych-initialize-camera/ initialize-camera plugin documentation on jspsych.org}
|
* @see {@link https://www.jspsych.org/latest/plugins/initialize-camera/ initialize-camera plugin documentation on jspsych.org}
|
||||||
*/
|
*/
|
||||||
class InitializeCameraPlugin implements JsPsychPlugin<Info> {
|
class InitializeCameraPlugin implements JsPsychPlugin<Info> {
|
||||||
static info = info;
|
static info = info;
|
||||||
|
@ -1,30 +1,48 @@
|
|||||||
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
||||||
|
|
||||||
|
import { version } from "../package.json";
|
||||||
|
|
||||||
const info = <const>{
|
const info = <const>{
|
||||||
name: "initialize-microphone",
|
name: "initialize-microphone",
|
||||||
|
version: version,
|
||||||
parameters: {
|
parameters: {
|
||||||
/** Function to call */
|
/** The message to display when the user is presented with a dropdown list of available devices. */
|
||||||
device_select_message: {
|
device_select_message: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.HTML_STRING,
|
||||||
default: `<p>Please select the microphone you would like to use.</p>`,
|
default: `<p>Please select the microphone you would like to use.</p>`,
|
||||||
},
|
},
|
||||||
/** Is the function call asynchronous? */
|
/** The label for the select button. */
|
||||||
button_label: {
|
button_label: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
default: "Use this microphone",
|
default: "Use this microphone",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
/** The [device ID](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/deviceId) of the selected microphone. */
|
||||||
|
device_id: {
|
||||||
|
type: ParameterType.STRING,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
type Info = typeof info;
|
type Info = typeof info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **initialize-microphone**
|
* This plugin asks the participant to grant permission to access a microphone.
|
||||||
|
* If multiple microphones are connected to the participant's device, then it allows the participant to pick which device to use.
|
||||||
|
* Once access is granted for an experiment you do not need to get permission again.
|
||||||
*
|
*
|
||||||
* jsPsych plugin for getting permission to initialize a microphone
|
* Once the microphone is selected with this plugin it can be accessed with
|
||||||
|
* [`jsPsych.pluginAPI.getMicrophoneRecorder()`](../reference/jspsych-pluginAPI.md#getmicrophonerecorder).
|
||||||
|
*
|
||||||
|
* !!! warning
|
||||||
|
* When recording from a microphone your experiment will need to be running over `https://` protocol.
|
||||||
|
* If you try to run the experiment locally using the `file://` protocol or over `http://` protocol you will not
|
||||||
|
* be able to access the microphone because of
|
||||||
|
* [potential security problems](https://blog.mozilla.org/webrtc/camera-microphone-require-https-in-firefox-68/).
|
||||||
*
|
*
|
||||||
* @author Josh de Leeuw
|
* @author Josh de Leeuw
|
||||||
* @see {@link https://www.jspsych.org/plugins/jspsych-initialize-microphone/ initialize-microphone plugin documentation on jspsych.org}
|
* @see {@link https://www.jspsych.org/latest/plugins/initialize-microphone/ initialize-microphone plugin documentation on jspsych.org}
|
||||||
*/
|
*/
|
||||||
class InitializeMicrophonePlugin implements JsPsychPlugin<Info> {
|
class InitializeMicrophonePlugin implements JsPsychPlugin<Info> {
|
||||||
static info = info;
|
static info = info;
|
||||||
|
@ -1,83 +1,102 @@
|
|||||||
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";
|
||||||
|
import { parameterPathArrayToString } from "jspsych/src/timeline/util";
|
||||||
|
|
||||||
|
import { version } from "../package.json";
|
||||||
|
|
||||||
const info = <const>{
|
const info = <const>{
|
||||||
name: "instructions",
|
name: "instructions",
|
||||||
|
version: version,
|
||||||
parameters: {
|
parameters: {
|
||||||
/** Each element of the array is the HTML-formatted content for a single page. */
|
/** Each element of the array is the content for a single page. Each page should be an HTML-formatted string. */
|
||||||
pages: {
|
pages: {
|
||||||
type: ParameterType.HTML_STRING,
|
type: ParameterType.HTML_STRING,
|
||||||
pretty_name: "Pages",
|
|
||||||
default: undefined,
|
default: undefined,
|
||||||
array: true,
|
array: true,
|
||||||
},
|
},
|
||||||
/** The key the subject can press in order to advance to the next page. */
|
/** This is the key that the participant can press in order to advance to the next page. This key should be
|
||||||
|
* specified as a string (e.g., `'a'`, `'ArrowLeft'`, `' '`, `'Enter'`). */
|
||||||
key_forward: {
|
key_forward: {
|
||||||
type: ParameterType.KEY,
|
type: ParameterType.KEY,
|
||||||
pretty_name: "Key forward",
|
|
||||||
default: "ArrowRight",
|
default: "ArrowRight",
|
||||||
},
|
},
|
||||||
/** The key that the subject can press to return to the previous page. */
|
/** This is the key that the participant can press to return to the previous page. This key should be specified as a
|
||||||
|
* string (e.g., `'a'`, `'ArrowLeft'`, `' '`, `'Enter'`). */
|
||||||
key_backward: {
|
key_backward: {
|
||||||
type: ParameterType.KEY,
|
type: ParameterType.KEY,
|
||||||
pretty_name: "Key backward",
|
|
||||||
default: "ArrowLeft",
|
default: "ArrowLeft",
|
||||||
},
|
},
|
||||||
/** If true, the subject can return to the previous page of the instructions. */
|
/** If true, the participant can return to previous pages of the instructions. If false, they may only advace to the next page. */
|
||||||
allow_backward: {
|
allow_backward: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Allow backward",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
/** If true, the subject can use keyboard keys to navigate the pages. */
|
/** If `true`, the participant can use keyboard keys to navigate the pages. If `false`, they may not. */
|
||||||
allow_keys: {
|
allow_keys: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Allow keys",
|
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
/** If true, then a "Previous" and "Next" button will be displayed beneath the instructions. */
|
/** If true, then a `Previous` and `Next` button will be displayed beneath the instructions. Participants can
|
||||||
|
* click the buttons to navigate. */
|
||||||
show_clickable_nav: {
|
show_clickable_nav: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Show clickable nav",
|
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
/** If true, and clickable navigation is enabled, then Page x/y will be shown between the nav buttons. */
|
/** If true, and clickable navigation is enabled, then Page x/y will be shown between the nav buttons. */
|
||||||
show_page_number: {
|
show_page_number: {
|
||||||
type: ParameterType.BOOL,
|
type: ParameterType.BOOL,
|
||||||
pretty_name: "Show page number",
|
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
/** The text that appears before x/y (current/total) pages displayed with show_page_number. */
|
/** The text that appears before x/y pages displayed when show_page_number is true.*/
|
||||||
page_label: {
|
page_label: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
pretty_name: "Page label",
|
|
||||||
default: "Page",
|
default: "Page",
|
||||||
},
|
},
|
||||||
/** The text that appears on the button to go backwards. */
|
/** The text that appears on the button to go backwards. */
|
||||||
button_label_previous: {
|
button_label_previous: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
pretty_name: "Button label previous",
|
|
||||||
default: "Previous",
|
default: "Previous",
|
||||||
},
|
},
|
||||||
/** The text that appears on the button to go forwards. */
|
/** The text that appears on the button to go forwards. */
|
||||||
button_label_next: {
|
button_label_next: {
|
||||||
type: ParameterType.STRING,
|
type: ParameterType.STRING,
|
||||||
pretty_name: "Button label next",
|
|
||||||
default: "Next",
|
default: "Next",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
/** An array containing the order of pages the participant viewed (including when the participant returned to previous pages)
|
||||||
|
* and the time spent viewing each page. Each object in the array represents a single page view,
|
||||||
|
* and contains keys called `page_index` (the page number, starting with 0) and `viewing_time`
|
||||||
|
* (duration of the page view). This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()`
|
||||||
|
* functions.
|
||||||
|
*/
|
||||||
|
view_history: {
|
||||||
|
type: ParameterType.COMPLEX,
|
||||||
|
array: true,
|
||||||
|
parameters: {
|
||||||
|
page_index: {
|
||||||
|
type: ParameterType.INT,
|
||||||
|
},
|
||||||
|
viewing_time: {
|
||||||
|
type: ParameterType.INT,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
/** The response time in milliseconds for the participant to view all of the pages. */
|
||||||
|
rt: {
|
||||||
|
type: ParameterType.INT,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
type Info = typeof info;
|
type Info = typeof info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **instructions**
|
* This plugin is for showing instructions to the participant. It allows participants to navigate through multiple pages
|
||||||
*
|
* of instructions at their own pace, recording how long the participant spends on each page. Navigation can be done using
|
||||||
* jsPsych plugin to display text (including HTML-formatted strings) during the experiment.
|
* the mouse or keyboard. participants can be allowed to navigate forwards and backwards through pages, if desired.
|
||||||
* Use it to show a set of pages that participants can move forward/backward through.
|
|
||||||
* Page numbers can be displayed to help with navigation by setting show_page_number to true.
|
|
||||||
*
|
*
|
||||||
* @author Josh de Leeuw
|
* @author Josh de Leeuw
|
||||||
* @see {@link https://www.jspsych.org/plugins/jspsych-instructions/ instructions plugin documentation on jspsych.org}
|
* @see {@link https://www.jspsych.org/latest/plugins/instructions/ instructions plugin documentation on jspsych.org}
|
||||||
*/
|
*/
|
||||||
class InstructionsPlugin implements JsPsychPlugin<Info> {
|
class InstructionsPlugin implements JsPsychPlugin<Info> {
|
||||||
static info = info;
|
static info = info;
|
||||||
|
@ -47,12 +47,10 @@ const info = <const>{
|
|||||||
type Info = typeof info;
|
type Info = typeof info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **maxdiff**
|
* The maxdiff plugin displays a table with rows of alternatives to be selected for two mutually-exclusive categories, typically as 'most' or 'least' on a particular criteria (e.g. importance, preference, similarity). The participant responds by selecting one radio button corresponding to an alternative in both the left and right response columns. The same alternative cannot be endorsed on both the left and right response columns (e.g. 'most' and 'least') simultaneously.
|
||||||
*
|
|
||||||
* jsPsych plugin for maxdiff/conjoint analysis designs
|
|
||||||
*
|
*
|
||||||
* @author Angus Hughes
|
* @author Angus Hughes
|
||||||
* @see {@link https://www.jspsych.org/plugins/jspsych-maxdiff/ maxdiff plugin documentation on jspsych.org}
|
* @see {@link https://www.jspsych.org/latest/plugins/maxdiff/ maxdiff plugin documentation on jspsych.org}
|
||||||
*/
|
*/
|
||||||
class MaxdiffPlugin implements JsPsychPlugin<Info> {
|
class MaxdiffPlugin implements JsPsychPlugin<Info> {
|
||||||
static info = info;
|
static info = info;
|
||||||
|
Loading…
Reference in New Issue
Block a user