Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
475d89f
feat: adding a new slider plugin
lakshmanvishnu Jul 10, 2025
3368b2e
fix: updated lockfile after successful install
lakshmanvishnu Jul 10, 2025
f7b6a89
fix: debugged few failing tests
lakshmanvishnu Jul 11, 2025
dc82893
chore: filled in README
lakshmanvishnu Jul 11, 2025
76eb205
chore: added docs
lakshmanvishnu Jul 14, 2025
eba8519
chore: added a citation file
lakshmanvishnu Jul 14, 2025
ec59de3
chore: rename plugin-slider to plugin-slide-to-continue
lakshmanvishnu Jul 16, 2025
6268431
fix: minor fixes to the name, dependencies and comments
lakshmanvishnu Jul 16, 2025
f58ae43
chore: addded changeset log
lakshmanvishnu Jul 16, 2025
4f86e1d
chore: version bump
lakshmanvishnu Jul 16, 2025
7d82123
fix: remove animations parameter
lakshmanvishnu Jul 16, 2025
2be6a58
feat: first major version bump
lakshmanvishnu Jul 16, 2025
19d52d7
feat: chnagelog
lakshmanvishnu Jul 16, 2025
8b57132
fix: change color parameter to accept colour name and hex color code
lakshmanvishnu Jul 16, 2025
e380bca
version bump
lakshmanvishnu Jul 16, 2025
1dabe81
feat: added multi-line functionality and new text sizing parameter
lakshmanvishnu Jul 16, 2025
2bd2a31
version bump
lakshmanvishnu Jul 16, 2025
dfd6ba3
fix: fixed styling of the progress bar
lakshmanvishnu Jul 16, 2025
695408f
minor version bump for progress bar styling
lakshmanvishnu Jul 16, 2025
05fb471
fix: smoothen out progress bar completion and commented parameters
lakshmanvishnu Jul 16, 2025
4f3bdb0
patch version bump, imporving progres bar styling
lakshmanvishnu Jul 16, 2025
f3454f9
fix: fixing git test errors
lakshmanvishnu Jul 16, 2025
da8ebb4
fix: removing tests for deleted animation parameter
lakshmanvishnu Jul 16, 2025
5a1cbb7
final name changes and changeset addition
lakshmanvishnu Jul 17, 2025
847caef
fix: edits to docs and version bump
lakshmanvishnu Jul 18, 2025
6a4a3bb
resolve merge conflict with upstream main
lakshmanvishnu Jul 18, 2025
d691d25
fix: Installing dependencies
lakshmanvishnu Jul 18, 2025
486ea39
fix: fixing git checks
lakshmanvishnu Jul 18, 2025
7ef2047
fix: fixing package build error
lakshmanvishnu Jul 18, 2025
99c61bc
fix: rebuild packages-lock.json file
lakshmanvishnu Jul 18, 2025
409dff0
fix: fix git build error
lakshmanvishnu Jul 21, 2025
8cac3a6
fix: removing plugin package-lock.json
lakshmanvishnu Jul 21, 2025
2ef46c6
fix: updating package-lock.json to fix test errors
lakshmanvishnu Jul 21, 2025
4229b56
Merge branch 'main' into slider_plugin
lakshmanvishnu Jul 22, 2025
5ae4260
fix: merging with main, updating package-lock
lakshmanvishnu Jul 22, 2025
a17fb38
fix: reinstalled package-lock.json file
lakshmanvishnu Jul 22, 2025
9bfcd06
Delete package-lock.json.backup
jodeleeuw Jul 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,440 changes: 1,278 additions & 162 deletions package-lock.json

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions packages/plugin-slider/CITATION.cff
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-slider
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'
115 changes: 115 additions & 0 deletions packages/plugin-slider/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# plugin-slider

## Overview

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.

## 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-slider
```

### Using a CDN

```html
<script src="https://unpkg.com/plugin-slider@latest/dist/index.browser.min.js"></script>
```

## Compatibility

`plugin-slider` 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)
Loading