From e6b55d7ce2f8129bdf31b75118909af1c0fa635f Mon Sep 17 00:00:00 2001 From: KristinDiep Date: Wed, 12 Jul 2017 10:21:35 -0400 Subject: [PATCH 01/25] created demos --- examples/demo-flanker-demo.html | 59 +++++++++++++++++++++++++++++++ examples/demo-image-keyboard.html | 43 ++++++++++++++++++++++ examples/demo-instructions.html | 30 ++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 examples/demo-flanker-demo.html create mode 100644 examples/demo-image-keyboard.html create mode 100644 examples/demo-instructions.html diff --git a/examples/demo-flanker-demo.html b/examples/demo-flanker-demo.html new file mode 100644 index 00000000..22352849 --- /dev/null +++ b/examples/demo-flanker-demo.html @@ -0,0 +1,59 @@ + + + + Flanker Task + + + + + + + + + \ No newline at end of file diff --git a/examples/demo-image-keyboard.html b/examples/demo-image-keyboard.html new file mode 100644 index 00000000..0613ee3e --- /dev/null +++ b/examples/demo-image-keyboard.html @@ -0,0 +1,43 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/demo-instructions.html b/examples/demo-instructions.html new file mode 100644 index 00000000..94961b23 --- /dev/null +++ b/examples/demo-instructions.html @@ -0,0 +1,30 @@ + + + + Flanker Task + + + + + + + + \ No newline at end of file From e276a0b613ac1fc086b5ca7f2367fba0392f7d78 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 11:32:56 -0400 Subject: [PATCH 02/25] Update README.md --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index c262ce69..b0a35b30 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,44 @@ jsPsych is a JavaScript library for creating behavioral experiments that run in a web browser. jsPsych creates a framework for defining experiments and provides a set of flexible plugins that create different kinds of tasks a subject could complete during an experiment. By assembling different plugins together and customizing the parameters of each, it is possible to create many different types of experiments. +Here is a simple example of how to use the instructions plugin: +
+ + +
+ + +```javascript + + + + var trial = { + type: 'instructions', + pages: [ + 'Welcome to the experiment. Click next to begin.', + '
In this experiment, you will view a ' + + 'series of images and answer questions.
' + + 'Answer with the keys "y" or "n".', + 'Here is an example:

' + + '

' + + 'Is this person OLD or YOUNG?' + ], + show_clickable_nav: true + } + + jsPsych.init({ + timeline: [trial], + }); + + + + +``` + + +
+
+ Documentation ------------- From ca1344795056402ddada63e27d61bdcedb48b79b Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 11:33:28 -0400 Subject: [PATCH 03/25] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index b0a35b30..7de43c51 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,12 @@ Here is a simple example of how to use the instructions plugin: + + + + + + var trial = { type: 'instructions', pages: [ @@ -34,6 +40,10 @@ Here is a simple example of how to use the instructions plugin: + + + + ``` From 499e9c53b15373146b969c293e66374117c91d9d Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 11:54:01 -0400 Subject: [PATCH 04/25] Update README.md --- README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7de43c51..3fb0b619 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ jsPsych is a JavaScript library for creating behavioral experiments that run in Here is a simple example of how to use the instructions plugin:
- +
@@ -50,6 +50,30 @@ Here is a simple example of how to use the instructions plugin:
+ +This is an example of the image-keyboard-response plugin: +
+ + +
+ + + +
+
+ + +And for a slightly longer experiment example, here is a flanker experiment which uses the html-keyboard-response plugin: +
+ + +
+ + + +
+
+ Documentation ------------- From 87b894b98359d5e4e5db3a44d047b2af6a667407 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 11:54:48 -0400 Subject: [PATCH 05/25] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 3fb0b619..ae52c899 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ Here is a simple example of how to use the instructions plugin: + + var trial = { type: 'instructions', pages: [ @@ -44,6 +46,7 @@ Here is a simple example of how to use the instructions plugin: + ``` From 1d1c568087f3f0af58f6a62dbbf32fb7800f1e79 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 11:55:07 -0400 Subject: [PATCH 06/25] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ae52c899..f514c13d 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ Here is a simple example of how to use the instructions plugin: - var trial = { type: 'instructions', pages: [ From b77053cda4f1e4bebeb8b532110f7002f48aa8b4 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 11:56:44 -0400 Subject: [PATCH 07/25] Update README.md --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index f514c13d..638ce64a 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,39 @@ This is an example of the image-keyboard-response plugin:
+```javascript + + + var trial_1 = { + type: "image-keyboard-response", + stimulus: 'img/happy_face_1.jpg', + choices: [89, 78], + prompt: '

Is this face happy? Y or N.

' + } + + var trial_2 = { + type: 'image-keyboard-response', + stimulus: 'img/sad_face_2.jpg', + choices: [89, 78], // Y or N + prompt: '

Is this face happy? Y or N.

' + } + + var trial_3 = { + type: 'image-keyboard-response', + stimulus: 'img/happy_face_2.jpg', + choices: [89, 78], // Y or N + prompt: '

Is this face happy? Y or N.

', + } + + + jsPsych.init({ + timeline: [trial_1, trial_2, trial_3], + default_iti: 250 + }); + + + +```
From e5fae92814cde68471f066e20817388b923da200 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 11:57:25 -0400 Subject: [PATCH 08/25] Update README.md --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 638ce64a..1e8f4c51 100644 --- a/README.md +++ b/README.md @@ -67,21 +67,24 @@ This is an example of the image-keyboard-response plugin: type: "image-keyboard-response", stimulus: 'img/happy_face_1.jpg', choices: [89, 78], - prompt: '

Is this face happy? Y or N.

' + prompt: '

' + + 'Is this face happy? Y or N.

' } var trial_2 = { type: 'image-keyboard-response', stimulus: 'img/sad_face_2.jpg', choices: [89, 78], // Y or N - prompt: '

Is this face happy? Y or N.

' + prompt: '

' + + 'Is this face happy? Y or N.

' } var trial_3 = { type: 'image-keyboard-response', stimulus: 'img/happy_face_2.jpg', choices: [89, 78], // Y or N - prompt: '

Is this face happy? Y or N.

', + prompt: '

' + + 'Is this face happy? Y or N.

', } From ff0986a0140142ef1c343b9413c464b3a57ac80b Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 11:57:44 -0400 Subject: [PATCH 09/25] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1e8f4c51..a2c82883 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ This is an example of the image-keyboard-response plugin: ```javascript + var trial_1 = { type: "image-keyboard-response", stimulus: 'img/happy_face_1.jpg', From 0fc5c323fd3dba79038e378acb11c6a45d94185c Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 11:58:00 -0400 Subject: [PATCH 10/25] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a2c82883..ca3798c5 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ This is an example of the image-keyboard-response plugin: + var trial_1 = { type: "image-keyboard-response", stimulus: 'img/happy_face_1.jpg', From 669e909af54f6071ccc43a772e0a1393f4edff91 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 12:02:59 -0400 Subject: [PATCH 11/25] Update README.md --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.md b/README.md index ca3798c5..5e5447f4 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,51 @@ And for a slightly longer experiment example, here is a flanker experiment which
+```javascript +var test_stimuli = [ + { stimulus: "<<<<<", data: { stim_type: 'congruent'} }, + { stimulus: ">>>>>", data: { stim_type: 'congruent'} }, + { stimulus: "<<><<", data: { stim_type: 'incongruent'} }, + { stimulus: ">><>>", data: { stim_type: 'incongruent'} } +]; +var test = { + timeline: [{ + type: 'html-keyboard-response', + choices: [37, 39], + stimulus: jsPsych.timelineVariable('stimulus'), + data: jsPsych.timelineVariable('data'), + post_trial_gap: 1500, + response_ends_trial: true + }], + timeline_variables: test_stimuli, + sample: {type: 'fixed-repetitions', size: 2} +}; +var debrief = { + type: "html-keyboard-response", + stimulus: function() { + var congruent_rt = Math.round(jsPsych.data.get() + .filter({stim_type: 'congruent'}).select('rt').mean()); + var incongruent_rt = Math.round(jsPsych.data.get() + .filter({stim_type: 'incongruent'}).select('rt').mean()); + return "

" + + "Your average response time for congruent trials was " + + congruent_rt + "ms.

"+ + "

" + + "Your average response time for incongruent trials was " + + incongruent_rt + "ms.

"; + } +}; +var timeline = []; +timeline.push(test); +timeline.push(debrief); +jsPsych.init({ + timeline: timeline, + on_finish: function() { + jsPsych.data.displayData(); + } +}); +``` +
From 2b2c2c2973eb798487b2e898601db651fea8590d Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 12:04:40 -0400 Subject: [PATCH 12/25] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5e5447f4..b6957255 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ This is an example of the image-keyboard-response plugin: And for a slightly longer experiment example, here is a flanker experiment which uses the html-keyboard-response plugin:
- +
@@ -133,14 +133,14 @@ var debrief = { type: "html-keyboard-response", stimulus: function() { var congruent_rt = Math.round(jsPsych.data.get() - .filter({stim_type: 'congruent'}).select('rt').mean()); + .filter({stim_type: 'congruent'}).select('rt').mean()); var incongruent_rt = Math.round(jsPsych.data.get() - .filter({stim_type: 'incongruent'}).select('rt').mean()); + .filter({stim_type: 'incongruent'}).select('rt').mean()); return "

" + - "Your average response time for congruent trials was " + + "Your average response time for congruent trials was "+ congruent_rt + "ms.

"+ "

" + - "Your average response time for incongruent trials was " + + "Your average response time for incongruent trials was "+ incongruent_rt + "ms.

"; } }; From 11065386893a66eb1552b355f3277487cc42e868 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 12:05:55 -0400 Subject: [PATCH 13/25] Update README.md --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b6957255..7911c8dc 100644 --- a/README.md +++ b/README.md @@ -115,8 +115,7 @@ var test_stimuli = [ { stimulus: "<<<<<", data: { stim_type: 'congruent'} }, { stimulus: ">>>>>", data: { stim_type: 'congruent'} }, { stimulus: "<<><<", data: { stim_type: 'incongruent'} }, - { stimulus: ">><>>", data: { stim_type: 'incongruent'} } -]; + { stimulus: ">><>>", data: { stim_type: 'incongruent'} } ]; var test = { timeline: [{ type: 'html-keyboard-response', @@ -127,8 +126,7 @@ var test = { response_ends_trial: true }], timeline_variables: test_stimuli, - sample: {type: 'fixed-repetitions', size: 2} -}; + sample: {type: 'fixed-repetitions', size: 2}}; var debrief = { type: "html-keyboard-response", stimulus: function() { @@ -142,8 +140,7 @@ var debrief = { "

" + "Your average response time for incongruent trials was "+ incongruent_rt + "ms.

"; - } -}; + }}; var timeline = []; timeline.push(test); timeline.push(debrief); From dfd7994d5c5fdd3998fb0fccf9e87c5377f9d683 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 12:11:59 -0400 Subject: [PATCH 14/25] Update README.md --- README.md | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7911c8dc..ddae4d32 100644 --- a/README.md +++ b/README.md @@ -130,17 +130,15 @@ var test = { var debrief = { type: "html-keyboard-response", stimulus: function() { - var congruent_rt = Math.round(jsPsych.data.get() - .filter({stim_type: 'congruent'}).select('rt').mean()); - var incongruent_rt = Math.round(jsPsych.data.get() - .filter({stim_type: 'incongruent'}).select('rt').mean()); - return "

" + - "Your average response time for congruent trials was "+ - congruent_rt + "ms.

"+ - "

" + - "Your average response time for incongruent trials was "+ - incongruent_rt + "ms.

"; - }}; + var congruent_rt = Math.round(jsPsych.data.get() + .filter({stim_type: 'congruent'}).select('rt').mean()); + var incongruent_rt = Math.round(jsPsych.data.get() + .filter({stim_type: 'incongruent'}).select('rt').mean()); + return "

Your average response time for congruent trials"+ + "was "+congruent_rt+"ms.

"+ + "

Your average response time for incongruent trials was"+ + ""incongruent_rt + "ms.

"; + }}; var timeline = []; timeline.push(test); timeline.push(debrief); From 5b891301829f810756b6dacbfea2dcb0aa5485ad Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 12:12:53 -0400 Subject: [PATCH 15/25] Update README.md --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ddae4d32..6b6d0b0f 100644 --- a/README.md +++ b/README.md @@ -123,10 +123,9 @@ var test = { stimulus: jsPsych.timelineVariable('stimulus'), data: jsPsych.timelineVariable('data'), post_trial_gap: 1500, - response_ends_trial: true - }], - timeline_variables: test_stimuli, - sample: {type: 'fixed-repetitions', size: 2}}; + response_ends_trial: true }], + timeline_variables: test_stimuli, + sample: {type: 'fixed-repetitions', size: 2}}; var debrief = { type: "html-keyboard-response", stimulus: function() { From 08f5b679194703b48b4a010e02c74d798394e0f3 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 14:15:26 -0400 Subject: [PATCH 16/25] Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6b6d0b0f..4a413d7e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ jsPsych is a JavaScript library for creating behavioral experiments that run in Here is a simple example of how to use the instructions plugin:
- +
@@ -20,6 +20,7 @@ Here is a simple example of how to use the instructions plugin: + var trial = { type: 'instructions', pages: [ @@ -46,6 +47,7 @@ Here is a simple example of how to use the instructions plugin: + ``` @@ -55,7 +57,7 @@ Here is a simple example of how to use the instructions plugin: This is an example of the image-keyboard-response plugin:
- +
@@ -105,7 +107,7 @@ This is an example of the image-keyboard-response plugin: And for a slightly longer experiment example, here is a flanker experiment which uses the html-keyboard-response plugin:
- +
From 32339b8e17622bda4ac1010246bbe2ea63e69ee4 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 14:15:45 -0400 Subject: [PATCH 17/25] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4a413d7e..9ad2160a 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Here is a simple example of how to use the instructions plugin: + var trial = { type: 'instructions', pages: [ @@ -48,6 +49,7 @@ Here is a simple example of how to use the instructions plugin: + ``` From 8a7c8e46661bf88b982207328283e92150517d64 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 14:16:04 -0400 Subject: [PATCH 18/25] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9ad2160a..e017227a 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ Here is a simple example of how to use the instructions plugin: + + var trial = { type: 'instructions', pages: [ From 77c30313697d03b014cbf83449aa98caca3a5f8a Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 14:16:23 -0400 Subject: [PATCH 19/25] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index e017227a..b317bddf 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ Here is a simple example of how to use the instructions plugin: - var trial = { type: 'instructions', pages: [ From 7de768bfeac8e2fd18b50a7bf460c87e4e53fc2b Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 14:17:34 -0400 Subject: [PATCH 20/25] Update README.md --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b317bddf..909b9e53 100644 --- a/README.md +++ b/README.md @@ -70,28 +70,27 @@ This is an example of the image-keyboard-response plugin: + + var trial_1 = { type: "image-keyboard-response", stimulus: 'img/happy_face_1.jpg', choices: [89, 78], - prompt: '

' + - 'Is this face happy? Y or N.

' + prompt: '

Is this face happy? Y or N.

' } var trial_2 = { type: 'image-keyboard-response', stimulus: 'img/sad_face_2.jpg', choices: [89, 78], // Y or N - prompt: '

' + - 'Is this face happy? Y or N.

' + prompt: '

Is this face happy? Y or N.

' } var trial_3 = { type: 'image-keyboard-response', stimulus: 'img/happy_face_2.jpg', choices: [89, 78], // Y or N - prompt: '

' + - 'Is this face happy? Y or N.

', + prompt: '

Is this face happy? Y or N.

', } @@ -102,6 +101,8 @@ This is an example of the image-keyboard-response plugin: + + ```
From 5266fabdb61df8d04728cda804f37aff22744b62 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 14:18:20 -0400 Subject: [PATCH 21/25] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 909b9e53..cf964eb1 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ This is an example of the image-keyboard-response plugin: + var trial_1 = { type: "image-keyboard-response", stimulus: 'img/happy_face_1.jpg', @@ -103,6 +104,8 @@ This is an example of the image-keyboard-response plugin: + + ```
From 1fd6ee077e5af193ffcd13643e779a3d775e5657 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 14:19:08 -0400 Subject: [PATCH 22/25] Update README.md --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cf964eb1..038729c5 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,7 @@ var test_stimuli = [ { stimulus: ">>>>>", data: { stim_type: 'congruent'} }, { stimulus: "<<><<", data: { stim_type: 'incongruent'} }, { stimulus: ">><>>", data: { stim_type: 'incongruent'} } ]; + var test = { timeline: [{ type: 'html-keyboard-response', @@ -134,7 +135,9 @@ var test = { post_trial_gap: 1500, response_ends_trial: true }], timeline_variables: test_stimuli, - sample: {type: 'fixed-repetitions', size: 2}}; + sample: {type: 'fixed-repetitions', size: 2} +}; + var debrief = { type: "html-keyboard-response", stimulus: function() { @@ -146,7 +149,9 @@ var debrief = { "was "+congruent_rt+"ms.

"+ "

Your average response time for incongruent trials was"+ ""incongruent_rt + "ms.

"; - }}; + } +}; + var timeline = []; timeline.push(test); timeline.push(debrief); From 26ad97c4f43a3c93f18a162aa097077d35d01cd3 Mon Sep 17 00:00:00 2001 From: kristiyip Date: Wed, 12 Jul 2017 14:21:51 -0400 Subject: [PATCH 23/25] Update README.md --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 038729c5..23eaa371 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,11 @@ jsPsych is a JavaScript library for creating behavioral experiments that run in a web browser. jsPsych creates a framework for defining experiments and provides a set of flexible plugins that create different kinds of tasks a subject could complete during an experiment. By assembling different plugins together and customizing the parameters of each, it is possible to create many different types of experiments. -Here is a simple example of how to use the instructions plugin: + +Code Demos +---------- + +Demo 1 with the instructions plugin:
@@ -58,7 +62,7 @@ Here is a simple example of how to use the instructions plugin:
-This is an example of the image-keyboard-response plugin: +Demo 2 with the image-keyboard-response plugin:
@@ -112,7 +116,7 @@ This is an example of the image-keyboard-response plugin:
-And for a slightly longer experiment example, here is a flanker experiment which uses the html-keyboard-response plugin: +And for a slightly longer experiment example, demo 3 with the html-keyboard-response plugin. Also shows data after experiment ends:
From f21ad81d1ef25a90f3532631e799a72695d035c8 Mon Sep 17 00:00:00 2001 From: KristinDiep Date: Wed, 12 Jul 2017 14:09:10 -0400 Subject: [PATCH 24/25] removed param block under plugin.trial --- examples/demo-flanker-demo.html | 1 - examples/demo-image-keyboard.html | 43 ---------- examples/demo-instructions.html | 1 - plugins/jspsych-animation.js | 6 -- plugins/jspsych-audio-button-response.js | 78 +++++++++++-------- plugins/jspsych-audio-keyboard-response.js | 7 -- plugins/jspsych-audio-slider-response.js | 40 +++++++--- plugins/jspsych-call-function.js | 14 ++-- plugins/jspsych-categorize-animation.js | 14 +--- plugins/jspsych-categorize-html.js | 21 +---- plugins/jspsych-categorize-image.js | 21 +---- plugins/jspsych-external-html.js | 5 -- plugins/jspsych-free-sort.js | 9 --- plugins/jspsych-fullscreen.js | 5 -- plugins/jspsych-html-button-response.js | 21 ++--- plugins/jspsych-html-keyboard-response.js | 7 -- plugins/jspsych-html-slider-response.js | 13 +--- plugins/jspsych-iat-html.js | 15 ---- plugins/jspsych-iat-image.js | 15 ---- plugins/jspsych-image-button-response.js | 21 ++--- plugins/jspsych-image-slider-response.js | 11 --- plugins/jspsych-instructions.js | 8 -- plugins/jspsych-reconstruction.js | 7 -- plugins/jspsych-resize.js | 8 -- plugins/jspsych-same-different-html.js | 9 --- plugins/jspsych-same-different-image.js | 16 ++-- plugins/jspsych-serial-reaction-time-mouse.js | 26 ++----- plugins/jspsych-serial-reaction-time.js | 14 +--- plugins/jspsych-survey-likert.js | 11 +-- plugins/jspsych-survey-multi-choice.js | 7 -- plugins/jspsych-survey-multi-select.js | 8 -- plugins/jspsych-survey-text.js | 2 - plugins/jspsych-video.js | 5 -- plugins/jspsych-visual-search-circle.js | 13 +--- plugins/jspsych-vsl-animate-occlusion.js | 11 +-- plugins/jspsych-vsl-grid-scene.js | 5 -- plugins/jspsych-xab-html.js | 11 +-- plugins/jspsych-xab-image.js | 9 --- 38 files changed, 142 insertions(+), 396 deletions(-) delete mode 100644 examples/demo-image-keyboard.html diff --git a/examples/demo-flanker-demo.html b/examples/demo-flanker-demo.html index 22352849..b0b84301 100644 --- a/examples/demo-flanker-demo.html +++ b/examples/demo-flanker-demo.html @@ -1,7 +1,6 @@ - Flanker Task diff --git a/examples/demo-image-keyboard.html b/examples/demo-image-keyboard.html deleted file mode 100644 index 0613ee3e..00000000 --- a/examples/demo-image-keyboard.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/demo-instructions.html b/examples/demo-instructions.html index 94961b23..504feeb6 100644 --- a/examples/demo-instructions.html +++ b/examples/demo-instructions.html @@ -1,7 +1,6 @@ - Flanker Task diff --git a/plugins/jspsych-animation.js b/plugins/jspsych-animation.js index 0a916cb2..ef81f074 100644 --- a/plugins/jspsych-animation.js +++ b/plugins/jspsych-animation.js @@ -58,12 +58,6 @@ jsPsych.plugins.animation = (function() { plugin.trial = function(display_element, trial) { - trial.frame_time = trial.frame_time || 250; - trial.frame_isi = trial.frame_isi || 0; - trial.sequence_reps = trial.sequence_reps || 1; - trial.choices = trial.choices || jsPsych.ALL_KEYS; - trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt; - var interval_time = trial.frame_time + trial.frame_isi; var animate_frame = -1; var reps = 0; diff --git a/plugins/jspsych-audio-button-response.js b/plugins/jspsych-audio-button-response.js index 40e0411b..f51eaad4 100644 --- a/plugins/jspsych-audio-button-response.js +++ b/plugins/jspsych-audio-button-response.js @@ -30,39 +30,51 @@ jsPsych.plugins["audio-button-response"] = (function() { no_function: false, description: '' }, - button_html: { - type: jsPsych.plugins.parameterType.HTML_STRING, - default: '', - no_function: false, - array: true, - description: '' - }, - prompt: { - type: jsPsych.plugins.parameterType.STRING, - default: '', - no_function: false, - description: '' - }, - trial_duration: { - type: jsPsych.plugins.parameterType.INT, - default: -1, - no_function: false, - description: '' - }, - response_ends_trial: { - type: jsPsych.plugins.parameterType.BOOL, - default: true, - no_function: false, - description: '' - }, - trial_ends_after_audio: { - type: jsPsych.plugins.parameterType.BOOL, - default: false, - no_function: false, - description: '' - }, - } - } + button_html: { + type: jsPsych.plugins.parameterType.HTML_STRING, + default: '', + no_function: false, + array: true, + description: '' + }, + prompt: { + type: jsPsych.plugins.parameterType.STRING, + default: '', + no_function: false, + description: '' + }, + trial_duration: { + type: jsPsych.plugins.parameterType.INT, + default: -1, + no_function: false, + description: '' + }, + margin_vertical: { + type: jsPsych.parameterType.STRING, + default: '0px', + no_function: false, + description: '' + }, + margin_horizontal: { + type: jsPsych.parameterType.STRING, + default: '8px', + no_function: false, + description: '' + }, + response_ends_trial: { + type: jsPsych.plugins.parameterType.BOOL, + default: true, + no_function: false, + description: '' + }, + trial_ends_after_audio: { + type: jsPsych.plugins.parameterType.BOOL, + default: false, + no_function: false, + description: '' + }, + } + } plugin.trial = function(display_element, trial) { diff --git a/plugins/jspsych-audio-keyboard-response.js b/plugins/jspsych-audio-keyboard-response.js index cc5f2c64..e44f53df 100644 --- a/plugins/jspsych-audio-keyboard-response.js +++ b/plugins/jspsych-audio-keyboard-response.js @@ -60,13 +60,6 @@ jsPsych.plugins["audio-keyboard-response"] = (function() { plugin.trial = function(display_element, trial) { - // default parameters - trial.choices = trial.choices || jsPsych.ALL_KEYS; - 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_duration = trial.trial_duration || -1; // if -1, then wait for response forever - trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt; - // setup stimulus var context = jsPsych.pluginAPI.audioContext(); if(context !== null){ diff --git a/plugins/jspsych-audio-slider-response.js b/plugins/jspsych-audio-slider-response.js index 33a0e266..2fe91f54 100644 --- a/plugins/jspsych-audio-slider-response.js +++ b/plugins/jspsych-audio-slider-response.js @@ -19,6 +19,30 @@ jsPsych.plugins['audio-slider-response'] = (function() { no_function: false, description: '' }, + min: { + type: jsPsych.plugins.parameterType.INT, + default: 0, + no_function: false, + description: '' + }, + max: { + type: jsPsych.plugins.parameterType.INT, + default: 100, + no_function: false, + description: '' + }, + step: { + type: jsPsych.plugins.parameterType.INT, + default: 1, + no_function: false, + description: '' + }, + button_label: { + type: jsPsych.plugins.parameterType.STRING, + default: 'Next', + no_function: false, + description: '' + }, trial_duration: { type: jsPsych.plugins.parameterType.INT, default: -1, @@ -37,21 +61,17 @@ jsPsych.plugins['audio-slider-response'] = (function() { no_function: false, description: '' }, + prompt: { + type: jsPsych.plugins.parameterType.STRING, + default: '', + no_function: false, + description: '' + } } } plugin.trial = function(display_element, trial) { - trial.min = trial.min || 0; - trial.max = trial.max || 100; - trial.step = trial.step || 1; - trial.button_label = typeof trial.button_label === 'undefined' ? 'Next' : trial.button_label; - 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.stimulus_duration = trial.stimulus_duration || -1; - trial.trial_duration = trial.trial_duration || -1; - trial.prompt = trial.prompt || ""; - // setup stimulus var context = jsPsych.pluginAPI.audioContext(); if(context !== null){ diff --git a/plugins/jspsych-call-function.js b/plugins/jspsych-call-function.js index 214976dc..93b0d793 100644 --- a/plugins/jspsych-call-function.js +++ b/plugins/jspsych-call-function.js @@ -20,17 +20,21 @@ jsPsych.plugins['call-function'] = (function() { default: undefined, no_function: false, description: '' + }, + // a rare case where we override the default experiment level + // value of this parameter, since this plugin should be invisible + // to the subject of the experiment + post_trial_gap: { + type: jsPsych.plugins.parameterType.INT, + default: 0, + no_function: false, + description: '' } } } plugin.trial = function(display_element, trial) { - // a rare case where we override the default experiment level - // value of this parameter, since this plugin should be invisible - // to the subject of the experiment - trial.post_trial_gap = typeof trial.post_trial_gap == 'undefined' ? 0 : trial.post_trial_gap - var return_val = trial.func(); var trial_data = { diff --git a/plugins/jspsych-categorize-animation.js b/plugins/jspsych-categorize-animation.js index ea9a4e43..670bf47d 100644 --- a/plugins/jspsych-categorize-animation.js +++ b/plugins/jspsych-categorize-animation.js @@ -55,7 +55,7 @@ jsPsych.plugins["categorize-animation"] = (function() { }, frame_time: { type: jsPsych.plugins.parameterType.INT, - default: 250, + default: 500, no_function: false, description: '' }, @@ -88,18 +88,6 @@ jsPsych.plugins["categorize-animation"] = (function() { plugin.trial = function(display_element, trial) { - // set default values - trial.choices = trial.choices || jsPsych.ALL_KEYS; - trial.sequence_reps = trial.sequence_reps || 1; - trial.key_answer = trial.key_answer; - trial.text_answer = (typeof trial.text_answer === 'undefined') ? "" : trial.text_answer; - trial.correct_text = trial.correct_text || "Correct."; - trial.incorrect_text = trial.incorrect_text || "Wrong."; - trial.allow_response_before_complete = trial.allow_response_before_complete || false; - trial.frame_time = trial.frame_time || 500; - trial.feedback_duration = trial.feedback_duration || 2000; - trial.prompt = (typeof trial.prompt === 'undefined') ? '' : trial.prompt; - var animate_frame = -1; var reps = 0; diff --git a/plugins/jspsych-categorize-html.js b/plugins/jspsych-categorize-html.js index 6643fb00..6557d545 100644 --- a/plugins/jspsych-categorize-html.js +++ b/plugins/jspsych-categorize-html.js @@ -41,13 +41,13 @@ jsPsych.plugins['categorize-html'] = (function() { }, correct_text: { type: jsPsych.plugins.parameterType.STRING, - default: 'Correct.', + default: "", no_function: false, description: '' }, incorrect_text: { type: jsPsych.plugins.parameterType.STRING, - default: 'Wrong.', + default: "", no_function: false, description: '' }, @@ -77,7 +77,7 @@ jsPsych.plugins['categorize-html'] = (function() { }, timeout_message: { type: jsPsych.plugins.parameterType.STRING, - default: 'Please respond faster.', + default: "

Please respond faster.

", no_function: false, description: '' }, @@ -104,21 +104,6 @@ jsPsych.plugins['categorize-html'] = (function() { plugin.trial = function(display_element, trial) { - // default parameters - trial.choices = trial.choices || jsPsych.ALL_KEYS; - trial.text_answer = (typeof trial.text_answer === 'undefined') ? "" : trial.text_answer; - trial.correct_text = (typeof trial.correct_text === 'undefined') ? "" : trial.correct_text; - trial.incorrect_text = (typeof trial.incorrect_text === 'undefined') ? "" : trial.incorrect_text; - trial.show_stim_with_feedback = (typeof trial.show_stim_with_feedback === 'undefined') ? true : trial.show_stim_with_feedback; - trial.force_correct_button_press = (typeof trial.force_correct_button_press === 'undefined') ? false : trial.force_correct_button_press; - trial.prompt = (typeof trial.prompt === 'undefined') ? '' : trial.prompt; - trial.show_feedback_on_timeout = (typeof trial.show_feedback_on_timeout === 'undefined') ? false : trial.show_feedback_on_timeout; - trial.timeout_message = trial.timeout_message || "

Please respond faster.

"; - // timing params - trial.stimulus_duration = trial.stimulus_duration || -1; // default is to show image until response - trial.trial_duration = trial.trial_duration || -1; // default is no max response time - trial.feedback_duration = trial.feedback_duration || 2000; - display_element.innerHTML = '
'+trial.stimulus+'
'; // hide image after time if the timing parameter is set diff --git a/plugins/jspsych-categorize-image.js b/plugins/jspsych-categorize-image.js index 217960b2..5f59f68d 100644 --- a/plugins/jspsych-categorize-image.js +++ b/plugins/jspsych-categorize-image.js @@ -43,13 +43,13 @@ jsPsych.plugins['categorize-image'] = (function() { }, correct_text: { type: jsPsych.plugins.parameterType.STRING, - default: 'Correct.', + default: "", no_function: false, description: '' }, incorrect_text: { type: jsPsych.plugins.parameterType.STRING, - default: 'Wrong.', + default: "", no_function: false, description: '' }, @@ -79,7 +79,7 @@ jsPsych.plugins['categorize-image'] = (function() { }, timeout_message: { type: jsPsych.plugins.parameterType.STRING, - default: 'Please respond faster.', + default: "

Please respond faster.

", no_function: false, description: '' }, @@ -106,21 +106,6 @@ jsPsych.plugins['categorize-image'] = (function() { plugin.trial = function(display_element, trial) { - // default parameters - trial.choices = trial.choices || jsPsych.ALL_KEYS; - trial.text_answer = (typeof trial.text_answer === 'undefined') ? "" : trial.text_answer; - trial.correct_text = (typeof trial.correct_text === 'undefined') ? "" : trial.correct_text; - trial.incorrect_text = (typeof trial.incorrect_text === 'undefined') ? "" : trial.incorrect_text; - trial.show_stim_with_feedback = (typeof trial.show_stim_with_feedback === 'undefined') ? true : trial.show_stim_with_feedback; - trial.force_correct_button_press = (typeof trial.force_correct_button_press === 'undefined') ? false : trial.force_correct_button_press; - trial.prompt = (typeof trial.prompt === 'undefined') ? '' : trial.prompt; - trial.show_feedback_on_timeout = (typeof trial.show_feedback_on_timeout === 'undefined') ? false : trial.show_feedback_on_timeout; - trial.timeout_message = trial.timeout_message || "

Please respond faster.

"; - // timing params - trial.stimulus_duration = trial.stimulus_duration || -1; // default is to show image until response - trial.trial_duration = trial.trial_duration || -1; // default is no max response time - trial.feedback_duration = trial.feedback_duration || 2000; - display_element.innerHTML = ''; // hide image after time if the timing parameter is set diff --git a/plugins/jspsych-external-html.js b/plugins/jspsych-external-html.js index 28c1c63f..fba43bcd 100644 --- a/plugins/jspsych-external-html.js +++ b/plugins/jspsych-external-html.js @@ -49,11 +49,6 @@ jsPsych.plugins['external-html'] = (function() { plugin.trial = function(display_element, trial) { - // default parameters - trial.check_fn = trial.check_fn || function() { return true; } - trial.force_refresh = (typeof trial.force_refresh === 'undefined') ? false : trial.force_refresh - - var url = trial.url; if (trial.force_refresh) { url = trial.url + "?time=" + (new Date().getTime()); diff --git a/plugins/jspsych-free-sort.js b/plugins/jspsych-free-sort.js index fa63c60c..1c18e0e6 100644 --- a/plugins/jspsych-free-sort.js +++ b/plugins/jspsych-free-sort.js @@ -72,15 +72,6 @@ jsPsych.plugins['free-sort'] = (function() { plugin.trial = function(display_element, trial) { - // default values - trial.stim_height = trial.stim_height || 100; - trial.stim_width = trial.stim_width || 100; - trial.prompt = (typeof trial.prompt === 'undefined') ? '' : trial.prompt; - trial.prompt_location = trial.prompt_location || "above"; - trial.sort_area_width = trial.sort_area_width || 800; - trial.sort_area_height = trial.sort_area_height || 800; - trial.button_label = typeof trial.button_label === 'undefined' ? 'Done' : trial.button_label; - var start_time = (new Date()).getTime(); var html = ""; diff --git a/plugins/jspsych-fullscreen.js b/plugins/jspsych-fullscreen.js index 28684f17..9665a9c3 100644 --- a/plugins/jspsych-fullscreen.js +++ b/plugins/jspsych-fullscreen.js @@ -46,11 +46,6 @@ jsPsych.plugins.fullscreen = (function() { plugin.trial = function(display_element, trial) { - trial.fullscreen_mode = typeof trial.fullscreen_mode === 'undefined' ? true : trial.fullscreen_mode; - trial.message = trial.message || '

The experiment will switch to full screen mode when you press the button below

'; - trial.button_label = trial.button_label || 'Go'; - trial.delay_after = trial.delay_after || 1000; - // check if keys are allowed in fullscreen mode var keyboardNotAllowed = typeof Element !== 'undefined' && 'ALLOW_KEYBOARD_INPUT' in Element; if (keyboardNotAllowed) { diff --git a/plugins/jspsych-html-button-response.js b/plugins/jspsych-html-button-response.js index 881cbef8..7ba272ab 100644 --- a/plugins/jspsych-html-button-response.js +++ b/plugins/jspsych-html-button-response.js @@ -42,6 +42,18 @@ jsPsych.plugins["html-button-response"] = (function() { no_function: false, description: '' }, + margin_vertical: { + type: jsPsych.plugins.parameterType.STRING, + default: '0px', + no_function: false, + description: '' + }, + margin_horizontal: { + type: jsPsych.plugins.parameterType.STRING, + default: '8px', + no_function: false, + description: '' + }, stimulus_duration: { type: jsPsych.plugins.parameterType.INT, default: -1, @@ -65,15 +77,6 @@ jsPsych.plugins["html-button-response"] = (function() { plugin.trial = function(display_element, trial) { - // default trial parameters - trial.button_html = trial.button_html || ''; - trial.response_ends_trial = (typeof trial.response_ends_trial === 'undefined') ? true : trial.response_ends_trial; - trial.stimulus_duration = trial.stimulus_duration || -1; // if -1, then show indefinitely - trial.trial_duration = trial.trial_duration || -1; // if -1, then wait for response forever - trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt; - trial.margin_vertical = trial.margin_vertical || "0px"; - trial.margin_horizontal = trial.margin_horizontal || "8px"; - // display stimulus display_element.innerHTML = '
'+trial.stimulus+'
'; diff --git a/plugins/jspsych-html-keyboard-response.js b/plugins/jspsych-html-keyboard-response.js index a0a5dcc1..5d987689 100644 --- a/plugins/jspsych-html-keyboard-response.js +++ b/plugins/jspsych-html-keyboard-response.js @@ -60,13 +60,6 @@ jsPsych.plugins["html-keyboard-response"] = (function() { plugin.trial = function(display_element, trial) { - // set default values for the parameters - trial.choices = trial.choices || jsPsych.ALL_KEYS; - trial.response_ends_trial = (typeof trial.response_ends_trial == 'undefined') ? true : trial.response_ends_trial; - trial.stimulus_duration = trial.stimulus_duration || -1; - trial.trial_duration = trial.trial_duration || -1; - trial.prompt = trial.prompt || ""; - var new_html = '
'+trial.stimulus+'
'; // add prompt diff --git a/plugins/jspsych-html-slider-response.js b/plugins/jspsych-html-slider-response.js index 45ee5236..65b543a9 100644 --- a/plugins/jspsych-html-slider-response.js +++ b/plugins/jspsych-html-slider-response.js @@ -43,7 +43,7 @@ jsPsych.plugins['html-slider-response'] = (function() { }, labels: { type: jsPsych.plugins.parameterType.KEYCODE, - default: [], + default: undefined, array: true, no_function: false, description: '' @@ -84,17 +84,6 @@ jsPsych.plugins['html-slider-response'] = (function() { plugin.trial = function(display_element, trial) { - trial.min = trial.min || 0; - trial.max = trial.max || 100; - trial.step = trial.step || 1; - trial.labels = trial.labels || []; - trial.button_label = typeof trial.button_label === 'undefined' ? 'Next' : trial.button_label; - trial.response_ends_trial = (typeof trial.response_ends_trial == 'undefined') ? true : trial.response_ends_trial; - trial.stimulus_duration = trial.stimulus_duration || -1; - trial.trial_duration = trial.trial_duration || -1; - trial.prompt = trial.prompt || ""; - - var html = '
'; html += '
' + trial.stimulus + '
'; html += '
'; diff --git a/plugins/jspsych-iat-html.js b/plugins/jspsych-iat-html.js index 1d6ea570..2ab79be6 100644 --- a/plugins/jspsych-iat-html.js +++ b/plugins/jspsych-iat-html.js @@ -104,21 +104,6 @@ plugin.trial = function(display_element, trial) { - // set default values for the parameters - trial.left_category_key = trial.left_category_key || 'E'; - trial.right_category_key = trial.right_category_key || 'I'; - trial.left_category_label = trial.left_category_label || ['left']; - trial.right_category_label = trial.right_category_label || ['right']; - trial.key_to_move_forward = trial.key_to_move_forward || jsPsych.ALL_KEYS; - trial.display_feedback = typeof trial.display_feedback == 'undefined' ? false : trial.display_feedback; - trial.html_when_wrong = trial.html_when_wrong || 'X'; - trial.bottom_instructions = trial.bottom_instructions || "

If you press the wrong key, a red X will appear. Press any key to continue.

"; - trial.force_correct_key_press = trial.force_correct_key_press || false; //If true, key_to_move_forward is no longer needed - 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.trial_duration = trial.trial_duration || -1; - trial.key_to_move_forward = trial.key_to_move_forward || jsPsych.ALL_KEYS; - var html_str = ""; html_str += "

" + trial.stimulus + "

"; diff --git a/plugins/jspsych-iat-image.js b/plugins/jspsych-iat-image.js index 66991a25..446d912e 100644 --- a/plugins/jspsych-iat-image.js +++ b/plugins/jspsych-iat-image.js @@ -106,21 +106,6 @@ plugin.trial = function(display_element, trial) { - // set default values for the parameters - trial.left_category_key = trial.left_category_key || 'E'; - trial.right_category_key = trial.right_category_key || 'I'; - trial.left_category_label = trial.left_category_label || ['left']; - trial.right_category_label = trial.right_category_label || ['right']; - trial.key_to_move_forward = trial.key_to_move_forward || jsPsych.ALL_KEYS; - trial.display_feedback = typeof trial.display_feedback == 'undefined' ? false : trial.display_feedback; - trial.html_when_wrong = trial.html_when_wrong || 'X'; - trial.bottom_instructions = trial.bottom_instructions || "

If you press the wrong key, a red X will appear. Press any key to continue.

"; - trial.force_correct_key_press = trial.force_correct_key_press || false; //If true, key_to_move_forward is no longer needed - 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.trial_duration = trial.trial_duration || -1; - trial.key_to_move_forward = trial.key_to_move_forward || jsPsych.ALL_KEYS; - var html_str = ""; html_str += "
"; diff --git a/plugins/jspsych-image-button-response.js b/plugins/jspsych-image-button-response.js index 1c4bd508..27b5db53 100644 --- a/plugins/jspsych-image-button-response.js +++ b/plugins/jspsych-image-button-response.js @@ -56,6 +56,18 @@ jsPsych.plugins["image-button-response"] = (function() { no_function: false, description: '' }, + margin_vertical: { + type: jsPsych.plugins.parameterType.STRING, + default: '0px', + no_function: false, + description: '' + }, + margin_horizontal: { + type: jsPsych.plugins.parameterType.STRING, + default: '8px', + no_function: false, + description: '' + }, response_ends_trial: { type: jsPsych.plugins.parameterType.BOOL, default: true, @@ -74,15 +86,6 @@ jsPsych.plugins["image-button-response"] = (function() { console.error('Required parameter "stimulus" missing in image-button-response'); } - // default trial parameters - trial.button_html = trial.button_html || ''; - trial.response_ends_trial = (typeof trial.response_ends_trial === 'undefined') ? true : trial.response_ends_trial; - trial.stimulus_duration = trial.stimulus_duration || -1; // if -1, then show indefinitely - trial.trial_duration = trial.trial_duration || -1; // if -1, then wait for response forever - trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt; - trial.margin_vertical = trial.margin_vertical || "0px"; - trial.margin_horizontal = trial.margin_horizontal || "8px"; - // display stimulus var html = ''; diff --git a/plugins/jspsych-image-slider-response.js b/plugins/jspsych-image-slider-response.js index 18bb1eb0..2182b4f2 100644 --- a/plugins/jspsych-image-slider-response.js +++ b/plugins/jspsych-image-slider-response.js @@ -86,17 +86,6 @@ jsPsych.plugins['image-slider-response'] = (function() { plugin.trial = function(display_element, trial) { - - trial.min = trial.min || 0; - trial.max = trial.max || 100; - trial.step = trial.step || 1; - trial.labels = trial.labels || []; - trial.button_label = typeof trial.button_label === 'undefined' ? 'Next' : trial.button_label; - trial.response_ends_trial = (typeof trial.response_ends_trial == 'undefined') ? true : trial.response_ends_trial; - trial.stimulus_duration = trial.stimulus_duration || -1; - trial.trial_duration = trial.trial_duration || -1; - trial.prompt = trial.prompt || ""; - var html = '
'; html += '
'; html += '
'; diff --git a/plugins/jspsych-instructions.js b/plugins/jspsych-instructions.js index 48b9e938..02044fd8 100644 --- a/plugins/jspsych-instructions.js +++ b/plugins/jspsych-instructions.js @@ -71,14 +71,6 @@ jsPsych.plugins.instructions = (function() { plugin.trial = function(display_element, trial) { - trial.key_forward = trial.key_forward || 'rightarrow'; - trial.key_backward = trial.key_backward || 'leftarrow'; - trial.allow_backward = (typeof trial.allow_backward === 'undefined') ? true : trial.allow_backward; - trial.allow_keys = (typeof trial.allow_keys === 'undefined') ? true : trial.allow_keys; - trial.show_clickable_nav = (typeof trial.show_clickable_nav === 'undefined') ? false : trial.show_clickable_nav; - trial.button_label_previous = (typeof trial.button_label_previous === 'undefined') ? 'Previous' : trial.button_label_previous; - trial.button_label_next = (typeof trial.button_label_next === 'undefined') ? 'Next' : trial.button_label_next; - var current_page = 0; var view_history = []; diff --git a/plugins/jspsych-reconstruction.js b/plugins/jspsych-reconstruction.js index f4403a70..91c23476 100644 --- a/plugins/jspsych-reconstruction.js +++ b/plugins/jspsych-reconstruction.js @@ -59,13 +59,6 @@ jsPsych.plugins['reconstruction'] = (function() { plugin.trial = function(display_element, trial) { - // default parameter values - trial.starting_value = (typeof trial.starting_value == 'undefined') ? 0.5 : trial.starting_value; - trial.step_size = trial.step_size || 0.05; - trial.key_increase = trial.key_increase || 'h'; - trial.key_decrease = trial.key_decrease || 'g'; - trial.button_label = typeof trial.button_label === 'undefined' ? 'Next' : trial.button_label; - // if any trial variables are functions // this evaluates the function and replaces // it with the output of the function diff --git a/plugins/jspsych-resize.js b/plugins/jspsych-resize.js index bda3d25b..bb88171c 100644 --- a/plugins/jspsych-resize.js +++ b/plugins/jspsych-resize.js @@ -57,14 +57,6 @@ jsPsych.plugins["resize"] = (function() { plugin.trial = function(display_element, trial) { - // default trial paramters - trial.item_height = trial.item_height || 1; - trial.item_width = trial.item_width || 1; - trial.prompt = trial.prompt || ' '; - trial.pixels_per_unit = trial.pixels_per_unit || 100; - trial.starting_size = trial.starting_size || 100; - trial.button_label = trial.button_label || "Done"; - var aspect_ratio = trial.item_width / trial.item_height; // variables to determine div size diff --git a/plugins/jspsych-same-different-html.js b/plugins/jspsych-same-different-html.js index b1cbaf14..7055fd17 100644 --- a/plugins/jspsych-same-different-html.js +++ b/plugins/jspsych-same-different-html.js @@ -71,15 +71,6 @@ jsPsych.plugins['same-different-image'] = (function() { plugin.trial = function(display_element, trial) { - // default parameters - trial.same_key = trial.same_key || 81; // default is 'q' - trial.different_key = trial.different_key || 80; // default is 'p' - trial.advance_key = trial.advance_key || jsPsych.ALL_KEYS - trial.first_stim_duration = trial.first_stim_duration || 1000; // if -1, the first stim is shown until any key is pressed - trial.second_stim_duration = trial.second_stim_duration || 1000; // if -1, then second stim is shown until response. - trial.gap_duration = trial.gap_duration || 500; - trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt; - display_element.innerHTML = '
'+trial.stimuli[0]+'
'; var first_stim_info; diff --git a/plugins/jspsych-same-different-image.js b/plugins/jspsych-same-different-image.js index f9567f32..09e10001 100644 --- a/plugins/jspsych-same-different-image.js +++ b/plugins/jspsych-same-different-image.js @@ -62,6 +62,13 @@ jsPsych.plugins['same-different-image'] = (function() { no_function: false, description: '' }, + advance_key: { + type: jsPsych.plugins.parameterType.KEYCODE, + array: true, + default: jsPsych.ALL_KEYS, + no_function: false, + description: '' + }, prompt: { type: jsPsych.plugins.parameterType.STRING, default: '', @@ -73,15 +80,6 @@ jsPsych.plugins['same-different-image'] = (function() { plugin.trial = function(display_element, trial) { - // default parameters - trial.same_key = trial.same_key || 81; // default is 'q' - trial.different_key = trial.different_key || 80; // default is 'p' - trial.advance_key = trial.advance_key || jsPsych.ALL_KEYS - trial.first_stim_duration = trial.first_stim_duration || 1000; // if -1, the first stim is shown until any key is pressed - trial.second_stim_duration = trial.second_stim_duration || 1000; // if -1, then second stim is shown until response. - trial.gap_duration = trial.gap_duration || 500; - trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt; - display_element.innerHTML = ''; var first_stim_info; diff --git a/plugins/jspsych-serial-reaction-time-mouse.js b/plugins/jspsych-serial-reaction-time-mouse.js index 858522b2..63d58f45 100644 --- a/plugins/jspsych-serial-reaction-time-mouse.js +++ b/plugins/jspsych-serial-reaction-time-mouse.js @@ -16,13 +16,6 @@ jsPsych.plugins["serial-reaction-time-mouse"] = (function() { name: 'serial-reaction-time-mouse', description: '', parameters: { - grid: { - type: jsPsych.plugins.parameterType.BOOL, - array: true, - default: [[1,1,1,1]], - no_function: false, - description: '' - }, target: { type: jsPsych.plugins.parameterType.INT, array: true, @@ -30,6 +23,13 @@ jsPsych.plugins["serial-reaction-time-mouse"] = (function() { no_function: false, description: '' }, + grid: { + type: jsPsych.plugins.parameterType.BOOL, + array: true, + default: [[1,1,1,1]], + no_function: false, + description: '' + }, grid_square_size: { type: jsPsych.plugins.parameterType.INT, default: 100, @@ -48,7 +48,7 @@ jsPsych.plugins["serial-reaction-time-mouse"] = (function() { no_function: false, description: '' }, - timing_pre_target: { + pre_target_duration: { type: jsPsych.plugins.parameterType.INT, default: 0, no_function: false, @@ -83,16 +83,6 @@ jsPsych.plugins["serial-reaction-time-mouse"] = (function() { plugin.trial = function(display_element, trial) { - trial.grid = trial.grid || [[1,1,1,1]]; - trial.grid_square_size = trial.grid_square_size || 100; - trial.target_color = trial.target_color || "#999"; - trial.response_ends_trial = (typeof trial.response_ends_trial === 'undefined') ? true : trial.response_ends_trial; - trial.pre_target_duration = (typeof trial.pre_target_duration === 'undefined') ? 0 : trial.pre_target_duration; - 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.allow_nontarget_responses = (typeof trial.allow_nontarget_responses === 'undefined') ? false : trial.allow_nontarget_responses; - trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt; - var startTime = -1; var response = { rt: -1, diff --git a/plugins/jspsych-serial-reaction-time.js b/plugins/jspsych-serial-reaction-time.js index b0332967..b831076a 100644 --- a/plugins/jspsych-serial-reaction-time.js +++ b/plugins/jspsych-serial-reaction-time.js @@ -55,7 +55,7 @@ jsPsych.plugins["serial-reaction-time"] = (function() { no_function: false, description: '' }, - timing_pre_target: { + pre_target_duration: { type: jsPsych.plugins.parameterType.INT, default: 0, no_function: false, @@ -96,18 +96,6 @@ jsPsych.plugins["serial-reaction-time"] = (function() { plugin.trial = function(display_element, trial) { - trial.grid = trial.grid || [[1,1,1,1]]; - trial.choices = trial.choices || [['3','5','7','9']]; - trial.grid_square_size = trial.grid_square_size || 100; - trial.target_color = trial.target_color || "#999"; - trial.response_ends_trial = (typeof trial.response_ends_trial === 'undefined') ? true : trial.response_ends_trial; - trial.pre_target_duration = (typeof trial.pre_target_duration === 'undefined') ? 0 : trial.pre_target_duration; - 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.feedback_duration = (typeof trial.feedback_duration === 'undefined') ? 200 : trial.feedback_duration; - trial.fade_duration = (typeof trial.fade_duration === 'undefined') ? -1 : trial.fade_duration; - trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt; - // create a flattened version of the choices array var flat_choices = jsPsych.utils.flatten(trial.choices); while(flat_choices.indexOf('') > -1){ diff --git a/plugins/jspsych-survey-likert.js b/plugins/jspsych-survey-likert.js index 5daa5223..36e206a1 100644 --- a/plugins/jspsych-survey-likert.js +++ b/plugins/jspsych-survey-likert.js @@ -30,6 +30,12 @@ jsPsych.plugins['survey-likert'] = (function() { no_function: false, description: '' }, + preamble: { + type: jsPsych.plugins.parameterType.STRING, + default: '', + no_function: false, + description: '' + }, required: { type: jsPsych.plugins.parameterType.BOOL, array: true, @@ -48,11 +54,6 @@ jsPsych.plugins['survey-likert'] = (function() { plugin.trial = function(display_element, trial) { - // default parameters for the trial - trial.preamble = typeof trial.preamble === 'undefined' ? "" : trial.preamble; - trial.required = typeof trial.required === 'undefined' ? false : trial.required; - trial.button_label = typeof trial.button_label === 'undefined' ? 'Next' : trial.button_label; - var html = ""; // inject CSS for trial diff --git a/plugins/jspsych-survey-multi-choice.js b/plugins/jspsych-survey-multi-choice.js index 871b7565..5e0a3e83 100644 --- a/plugins/jspsych-survey-multi-choice.js +++ b/plugins/jspsych-survey-multi-choice.js @@ -65,13 +65,6 @@ jsPsych.plugins['survey-multi-choice'] = (function() { return arr.join(separator = '-'); } - // trial defaults - trial.preamble = typeof trial.preamble == 'undefined' ? "" : trial.preamble; - trial.required = typeof trial.required == 'undefined' ? null : trial.required; - trial.horizontal = typeof trial.required == 'undefined' ? false : trial.horizontal; - //If button_label is empty, the browser's language will be used to determine the button label. - trial.button_label = typeof trial.button_label === 'undefined' ? '' : trial.button_label; - // inject CSS for trial display_element.innerHTML = ''; var cssstr = ".jspsych-survey-multi-choice-question { margin-top: 2em; margin-bottom: 2em; text-align: left; }"+ diff --git a/plugins/jspsych-survey-multi-select.js b/plugins/jspsych-survey-multi-select.js index b4c78564..9dc591a8 100644 --- a/plugins/jspsych-survey-multi-select.js +++ b/plugins/jspsych-survey-multi-select.js @@ -63,14 +63,6 @@ jsPsych.plugins['survey-multi-select'] = (function() { return arr.join(separator = '-'); } - // trial defaults - trial.preamble = typeof trial.preamble == 'undefined' ? "" : trial.preamble; - trial.required = typeof trial.required == 'undefined' ? false : trial.required; - trial.required_msg = trial.required_msg || '*please select at least one option!'; - trial.horizontal = typeof trial.horizontal == 'undefined' ? false : trial.horizontal; - //If button_label is empty, the browser's language will be used to determine the button label. - trial.button_label = typeof trial.button_label === 'undefined' ? '' : trial.button_label; - // inject CSS for trial display_element.innerHTML = ''; diff --git a/plugins/jspsych-survey-text.js b/plugins/jspsych-survey-text.js index a1b3be7b..ed378f83 100644 --- a/plugins/jspsych-survey-text.js +++ b/plugins/jspsych-survey-text.js @@ -62,8 +62,6 @@ jsPsych.plugins['survey-text'] = (function() { plugin.trial = function(display_element, trial) { - trial.preamble = typeof trial.preamble == 'undefined' ? "" : trial.preamble; - trial.button_label = typeof trial.button_label === 'undefined' ? 'Next' : trial.button_label; if (typeof trial.rows == 'undefined') { trial.rows = []; diff --git a/plugins/jspsych-video.js b/plugins/jspsych-video.js index 9386224f..b2bac420 100644 --- a/plugins/jspsych-video.js +++ b/plugins/jspsych-video.js @@ -70,11 +70,6 @@ jsPsych.plugins.video = (function() { plugin.trial = function(display_element, trial) { - // set default values for the parameters - trial.prompt = trial.prompt || ""; - trial.autoplay = typeof trial.autoplay == 'undefined' ? true : trial.autoplay; - trial.controls = typeof trial.controls == 'undefined' ? false : trial.controls; - // display stimulus var video_html = '