From e8be19ad8965e29fa803ec55e747bc5de710b7d5 Mon Sep 17 00:00:00 2001 From: Daiichiro Kuroki <32691644+kurokida@users.noreply.github.com> Date: Wed, 4 Aug 2021 15:13:44 +0900 Subject: [PATCH] Create live demos for jspsych-html-* plugin --- .../jspsych-html-button-response-demo1.html | 56 ++++++++++++++++++ .../jspsych-html-keyboard-response-demo1.html | 57 ++++++++++++++++++ .../jspsych-html-keyboard-response-demo2.html | 57 ++++++++++++++++++ .../jspsych-html-slider-response-demo1.html | 58 +++++++++++++++++++ docs/plugins/jspsych-html-button-response.md | 26 ++++++--- .../plugins/jspsych-html-keyboard-response.md | 48 +++++++++------ docs/plugins/jspsych-html-slider-response.md | 25 +++++--- 7 files changed, 292 insertions(+), 35 deletions(-) create mode 100644 docs/plugins/demos/jspsych-html-button-response-demo1.html create mode 100644 docs/plugins/demos/jspsych-html-keyboard-response-demo1.html create mode 100644 docs/plugins/demos/jspsych-html-keyboard-response-demo2.html create mode 100644 docs/plugins/demos/jspsych-html-slider-response-demo1.html diff --git a/docs/plugins/demos/jspsych-html-button-response-demo1.html b/docs/plugins/demos/jspsych-html-button-response-demo1.html new file mode 100644 index 00000000..73351b5b --- /dev/null +++ b/docs/plugins/demos/jspsych-html-button-response-demo1.html @@ -0,0 +1,56 @@ + + +
+ + + + + + + + + + diff --git a/docs/plugins/demos/jspsych-html-keyboard-response-demo1.html b/docs/plugins/demos/jspsych-html-keyboard-response-demo1.html new file mode 100644 index 00000000..ac533f23 --- /dev/null +++ b/docs/plugins/demos/jspsych-html-keyboard-response-demo1.html @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + diff --git a/docs/plugins/demos/jspsych-html-keyboard-response-demo2.html b/docs/plugins/demos/jspsych-html-keyboard-response-demo2.html new file mode 100644 index 00000000..dcc42e6b --- /dev/null +++ b/docs/plugins/demos/jspsych-html-keyboard-response-demo2.html @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + diff --git a/docs/plugins/demos/jspsych-html-slider-response-demo1.html b/docs/plugins/demos/jspsych-html-slider-response-demo1.html new file mode 100644 index 00000000..de6f1814 --- /dev/null +++ b/docs/plugins/demos/jspsych-html-slider-response-demo1.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + diff --git a/docs/plugins/jspsych-html-button-response.md b/docs/plugins/jspsych-html-button-response.md index 951b948a..7ccb701c 100644 --- a/docs/plugins/jspsych-html-button-response.md +++ b/docs/plugins/jspsych-html-button-response.md @@ -30,13 +30,21 @@ stimulus | string | The HTML content that was displayed on the screen. ## Examples -#### Displaying question until subject gives a response +???+ example "Displaying question until subject gives a response" + === "Code" + ```javascript + var trial = { + type: 'html-button-response', + stimulus: 'Running
', + choices: ['Healthy', 'Unhealthy'], + prompt: "Is this activity healthy or unhealthy?
" + }; + ``` + === "Demo" +Running
', - choices: ['Healthy', 'Unhealthy'], - prompt: "Is this activity healthy or unhealthy?
" -}; -``` diff --git a/docs/plugins/jspsych-html-keyboard-response.md b/docs/plugins/jspsych-html-keyboard-response.md index 201d0a87..20b3af3a 100644 --- a/docs/plugins/jspsych-html-keyboard-response.md +++ b/docs/plugins/jspsych-html-keyboard-response.md @@ -28,24 +28,36 @@ In addition to the [default data collected by all plugins](/overview/plugins#dat ## Examples -#### Displaying trial until subject gives a response +???+ example "Displaying trial until subject gives a response" + === "Code" + ```javascript + var trial = { + type: 'html-keyboard-response', + stimulus: 'Running
', + choices: ['e', 'i'], + prompt: "Is this activity healthy or unhealthy?
Press 'e' for healthy and 'i' for unhealthy.
" + }; + ``` + === "Demo" +Running
', - choices: ['e', 'i'], - prompt: "Is this activity healthy or unhealthy? Press 'e' for healthy and 'i' for unhealthy.
" -}; -``` + Open demo in new tab -#### Showing a 1 second fixation cross; no response allowed +???+ example "Showing a 1 second fixation cross; no response allowed" + === "Code" + ```javascript + var trial = { + type: 'html-keyboard-response', + stimulus: '+
', + choices: jsPsych.NO_KEYS, + trial_duration: 1000, + }; + ``` + === "Demo" ++
', - choices: jsPsych.NO_KEYS, - trial_duration: 1000, -}; -``` + Open demo in new tab diff --git a/docs/plugins/jspsych-html-slider-response.md b/docs/plugins/jspsych-html-slider-response.md index 956ba87d..f7e89708 100644 --- a/docs/plugins/jspsych-html-slider-response.md +++ b/docs/plugins/jspsych-html-slider-response.md @@ -35,11 +35,20 @@ slider_start | numeric | The starting value of the slider. ## Examples -```javascript -var trial = { - type: 'html-slider-response', - stimulus: 'Running
', - labels: ['healthy', 'unhealthy'], - prompt: "How healthy/unhealthy is this activity?
" -}; -``` +???+ example "Displaying question until subject move the slider" + === "Code" + ```javascript + var trial = { + type: 'html-slider-response', + stimulus: 'Running
', + require_movement: true, + labels: ['healthy', 'unhealthy'], + prompt: "How healthy/unhealthy is this activity?
" + }; + ``` + === "Demo" +