diff --git a/README.md b/README.md index f67108acd3..c5d33ef7e0 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Citations help us demonstrate that this library is used and valued, which allows ## Contributors jsPsych is open source project with [numerous contributors](https://github.com/jspsych/jsPsych/graphs/contributors). -The project is currently managed by the core team of Josh de Leeuw ([@jodeleeuw](https://github.com/jodeleeuw)), Becky Gilbert ([@becky-gilbert](https://github.com/becky-gilbert)), and Björn Luchterhandt ([@bjoluc](https://github.com/bjoluc)). +The project is currently managed by the core team of Josh de Leeuw ([@jodeleeuw](https://github.com/jodeleeuw)), Becky Gilbert ([@becky-gilbert](https://github.com/becky-gilbert)), Björn Luchterhandt ([@bjoluc](https://github.com/bjoluc)), and Jade ([@jadedelta](https://github.com/jadedelta)). jsPsych was created by [Josh de Leeuw](https://www.vassar.edu/faculty/jdeleeuw). diff --git a/docs/demos/eye-tracking-with-webgazer.html b/docs/demos/eye-tracking-with-webgazer.html index 515a13a970..6d1512e137 100644 --- a/docs/demos/eye-tracking-with-webgazer.html +++ b/docs/demos/eye-tracking-with-webgazer.html @@ -1,9 +1,9 @@ - + - + @@ -13,7 +13,7 @@ diff --git a/docs/demos/jspsych-animation-demo.html b/docs/demos/jspsych-animation-demo.html index 5e16dd6c44..a51b7c3482 100644 --- a/docs/demos/jspsych-animation-demo.html +++ b/docs/demos/jspsych-animation-demo.html @@ -2,11 +2,11 @@ - + - - + + diff --git a/docs/demos/jspsych-html-audio-response-demo2.html b/docs/demos/jspsych-html-audio-response-demo2.html index 3884b3c270..987352a8ed 100644 --- a/docs/demos/jspsych-html-audio-response-demo2.html +++ b/docs/demos/jspsych-html-audio-response-demo2.html @@ -1,11 +1,11 @@ - - + + - + diff --git a/docs/demos/jspsych-html-audio-response-demo3.html b/docs/demos/jspsych-html-audio-response-demo3.html index da14af60a8..506b2f90e7 100644 --- a/docs/demos/jspsych-html-audio-response-demo3.html +++ b/docs/demos/jspsych-html-audio-response-demo3.html @@ -1,12 +1,12 @@ - - + + - + - + diff --git a/docs/demos/jspsych-html-button-response-demo1.html b/docs/demos/jspsych-html-button-response-demo1.html index 89b4990fde..48b6abbee8 100644 --- a/docs/demos/jspsych-html-button-response-demo1.html +++ b/docs/demos/jspsych-html-button-response-demo1.html @@ -2,9 +2,9 @@ - - - + + + diff --git a/docs/demos/jspsych-html-button-response-demo2.html b/docs/demos/jspsych-html-button-response-demo2.html index c4c38c694f..b0917200a7 100644 --- a/docs/demos/jspsych-html-button-response-demo2.html +++ b/docs/demos/jspsych-html-button-response-demo2.html @@ -2,9 +2,9 @@ - - - + + + diff --git a/docs/demos/jspsych-html-keyboard-response-demo1.html b/docs/demos/jspsych-html-keyboard-response-demo1.html index b91bf9ed48..64747de788 100644 --- a/docs/demos/jspsych-html-keyboard-response-demo1.html +++ b/docs/demos/jspsych-html-keyboard-response-demo1.html @@ -2,10 +2,10 @@ - + - - + + diff --git a/docs/demos/jspsych-html-keyboard-response-demo2.html b/docs/demos/jspsych-html-keyboard-response-demo2.html index 92c8353da4..f83b72bc91 100644 --- a/docs/demos/jspsych-html-keyboard-response-demo2.html +++ b/docs/demos/jspsych-html-keyboard-response-demo2.html @@ -2,10 +2,10 @@ - + - - + + diff --git a/docs/demos/jspsych-html-slider-response-demo1.html b/docs/demos/jspsych-html-slider-response-demo1.html index faf949ff4d..3d689e567f 100644 --- a/docs/demos/jspsych-html-slider-response-demo1.html +++ b/docs/demos/jspsych-html-slider-response-demo1.html @@ -2,10 +2,10 @@ - + - - + + diff --git a/docs/demos/jspsych-html-video-response-demo1.html b/docs/demos/jspsych-html-video-response-demo1.html index 96df845e35..25b4d6af32 100644 --- a/docs/demos/jspsych-html-video-response-demo1.html +++ b/docs/demos/jspsych-html-video-response-demo1.html @@ -2,14 +2,14 @@ - + - + - + diff --git a/docs/demos/jspsych-html-video-response-demo2.html b/docs/demos/jspsych-html-video-response-demo2.html index f9f2988f19..a69b691cf2 100644 --- a/docs/demos/jspsych-html-video-response-demo2.html +++ b/docs/demos/jspsych-html-video-response-demo2.html @@ -2,14 +2,14 @@ - + - + - + diff --git a/docs/demos/jspsych-html-video-response-demo3.html b/docs/demos/jspsych-html-video-response-demo3.html index 876a7ca932..1780eb77a9 100644 --- a/docs/demos/jspsych-html-video-response-demo3.html +++ b/docs/demos/jspsych-html-video-response-demo3.html @@ -2,15 +2,15 @@ - + - + - + diff --git a/docs/demos/jspsych-iat-html-demo1.html b/docs/demos/jspsych-iat-html-demo1.html index 2cc6dae048..61d14aae14 100644 --- a/docs/demos/jspsych-iat-html-demo1.html +++ b/docs/demos/jspsych-iat-html-demo1.html @@ -2,10 +2,10 @@ - - + + - + diff --git a/docs/demos/jspsych-iat-image-demo1.html b/docs/demos/jspsych-iat-image-demo1.html index 8592edac25..b3d088157d 100644 --- a/docs/demos/jspsych-iat-image-demo1.html +++ b/docs/demos/jspsych-iat-image-demo1.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-image-button-response-demo1.html b/docs/demos/jspsych-image-button-response-demo1.html index a4f0b1c1eb..7656ee248c 100644 --- a/docs/demos/jspsych-image-button-response-demo1.html +++ b/docs/demos/jspsych-image-button-response-demo1.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-image-keyboard-response-demo1.html b/docs/demos/jspsych-image-keyboard-response-demo1.html index 289ea0468e..632e29bfe0 100644 --- a/docs/demos/jspsych-image-keyboard-response-demo1.html +++ b/docs/demos/jspsych-image-keyboard-response-demo1.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-image-keyboard-response-demo2.html b/docs/demos/jspsych-image-keyboard-response-demo2.html index 5c9d48862f..103df35e1c 100644 --- a/docs/demos/jspsych-image-keyboard-response-demo2.html +++ b/docs/demos/jspsych-image-keyboard-response-demo2.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-image-slider-response-demo1.html b/docs/demos/jspsych-image-slider-response-demo1.html index e9e73cf369..7081d33d8a 100644 --- a/docs/demos/jspsych-image-slider-response-demo1.html +++ b/docs/demos/jspsych-image-slider-response-demo1.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-initialize-camera-demo1.html b/docs/demos/jspsych-initialize-camera-demo1.html index 658344337c..cdba130dbf 100644 --- a/docs/demos/jspsych-initialize-camera-demo1.html +++ b/docs/demos/jspsych-initialize-camera-demo1.html @@ -1,10 +1,10 @@ - - + + - + diff --git a/docs/demos/jspsych-initialize-microphone-demo1.html b/docs/demos/jspsych-initialize-microphone-demo1.html index 497aa74706..f83444f0eb 100644 --- a/docs/demos/jspsych-initialize-microphone-demo1.html +++ b/docs/demos/jspsych-initialize-microphone-demo1.html @@ -1,10 +1,10 @@ - - + + - + diff --git a/docs/demos/jspsych-instructions-demo-1.html b/docs/demos/jspsych-instructions-demo-1.html index e52105920f..69c88f3e05 100644 --- a/docs/demos/jspsych-instructions-demo-1.html +++ b/docs/demos/jspsych-instructions-demo-1.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-instructions-demo-2.html b/docs/demos/jspsych-instructions-demo-2.html index 040558c633..44c0038832 100644 --- a/docs/demos/jspsych-instructions-demo-2.html +++ b/docs/demos/jspsych-instructions-demo-2.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-instructions-demo-3.html b/docs/demos/jspsych-instructions-demo-3.html index 77de2448fc..b65c06bf85 100644 --- a/docs/demos/jspsych-instructions-demo-3.html +++ b/docs/demos/jspsych-instructions-demo-3.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-maxdiff-demo1.html b/docs/demos/jspsych-maxdiff-demo1.html index c5e5d17b47..cec3ed7a27 100644 --- a/docs/demos/jspsych-maxdiff-demo1.html +++ b/docs/demos/jspsych-maxdiff-demo1.html @@ -2,10 +2,10 @@ - - + + - + diff --git a/docs/demos/jspsych-mirror-camera-demo1.html b/docs/demos/jspsych-mirror-camera-demo1.html index a1a874654c..2dace6552c 100644 --- a/docs/demos/jspsych-mirror-camera-demo1.html +++ b/docs/demos/jspsych-mirror-camera-demo1.html @@ -3,13 +3,13 @@ - - + + - + diff --git a/docs/demos/jspsych-preload-demo1.html b/docs/demos/jspsych-preload-demo1.html index 5ddd99b635..d593c37754 100644 --- a/docs/demos/jspsych-preload-demo1.html +++ b/docs/demos/jspsych-preload-demo1.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-preload-demo2.html b/docs/demos/jspsych-preload-demo2.html index 96b4885f96..531d998352 100644 --- a/docs/demos/jspsych-preload-demo2.html +++ b/docs/demos/jspsych-preload-demo2.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-preload-demo3.html b/docs/demos/jspsych-preload-demo3.html index 52160bec92..b86aa27f7a 100644 --- a/docs/demos/jspsych-preload-demo3.html +++ b/docs/demos/jspsych-preload-demo3.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-preload-demo4.html b/docs/demos/jspsych-preload-demo4.html index 9ecae1e3e0..afe36d1376 100644 --- a/docs/demos/jspsych-preload-demo4.html +++ b/docs/demos/jspsych-preload-demo4.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-reconstruction-demo1.html b/docs/demos/jspsych-reconstruction-demo1.html index 88c2f1c1f3..510364d9e1 100644 --- a/docs/demos/jspsych-reconstruction-demo1.html +++ b/docs/demos/jspsych-reconstruction-demo1.html @@ -2,11 +2,11 @@ - - + + - + diff --git a/docs/demos/jspsych-resize-demo1.html b/docs/demos/jspsych-resize-demo1.html index e6a82553e4..88c33718ca 100644 --- a/docs/demos/jspsych-resize-demo1.html +++ b/docs/demos/jspsych-resize-demo1.html @@ -2,10 +2,10 @@ - - + + - + diff --git a/docs/demos/jspsych-same-different-html-demo1.html b/docs/demos/jspsych-same-different-html-demo1.html index 9efcf4b6ba..75d61d3e8e 100644 --- a/docs/demos/jspsych-same-different-html-demo1.html +++ b/docs/demos/jspsych-same-different-html-demo1.html @@ -2,10 +2,10 @@ - - + + - + diff --git a/docs/demos/jspsych-same-different-image-demo1.html b/docs/demos/jspsych-same-different-image-demo1.html index 76e7e43caf..b5ba019e3a 100644 --- a/docs/demos/jspsych-same-different-image-demo1.html +++ b/docs/demos/jspsych-same-different-image-demo1.html @@ -2,11 +2,11 @@ - + - + - + diff --git a/docs/demos/jspsych-serial-reaction-time-demo1.html b/docs/demos/jspsych-serial-reaction-time-demo1.html index 8eaf2b4158..f1e3ebbc08 100644 --- a/docs/demos/jspsych-serial-reaction-time-demo1.html +++ b/docs/demos/jspsych-serial-reaction-time-demo1.html @@ -2,10 +2,10 @@ - - + + - + diff --git a/docs/demos/jspsych-serial-reaction-time-demo2.html b/docs/demos/jspsych-serial-reaction-time-demo2.html index e5bd920a72..7b14743239 100644 --- a/docs/demos/jspsych-serial-reaction-time-demo2.html +++ b/docs/demos/jspsych-serial-reaction-time-demo2.html @@ -2,10 +2,10 @@ - - + + - + diff --git a/docs/demos/jspsych-serial-reaction-time-mouse-demo1.html b/docs/demos/jspsych-serial-reaction-time-mouse-demo1.html index 163e1dd7c2..10b7990630 100644 --- a/docs/demos/jspsych-serial-reaction-time-mouse-demo1.html +++ b/docs/demos/jspsych-serial-reaction-time-mouse-demo1.html @@ -2,10 +2,10 @@ - - + + - + diff --git a/docs/demos/jspsych-serial-reaction-time-mouse-demo2.html b/docs/demos/jspsych-serial-reaction-time-mouse-demo2.html index 5c49414a05..a458ea7c3c 100644 --- a/docs/demos/jspsych-serial-reaction-time-mouse-demo2.html +++ b/docs/demos/jspsych-serial-reaction-time-mouse-demo2.html @@ -2,10 +2,10 @@ - - + + - + diff --git a/docs/demos/jspsych-sketchpad-demo1.html b/docs/demos/jspsych-sketchpad-demo1.html index c1315fd8e6..6b991757d6 100644 --- a/docs/demos/jspsych-sketchpad-demo1.html +++ b/docs/demos/jspsych-sketchpad-demo1.html @@ -2,10 +2,10 @@ - - + + - + diff --git a/docs/demos/jspsych-sketchpad-demo2.html b/docs/demos/jspsych-sketchpad-demo2.html index 69b211f56f..e1a30071aa 100644 --- a/docs/demos/jspsych-sketchpad-demo2.html +++ b/docs/demos/jspsych-sketchpad-demo2.html @@ -2,10 +2,10 @@ - - + + - + diff --git a/docs/demos/jspsych-sketchpad-demo3.html b/docs/demos/jspsych-sketchpad-demo3.html index 765bf45270..fece0d38fd 100644 --- a/docs/demos/jspsych-sketchpad-demo3.html +++ b/docs/demos/jspsych-sketchpad-demo3.html @@ -2,11 +2,11 @@ - - + + - - + + diff --git a/docs/demos/jspsych-survey-demo1.html b/docs/demos/jspsych-survey-demo1.html index 9bc0134deb..19ec2d3498 100644 --- a/docs/demos/jspsych-survey-demo1.html +++ b/docs/demos/jspsych-survey-demo1.html @@ -2,11 +2,11 @@ - - - - - + + + + + diff --git a/docs/demos/jspsych-survey-demo2.html b/docs/demos/jspsych-survey-demo2.html index 3d6ef8a026..4cb6ba64e5 100644 --- a/docs/demos/jspsych-survey-demo2.html +++ b/docs/demos/jspsych-survey-demo2.html @@ -3,11 +3,11 @@ - - - - - + + + + + diff --git a/docs/demos/jspsych-survey-demo3.html b/docs/demos/jspsych-survey-demo3.html index 17826476cb..75b84eb422 100644 --- a/docs/demos/jspsych-survey-demo3.html +++ b/docs/demos/jspsych-survey-demo3.html @@ -3,11 +3,11 @@ - - - - - + + + + + diff --git a/docs/demos/jspsych-survey-demo4.html b/docs/demos/jspsych-survey-demo4.html index 5d42511935..5acfbdc8d4 100644 --- a/docs/demos/jspsych-survey-demo4.html +++ b/docs/demos/jspsych-survey-demo4.html @@ -3,11 +3,11 @@ - - - - - + + + + + diff --git a/docs/demos/jspsych-survey-demo5.html b/docs/demos/jspsych-survey-demo5.html index 7f305bdcf9..560c52d400 100644 --- a/docs/demos/jspsych-survey-demo5.html +++ b/docs/demos/jspsych-survey-demo5.html @@ -3,11 +3,11 @@ - - - - - + + + + + diff --git a/docs/demos/jspsych-survey-demo6.html b/docs/demos/jspsych-survey-demo6.html index d60f65d989..669a7d0718 100644 --- a/docs/demos/jspsych-survey-demo6.html +++ b/docs/demos/jspsych-survey-demo6.html @@ -4,11 +4,11 @@ - - - - - + + + + + @@ -176,9 +176,9 @@ In the example below, the CSS selector `.left-align #stimulus` selects the eleme ```html - + - + "; + html += ` + `; // show preamble text if (trial.preamble !== null) { - html += - '
' + - trial.preamble + - "
"; + html += `
${trial.preamble}
`; } // form element if (trial.autocomplete) { - html += '
'; + html += ``; } else { - html += ''; + html += ``; } + // generate question order. this is randomized here as opposed to randomizing the order of trial.questions // so that the data are always associated with the same question regardless of order var question_order = []; @@ -169,22 +157,15 @@ class SurveyMultiChoicePlugin implements JsPsychPlugin { var question_id = question_order[i]; // create question container - var question_classes = ["jspsych-survey-multi-choice-question"]; + var question_classes = [`${plugin_id_name}-question`]; if (question.horizontal) { - question_classes.push("jspsych-survey-multi-choice-horizontal"); + question_classes.push(`${plugin_id_name}-horizontal`); } - html += - '
'; + html += `
`; // add question text - html += '

' + question.prompt; + html += `

