update documentation for plugin instructions

This commit is contained in:
Shaobin-Jiang 2023-11-23 22:21:27 +08:00
parent 14fd8573bd
commit 7eac06cb58
No known key found for this signature in database
GPG Key ID: B679CC70E159691F

View File

@ -8,18 +8,19 @@ This plugin is for showing instructions to the participant. It allows participan
In addition to the [parameters available in all plugins](../overview/plugins.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
| Parameter | Type | Default Value | Description |
| --------------------- | ------- | ------------- | ---------------------------------------- |
| pages | array | *undefined* | Each element of the array is the content for a single page. Each page should be an HTML-formatted string. |
| key_forward | string | 'ArrowRight' | 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_backward | string | 'ArrowLeft' | 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'`). |
| allow_backward | boolean | true | If true, the participant can return to previous pages of the instructions. If false, they may only advace to the next page. |
| allow_keys | boolean | true | If `true`, the participant can use keyboard keys to navigate the pages. If `false`, they may not. |
| show_clickable_nav | boolean | false | If true, then a `Previous` and `Next` button will be displayed beneath the instructions. Participants can click the buttons to navigate. |
| button_label_previous | string | 'Previous' | The text that appears on the button to go backwards. |
| button_label_next | string | 'Next' | The text that appears on the button to go forwards. |
| show_page_number | boolean | false | If true, and clickable navigation is enabled, then Page x/y will be shown between the nav buttons. |
| page_label | string | 'Page' | The text that appears before x/y pages displayed when show_page_number is true. |
| Parameter | Type | Default Value | Description |
| --------------------- | -------- | ------------- | ---------------------------------------- |
| pages | array | *undefined* | Each element of the array is the content for a single page. Each page should be an HTML-formatted string. |
| key_forward | string | 'ArrowRight' | 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_backward | string | 'ArrowLeft' | 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'`). |
| allow_backward | boolean | true | If true, the participant can return to previous pages of the instructions. If false, they may only advace to the next page. |
| allow_keys | boolean | true | If `true`, the participant can use keyboard keys to navigate the pages. If `false`, they may not. |
| show_clickable_nav | boolean | false | If true, then a `Previous` and `Next` button will be displayed beneath the instructions. Participants can click the buttons to navigate. |
| button_label_previous | string | 'Previous' | The text that appears on the button to go backwards. |
| button_label_next | string | 'Next' | The text that appears on the button to go forwards. |
| show_page_number | boolean | false | If true, and clickable navigation is enabled, then Page x/y will be shown between the nav buttons. |
| page_label | string | 'Page' | The text that appears before x/y pages displayed when show_page_number is true. |
| page_change_callback | function | ``function (current_page) {}`` | The function that is called every time the page changes. This function receives a single argument `current_page`, which is the index of the current page **after page change**, and starts at `0`. The function is also called when going forward from the last page, i.e., finishing the trial. |
## Data Generated
@ -128,4 +129,4 @@ import instructions from '@jspsych/plugin-instructions';
<iframe src="../../demos/jspsych-instructions-demo-3.html" width="90%;" height="500px;" frameBorder="0"></iframe>
</div>
<a target="_blank" rel="noopener noreferrer" href="../../demos/jspsych-instructions-demo-3.html">Open demo in new tab</a>
<a target="_blank" rel="noopener noreferrer" href="../../demos/jspsych-instructions-demo-3.html">Open demo in new tab</a>