-
Notifications
You must be signed in to change notification settings - Fork 80
adding a new slider plugin #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 24 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
475d89f
feat: adding a new slider plugin
lakshmanvishnu 3368b2e
fix: updated lockfile after successful install
lakshmanvishnu f7b6a89
fix: debugged few failing tests
lakshmanvishnu dc82893
chore: filled in README
lakshmanvishnu 76eb205
chore: added docs
lakshmanvishnu eba8519
chore: added a citation file
lakshmanvishnu ec59de3
chore: rename plugin-slider to plugin-slide-to-continue
lakshmanvishnu 6268431
fix: minor fixes to the name, dependencies and comments
lakshmanvishnu f58ae43
chore: addded changeset log
lakshmanvishnu 4f86e1d
chore: version bump
lakshmanvishnu 7d82123
fix: remove animations parameter
lakshmanvishnu 2be6a58
feat: first major version bump
lakshmanvishnu 19d52d7
feat: chnagelog
lakshmanvishnu 8b57132
fix: change color parameter to accept colour name and hex color code
lakshmanvishnu e380bca
version bump
lakshmanvishnu 1dabe81
feat: added multi-line functionality and new text sizing parameter
lakshmanvishnu 2bd2a31
version bump
lakshmanvishnu dfd6ba3
fix: fixed styling of the progress bar
lakshmanvishnu 695408f
minor version bump for progress bar styling
lakshmanvishnu 05fb471
fix: smoothen out progress bar completion and commented parameters
lakshmanvishnu 4f3bdb0
patch version bump, imporving progres bar styling
lakshmanvishnu f3454f9
fix: fixing git test errors
lakshmanvishnu da8ebb4
fix: removing tests for deleted animation parameter
lakshmanvishnu 5a1cbb7
final name changes and changeset addition
lakshmanvishnu 847caef
fix: edits to docs and version bump
lakshmanvishnu 6a4a3bb
resolve merge conflict with upstream main
lakshmanvishnu d691d25
fix: Installing dependencies
lakshmanvishnu 486ea39
fix: fixing git checks
lakshmanvishnu 7ef2047
fix: fixing package build error
lakshmanvishnu 99c61bc
fix: rebuild packages-lock.json file
lakshmanvishnu 409dff0
fix: fix git build error
lakshmanvishnu 8cac3a6
fix: removing plugin package-lock.json
lakshmanvishnu 2ef46c6
fix: updating package-lock.json to fix test errors
lakshmanvishnu 4229b56
Merge branch 'main' into slider_plugin
lakshmanvishnu 5ae4260
fix: merging with main, updating package-lock
lakshmanvishnu a17fb38
fix: reinstalled package-lock.json file
lakshmanvishnu 9bfcd06
Delete package-lock.json.backup
jodeleeuw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@jspsych-contrib/plugin-slide-to-continue": major | ||
--- | ||
|
||
The plugin-slide-to-continue is a interactive slider interface similar to the 'slide to unlock' functionality found on mobile devices. User must drag a slider handle to start or complete the trial, making it useful for consent screens, engagement check, or trasition screens in experiments |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# @jspsych-contrib/plugin-slide-to-continue | ||
|
||
## 5.0.0 | ||
|
||
### Major Changes | ||
|
||
- First major version bump, includes a working version of the plugin (removed the animations parameter) | ||
|
||
### Minor Changes | ||
|
||
- Changed the progress bar styling so that it is more smooth and its dynamic motiong of following the leading shape is more consistent than before | ||
- Changed slider_text parameter to accomodate multi-line text with the use of commas and added a new parameter called text_size to adjust the size of the text in the slider_text parameter | ||
- Change to the color parameter - it now allows for either a color name or color hex code input and removed custom hex color codes | ||
- A change to the plugin name, dependancies and commented text | ||
|
||
### Patch Changes | ||
|
||
- Smoothened progress bar completion and added detail to parameter functions | ||
|
||
## 4.0.0 | ||
|
||
### Major Changes | ||
|
||
- First major version bump, includes a working version of the plugin (removed the animations parameter) | ||
|
||
### Minor Changes | ||
|
||
- Changed the progress bar styling so that it is more smooth and its dynamic motiong of following the leading shape is more consistent than before | ||
- Changed slider_text parameter to accomodate multi-line text with the use of commas and added a new parameter called text_size to adjust the size of the text in the slider_text parameter | ||
- Change to the color parameter - it now allows for either a color name or color hex code input and removed custom hex color codes | ||
- A change to the plugin name, dependancies and commented text | ||
|
||
## 3.0.0 | ||
|
||
### Major Changes | ||
|
||
- First major version bump, includes a working version of the plugin (removed the animations parameter) | ||
|
||
### Minor Changes | ||
|
||
- Changed slider_text parameter to accomodate multi-line text with the use of commas and added a new parameter called text_size to adjust the size of the text in the slider_text parameter | ||
- Change to the color parameter - it now allows for either a color name or color hex code input and removed custom hex color codes | ||
- A change to the plugin name, dependancies and commented text | ||
|
||
## 2.0.0 | ||
|
||
### Major Changes | ||
|
||
- First major version bump, includes a working version of the plugin (removed the animations parameter) | ||
|
||
### Minor Changes | ||
|
||
- Change to the color parameter - it now allows for either a color name or color hex code input and removed custom hex color codes | ||
- A change to the plugin name, dependancies and commented text | ||
|
||
## 1.0.0 | ||
|
||
### Major Changes | ||
|
||
- First major version bump, includes a working version of the plugin (removed the animations parameter) | ||
|
||
### Minor Changes | ||
|
||
- A change to the plugin name, dependancies and commented text | ||
|
||
## 0.1.0 | ||
|
||
### Minor Changes | ||
|
||
- A change to the plugin name, dependancies and commented text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# This CITATION.cff file was generated with cffinit. | ||
# Visit https://bit.ly/cffinit to generate yours today! | ||
|
||
cff-version: 1.2.0 | ||
title: jspsych-plugin-slide-to-contuinue | ||
message: >- | ||
If you use this software, please cite it using the | ||
metadata from this file. | ||
type: software | ||
authors: | ||
- given-names: Vishnu | ||
family-names: Lakshman | ||
email: [email protected] | ||
affiliation: De Leeuw Lab - Vassar College | ||
repository-code: >- | ||
https://github.com/lakshmanvishnu/jspsych-contrib/tree/slider_plugin/packages/plugin-slider | ||
abstract: >- | ||
The plugin-slider is a jspsych plugin that creates an | ||
interactive slider interface similar to the "slide to | ||
unlock" functionality found on mobile devices. Users must | ||
drag a slider handle to complete the trial, making it | ||
useful for consent screens, engagement checks, or | ||
transition screens in psychological experiments. | ||
keywords: | ||
- jspsych | ||
- plugin | ||
- slider | ||
- jspsych-contrib | ||
license: MIT | ||
commit: First release | ||
version: 1.0.0 | ||
date-released: '2025-07-14' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# plugin-slider | ||
|
||
## Overview | ||
|
||
The `plugin-slide-to-continue` is a jsPsych plugin that creates an interactive slider interface similar to the "slide to unlock" functionality found on mobile devices. Users must drag a slider handle to complete the trial, making it useful for consent screens, engagement checks, or transition screens in psychological experiments. | ||
|
||
## Features | ||
|
||
- **Customizable appearance**: Control color, shape, size, and orientation | ||
- **Flexible direction**: Support for left-to-right or right-to-left sliding | ||
- **Smooth animations**: Optional smooth transitions and visual feedback | ||
- **Touch-friendly**: Works on both desktop and mobile devices | ||
- **Progress tracking**: Records completion status, response time, and final position | ||
|
||
## Installation | ||
|
||
### Using npm | ||
|
||
```bash | ||
npm install plugin-slide-to-continue | ||
``` | ||
|
||
### Using a CDN | ||
|
||
```html | ||
<script src="https://unpkg.com/plugin-slide-to-continue@latest/dist/index.browser.min.js"></script> | ||
``` | ||
|
||
## Compatibility | ||
|
||
`plugin-slide-to-continue` requires jsPsych v8.0.0 or later. | ||
|
||
## Parameters | ||
|
||
In addition to the [parameters available in all plugins](https://www.jspsych.org/latest/overview/plugins#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of undefined must be specified. Other parameters can be left unspecified if the default value is acceptable. | ||
|
||
| Parameter | Type | Default Value | Description | | ||
| -------------- | ------- | ------------------ | -------------------------------------------------------------- | | ||
| `color` | string | "purple" | The color of the slider track and handle (hex, rgb, or named) | | ||
| `direction` | string | "left-to-right" | The sliding direction ("left-to-right" or "right-to-left") | | ||
| `object_sliding` | string | "round" | The shape of the slider handle ("round" or "square") | | ||
| `length` | number | 300 | The length of the slider in pixels | | ||
| `orientation` | string | "horizontal" | The slider orientation ("horizontal" or "vertical") | | ||
| `width` | number | 60 | The width/height of the slider track in pixels | | ||
| `animation` | string | "smooth" | Animation style ("smooth" or "ticks") | | ||
| `prompt` | string | null | HTML content displayed above the slider | | ||
| `slider_text` | string | "Slide to continue" | Text displayed on the slider | | ||
| `duration` | number | null | Maximum trial duration in milliseconds | | ||
|
||
## Data Generated | ||
|
||
In addition to the [default data collected by all plugins](https://www.jspsych.org/latest/overview/plugins#data-collected-by-all-plugins), this plugin collects the following data for each trial. | ||
|
||
| Name | Type | Value | | ||
| ---------------- | ------- | ---------------------------------------------------------- | | ||
| `rt` | number | The response time in milliseconds to complete the slide | | ||
| `response` | boolean | Whether the slider was successfully completed | | ||
| `final_position` | number | The final position of the slider (0-100) | | ||
|
||
## Examples | ||
|
||
### Basic Usage | ||
|
||
```javascript | ||
var trial = { | ||
type: jsPsychPluginSlider, | ||
prompt: '<h2>Welcome to the Experiment</h2>', | ||
slider_text: 'Slide to continue' | ||
}; | ||
``` | ||
|
||
### Vertical Red Slider | ||
|
||
```javascript | ||
var trial = { | ||
type: jsPsychPluginSlider, | ||
color: 'red', | ||
orientation: 'vertical', | ||
length: 200, | ||
width: 80, | ||
object_sliding: 'square', | ||
slider_text: 'Slide up' | ||
}; | ||
``` | ||
|
||
### Right-to-Left Slider | ||
|
||
```javascript | ||
var trial = { | ||
type: jsPsychPluginSlider, | ||
direction: 'right-to-left', | ||
color: '#2196F3', | ||
animation: 'ticks', | ||
prompt: '<p>Slide from right to left to proceed</p>' | ||
}; | ||
``` | ||
|
||
### Timed Trial | ||
|
||
```javascript | ||
var trial = { | ||
type: jsPsychPluginSlider, | ||
duration: 10000, // 10 seconds maximum | ||
prompt: '<p>Quick! Slide to continue before time runs out!</p>', | ||
color: 'orange' | ||
}; | ||
``` | ||
|
||
## Documentation | ||
|
||
See [documentation](docs/plugin-slider.md) for detailed usage information. | ||
|
||
## Author / Citation | ||
|
||
[Vishnu Lakshman](https://github.com/lakshmanvishnu) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.