${question.prompt}`; if (question.required) { html += "*"; } @@ -193,47 +174,35 @@ class SurveyMultiChoicePlugin implements JsPsychPlugin { // create option radio buttons for (var j = 0; j < question.options.length; j++) { // add label and question text - var option_id_name = "jspsych-survey-multi-choice-option-" + question_id + "-" + j; - var input_name = "jspsych-survey-multi-choice-response-" + question_id; - var input_id = "jspsych-survey-multi-choice-response-" + question_id + "-" + j; + var option_id_name = `${plugin_id_name}-option-${question_id}-${j}`; + var input_name = `${plugin_id_name}-response-${question_id}`; + var input_id = `${plugin_id_name}-response-${question_id}-${j}`; var required_attr = question.required ? "required" : ""; // add radio button container - html += '

'; - html += '"; - html += "
"; + html += ` +
+ +
`; } html += "
"; } // add submit button - html += - '"; + html += ``; html += ""; // render display_element.innerHTML = html; - document.querySelector("form").addEventListener("submit", (event) => { + const trial_form = display_element.querySelector(`#${trial_form_id}`); + + trial_form.addEventListener("submit", (event) => { event.preventDefault(); // measure response time var endTime = performance.now(); @@ -242,7 +211,7 @@ class SurveyMultiChoicePlugin implements JsPsychPlugin { // create object to hold responses var question_data = {}; for (var i = 0; i < trial.questions.length; i++) { - var match = display_element.querySelector("#jspsych-survey-multi-choice-" + i); + var match = display_element.querySelector(`#${plugin_id_name}-${i}`); var id = "Q" + i; var val: String; if (match.querySelector("input[type=radio]:checked") !== null) { @@ -330,7 +299,7 @@ class SurveyMultiChoicePlugin implements JsPsychPlugin { for (let i = 0; i < answers.length; i++) { this.jsPsych.pluginAPI.clickTarget( display_element.querySelector( - `#jspsych-survey-multi-choice-response-${i}-${trial.questions[i].options.indexOf( + `#${plugin_id_name}-response-${i}-${trial.questions[i].options.indexOf( answers[i][1] )}` ), @@ -339,7 +308,7 @@ class SurveyMultiChoicePlugin implements JsPsychPlugin { } this.jsPsych.pluginAPI.clickTarget( - display_element.querySelector("#jspsych-survey-multi-choice-next"), + display_element.querySelector(`#${plugin_id_name}-next`), data.rt ); } diff --git a/packages/plugin-survey-multi-select/CHANGELOG.md b/packages/plugin-survey-multi-select/CHANGELOG.md index 97d8293d66..10e04b7104 100644 --- a/packages/plugin-survey-multi-select/CHANGELOG.md +++ b/packages/plugin-survey-multi-select/CHANGELOG.md @@ -1,5 +1,11 @@ # @jspsych/plugin-survey-multi-select +## 2.0.1 + +### Patch Changes + +- [#3451](https://github.com/jspsych/jsPsych/pull/3451) [`7ffc644d`](https://github.com/jspsych/jsPsych/commit/7ffc644d0469cb5625efc5f1bb043d3aee22c501) Thanks [@jadeddelta](https://github.com/jadeddelta)! - fix `response` data type to be just `ParameterType.OBJECT` + ## 2.0.0 ### Major Changes diff --git a/packages/plugin-survey-multi-select/package.json b/packages/plugin-survey-multi-select/package.json index e0d7d573ee..42435384eb 100644 --- a/packages/plugin-survey-multi-select/package.json +++ b/packages/plugin-survey-multi-select/package.json @@ -1,6 +1,6 @@ { "name": "@jspsych/plugin-survey-multi-select", - "version": "2.0.0", + "version": "2.0.1", "description": "a jspsych plugin for multiple choice survey questions", "type": "module", "main": "dist/index.cjs", @@ -37,7 +37,7 @@ "jspsych": ">=7.1.0" }, "devDependencies": { - "@jspsych/config": "^3.0.0", + "@jspsych/config": "^3.1.1", "@jspsych/test-utils": "^1.2.0" } } diff --git a/packages/plugin-survey-multi-select/src/index.ts b/packages/plugin-survey-multi-select/src/index.ts index b327543cbe..17461b8a1c 100644 --- a/packages/plugin-survey-multi-select/src/index.ts +++ b/packages/plugin-survey-multi-select/src/index.ts @@ -85,20 +85,7 @@ const info = { data: { /** An object containing the response for each question. The object will have a separate key (variable) for each question, with the first question in the trial being recorded in `Q0`, the second in `Q1`, and so on. The responses are recorded as integers, representing the position selected on the likert scale for that question. If the `name` parameter is defined for the question, then the response object will use the value of `name` as the key for each question. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */ response: { - type: ParameterType.COMPLEX, - nested: { - identifier: { - type: ParameterType.STRING, - }, - response: { - type: - ParameterType.STRING | - ParameterType.INT | - ParameterType.FLOAT | - ParameterType.BOOL | - ParameterType.OBJECT, - }, - }, + type: ParameterType.OBJECT, }, /** The response time in milliseconds for the participant to make a response. The time is measured from when the questions first appear on the screen until the participant's response(s) are submitted. */ rt: { diff --git a/packages/plugin-survey-text/CHANGELOG.md b/packages/plugin-survey-text/CHANGELOG.md index a01be0cf4e..0dc6c4d08b 100644 --- a/packages/plugin-survey-text/CHANGELOG.md +++ b/packages/plugin-survey-text/CHANGELOG.md @@ -1,5 +1,11 @@ # @jspsych/plugin-survey-text +## 2.0.1 + +### Patch Changes + +- [#3451](https://github.com/jspsych/jsPsych/pull/3451) [`7ffc644d`](https://github.com/jspsych/jsPsych/commit/7ffc644d0469cb5625efc5f1bb043d3aee22c501) Thanks [@jadeddelta](https://github.com/jadeddelta)! - fix `response` data type to be just `ParameterType.OBJECT` + ## 2.0.0 ### Major Changes diff --git a/packages/plugin-survey-text/package.json b/packages/plugin-survey-text/package.json index a2c41d2e33..fca7f1a389 100644 --- a/packages/plugin-survey-text/package.json +++ b/packages/plugin-survey-text/package.json @@ -1,6 +1,6 @@ { "name": "@jspsych/plugin-survey-text", - "version": "2.0.0", + "version": "2.0.1", "description": "a jspsych plugin for free response survey questions", "type": "module", "main": "dist/index.cjs", @@ -37,7 +37,7 @@ "jspsych": ">=7.1.0" }, "devDependencies": { - "@jspsych/config": "^3.0.0", + "@jspsych/config": "^3.1.1", "@jspsych/test-utils": "^1.2.0" } } diff --git a/packages/plugin-survey-text/src/index.ts b/packages/plugin-survey-text/src/index.ts index 112dd0945e..997c82d27b 100644 --- a/packages/plugin-survey-text/src/index.ts +++ b/packages/plugin-survey-text/src/index.ts @@ -83,20 +83,7 @@ const info = { data: { /** An object containing the response for each question. The object will have a separate key (variable) for each question, with the first question in the trial being recorded in `Q0`, the second in `Q1`, and so on. The responses are recorded as integers, representing the position selected on the likert scale for that question. If the `name` parameter is defined for the question, then the response object will use the value of `name` as the key for each question. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */ response: { - type: ParameterType.COMPLEX, - nested: { - identifier: { - type: ParameterType.STRING, - }, - response: { - type: - ParameterType.STRING | - ParameterType.INT | - ParameterType.FLOAT | - ParameterType.BOOL | - ParameterType.OBJECT, - }, - }, + type: ParameterType.OBJECT, }, /** The response time in milliseconds for the participant to make a response. The time is measured from when the questions first appear on the screen until the participant's response(s) are submitted. */ rt: { diff --git a/packages/plugin-survey/CHANGELOG.md b/packages/plugin-survey/CHANGELOG.md index 56bc9f0aae..2052d78767 100644 --- a/packages/plugin-survey/CHANGELOG.md +++ b/packages/plugin-survey/CHANGELOG.md @@ -1,5 +1,11 @@ # @jspsych/plugin-survey +## 2.0.1 + +### Patch Changes + +- [#3451](https://github.com/jspsych/jsPsych/pull/3451) [`7ffc644d`](https://github.com/jspsych/jsPsych/commit/7ffc644d0469cb5625efc5f1bb043d3aee22c501) Thanks [@jadeddelta](https://github.com/jadeddelta)! - fix `response` data type to be just `ParameterType.OBJECT` + ## 2.0.0 ### Major Changes diff --git a/packages/plugin-survey/examples/combine_json_function.html b/packages/plugin-survey/examples/combine_json_function.html index 76046a558a..ae5964a904 100644 --- a/packages/plugin-survey/examples/combine_json_function.html +++ b/packages/plugin-survey/examples/combine_json_function.html @@ -5,7 +5,7 @@ - + diff --git a/packages/plugin-survey/package.json b/packages/plugin-survey/package.json index 217b93aac6..40d367424d 100644 --- a/packages/plugin-survey/package.json +++ b/packages/plugin-survey/package.json @@ -1,6 +1,6 @@ { "name": "@jspsych/plugin-survey", - "version": "2.0.0", + "version": "2.0.1", "description": "A jsPsych plugin for complex surveys", "type": "module", "main": "dist/index.cjs", @@ -44,7 +44,7 @@ "jspsych": ">=7.0.0" }, "devDependencies": { - "@jspsych/config": "^3.0.0", + "@jspsych/config": "^3.1.1", "@jspsych/test-utils": "^1.2.0", "npm-run-all": "^4.1.5", "sass": "^1.43.5" diff --git a/packages/plugin-survey/src/index.ts b/packages/plugin-survey/src/index.ts index 9b724ae6c7..c0aa6e92d3 100644 --- a/packages/plugin-survey/src/index.ts +++ b/packages/plugin-survey/src/index.ts @@ -46,20 +46,7 @@ const info = { data: { /** An object containing the response to each question. The object will have a separate key (identifier) for each question. If the `name` parameter is defined for the question (recommended), then the response object will use the value of `name` as the key for each question. If any questions do not have a name parameter, their keys will named automatically, with the first unnamed question recorded as `question1`, the second as `question2`, and so on. The response type will depend on the question type. This will be encoded as a JSON string when data is saved using the `.json()` or `.csv()` functions. */ response: { - type: ParameterType.COMPLEX, - nested: { - identifier: { - type: ParameterType.STRING, - }, - response: { - type: - ParameterType.STRING | - ParameterType.INT | - ParameterType.FLOAT | - ParameterType.BOOL | - ParameterType.OBJECT, - }, - }, + type: ParameterType.OBJECT, }, /** The response time in milliseconds for the participant to make a response. The time is measured from when the questions first appear on the screen until the participant's response(s) are submitted. */ rt: { diff --git a/packages/plugin-visual-search-circle/CHANGELOG.md b/packages/plugin-visual-search-circle/CHANGELOG.md index 725581ef91..1f90757929 100644 --- a/packages/plugin-visual-search-circle/CHANGELOG.md +++ b/packages/plugin-visual-search-circle/CHANGELOG.md @@ -1,5 +1,11 @@ # @jspsych/plugin-visual-search-circle +## 2.1.0 + +### Minor Changes + +- [#2897](https://github.com/jspsych/jsPsych/pull/2897) [`8759217f`](https://github.com/jspsych/jsPsych/commit/8759217f0ef0c1d127ca58440d1cbe5f152dbde5) Thanks [@jodeleeuw](https://github.com/jodeleeuw)! - Add options (`randomize_item_locations` and `location_first_item`) to allow for fixed locations of the item array across trials. + ## 2.0.0 ### Major Changes diff --git a/packages/plugin-visual-search-circle/package.json b/packages/plugin-visual-search-circle/package.json index 569e8bd0cd..0d0b14e8fe 100644 --- a/packages/plugin-visual-search-circle/package.json +++ b/packages/plugin-visual-search-circle/package.json @@ -1,6 +1,6 @@ { "name": "@jspsych/plugin-visual-search-circle", - "version": "2.0.0", + "version": "2.1.0", "description": "jsPsych visual search circle plugin", "type": "module", "main": "dist/index.cjs", @@ -37,7 +37,7 @@ "jspsych": ">=7.1.0" }, "devDependencies": { - "@jspsych/config": "^3.0.0", + "@jspsych/config": "^3.1.0", "@jspsych/test-utils": "^1.2.0" } } diff --git a/packages/plugin-visual-search-circle/src/index.ts b/packages/plugin-visual-search-circle/src/index.ts index 0024e8178b..09c06ea6b7 100644 --- a/packages/plugin-visual-search-circle/src/index.ts +++ b/packages/plugin-visual-search-circle/src/index.ts @@ -100,6 +100,21 @@ const info = { type: ParameterType.INT, default: 1000, }, + /** Whether to use randomized locations on the circle for the items. If `false`, then the first item will always show at the location specified by `location_first_item`. */ + randomize_item_locations: { + type: ParameterType.BOOL, + pretty_name: "Randomize item locations", + default: true, + }, + /** + * If `randomize_item_locations` is `false`, the location of the first item on the circle, in degrees. + * 0 degrees is above the fixation, and moving clockwise in the positive direction. + */ + location_first_item: { + type: ParameterType.INT, + pretty_name: "Location first item", + default: 0, + }, /** If true, the trial will end when the participant makes a response. */ response_ends_trial: { type: ParameterType.BOOL, @@ -140,7 +155,7 @@ type Info = typeof info; /** * This plugin presents a customizable visual-search task modelled after [Wang, Cavanagh, & Green (1994)](http://dx.doi.org/10.3758/BF03206946). * The participant indicates whether or not a target is present among a set of distractors. The stimuli are displayed in a circle, evenly-spaced, - * equidistant from a fixation point. Here is an example using normal and backward Ns: + * equidistant from a fixation point. * * @author Josh de Leeuw * @see {@link https://www.jspsych.org/latest/plugins/visual-search-circle/ visual-search-circle plugin documentation on jspsych.org} @@ -275,10 +290,6 @@ class VisualSearchCirclePlugin implements JsPsychPlugin { end_trial(); }, trial.trial_duration); } - - function clear_display() { - display_element.innerHTML = ""; - } }; } @@ -303,11 +314,13 @@ class VisualSearchCirclePlugin implements JsPsychPlugin { var hstimw = stimw / 2; var display_locs = []; - var random_offset = Math.floor(Math.random() * 360); + var offset = trial.randomize_item_locations + ? Math.floor(Math.random() * 360) + : trial.location_first_item - 180; // makes it so 0 is up, moving clockwise for (var i = 0; i < n_locs; i++) { display_locs.push([ - Math.floor(paper_size / 2 + this.cosd(random_offset + i * (360 / n_locs)) * radi - hstimw), - Math.floor(paper_size / 2 - this.sind(random_offset + i * (360 / n_locs)) * radi - hstimh), + Math.floor(paper_size / 2 + this.cosd(offset + i * (360 / n_locs)) * radi - hstimw), + Math.floor(paper_size / 2 - this.sind(offset + i * (360 / n_locs)) * radi - hstimh), ]); } return display_locs;