diff --git a/contributors.md b/contributors.md index 2822d2e6..6f41fbc2 100644 --- a/contributors.md +++ b/contributors.md @@ -8,6 +8,7 @@ The following people have contributed to the development of jsPsych by writing c * Gustavo Juantorena - https://github.com/GEJ1 * Chris Jungerius - https://github.com/cjungerius * Jana Klaus - https://github.com/janakl4us +* Peter Jes Kohler - https://github.com/pjkohler * Jonas Lambers * Shane Martin - https://github.com/shamrt * Adrian Oesch - https://github.com/adrianoesch diff --git a/docs/plugins/jspsych-free-sort.md b/docs/plugins/jspsych-free-sort.md index 3c6e119c..1d9ba5bb 100644 --- a/docs/plugins/jspsych-free-sort.md +++ b/docs/plugins/jspsych-free-sort.md @@ -15,13 +15,14 @@ Parameter | Type | Default Value | Description stimuli | array | *undefined* | Each element of this array is an image path. stim_height | numeric | 100 | The height of the images in pixels. stim_width | numeric | 100 | The width of the images in pixels. +scale_factor | numeric | 1.5 | How much larger to make the stimulus while moving (1 = no scaling). sort_area_height | numeric | 800 | The height of the container that subjects can move the stimuli in. Stimuli will be constrained to this area. sort_area_width | numeric | 800 | The width of the container that subjects can move the stimuli in. Stimuli will be constrained to this area. +sort_area_shape | string | "ellipse" | The shape of the sorting area, can be "ellipse" or "square". prompt | string | null | This string can contain HTML markup. The intention is that it can be used to provide a reminder about the action the subject is supposed to take (e.g., which key to press). prompt_location | string | "above" | Indicates whether to show the prompt `"above"` or `"below"` the sorting area. button_label | string | 'Continue' | The text that appears on the button to continue to the next trial. - ## Data Generated In addition to the [default data collected by all plugins](overview#data-collected-by-plugins), this plugin collects the following data for each trial. diff --git a/examples/jspsych-free-sort.html b/examples/jspsych-free-sort.html index 79dd0448..387c0992 100644 --- a/examples/jspsych-free-sort.html +++ b/examples/jspsych-free-sort.html @@ -10,7 +10,12 @@ var trials = { type: 'free-sort', - stimuli: ['img/happy_face_1.jpg','img/happy_face_2.jpg','img/happy_face_3.jpg','img/happy_face_4.jpg'] + stimuli: ['img/happy_face_1.jpg','img/happy_face_2.jpg','img/happy_face_3.jpg','img/happy_face_4.jpg'], + stim_height: 150, + stim_width: 200, + scale_factor: 1.3, + sort_area_shape: "ellipse", + prompt_location: "below" }; diff --git a/plugins/jspsych-free-sort.js b/plugins/jspsych-free-sort.js index e498d7e3..80ff49d8 100644 --- a/plugins/jspsych-free-sort.js +++ b/plugins/jspsych-free-sort.js @@ -22,19 +22,25 @@ jsPsych.plugins['free-sort'] = (function() { pretty_name: 'Stimuli', default: undefined, array: true, - description: 'Images to be displayed.' + description: 'items to be displayed.' }, stim_height: { type: jsPsych.plugins.parameterType.INT, pretty_name: 'Stimulus height', default: 100, - description: 'Height of images in pixels.' + description: 'Height of items in pixels.' }, stim_width: { type: jsPsych.plugins.parameterType.INT, pretty_name: 'Stimulus width', default: 100, - description: 'Width of images in pixels' + description: 'Width of items in pixels' + }, + scale_factor: { + type: jsPsych.plugins.parameterType.FLOAT, + pretty_name: 'Stimulus scaling factor', + default: 1.5, + description: 'How much larger to make the stimulus while moving (1 = no scaling)' }, sort_area_height: { type: jsPsych.plugins.parameterType.INT, @@ -48,10 +54,17 @@ jsPsych.plugins['free-sort'] = (function() { default: 800, description: 'The width of the container that subjects can move the stimuli in.' }, + sort_area_shape: { + type: jsPsych.plugins.parameterType.STRING, + pretty_name: 'Sort area shape', + options: ['square','ellipse'], + default: 'ellipse', + description: 'The shape of the sorting area' + }, prompt: { type: jsPsych.plugins.parameterType.STRING, pretty_name: 'Prompt', - default: null, + default: '', description: 'It can be used to provide a reminder about the action the subject is supposed to take.' }, prompt_location: { @@ -64,7 +77,7 @@ jsPsych.plugins['free-sort'] = (function() { button_label: { type: jsPsych.plugins.parameterType.STRING, pretty_name: 'Button label', - default: 'Continue', + default: 'continue', description: 'The text that appears on the button to continue to the next trial.' } } @@ -74,36 +87,96 @@ jsPsych.plugins['free-sort'] = (function() { var start_time = performance.now(); - var html = ""; - // check if there is a prompt and if it is shown above - if (trial.prompt !== null && trial.prompt_location == "above") { - html += trial.prompt; - } - - html += '
'; + 'style="position: relative; width:'+trial.sort_area_width+'px; height:'+trial.sort_area_height+'px; margin: auto; line-height: 0em"'; - // check if prompt exists and if it is shown below - if (trial.prompt !== null && trial.prompt_location == "below") { - html += trial.prompt; + // another div for border + html += '' + } else { + html += 'webkit-border-radius: 0%; moz-border-radius: 0%; border-radius: 0%">' } + if ( trial.prompt ) { + trial.prompt = 'You still need to place ' + trial.stimuli.length + ' items inside the arena.
'+ + '