GithubHelp home page GithubHelp logo

jquery-ui-slider-captcha's Introduction

A Slider Captcha with cool style

The jQuery Slider Captcha provides a slider interface, based in jQuery-UI slider, to unlock or submit forms or other type of elements. In other words, this plugin replaces traditional captcha.

This plugin was developed by the Computer and Network Services of Técnico Lisboa due to usability concerns with the traditional captcha tool. We wanted to provide a more fluid and quick interaction to the user, while maintaining the validation pattern that a web form requires. This plugin was inspired in similar approaches found in the web.

Compatibility

The slider is totaly functional in all modern browsers. Slider is full responsive and can be used in touch devices.

Usage

This plugin requires jQuery, jQuery UI, jQuery UI Touch Punch Improved. We suggest that this resources should be include at the end of head tag. The plugin css should be loaded in the same way. Note that some of listed resources have dependecies and should be loaded in the correct position.

<link rel="stylesheet" href="/path/to/slider-captcha.css" media="screen">

<script src="/path/to/jquery.min.js"></script>

<script src="/path/to/jquery.ui.core.js"></script>
<script src="/path/to/jquery.ui.widget.js"></script>
<script src="/path/to/jquery.ui.mouse.js"></script>
<script src="/path/to/jquery.ui.draggable.js"></script>
<script src="/path/to/jquery.ui.droppable.js"></script>

<script src="/path/to/jquery.ui.touch-punch-improved.js"></script>

<script src="/path/to/slider-captcha.min.js"></script>

Initialization

After the document load, you can use the plugin inside a $(document).ready function:

$(document).ready(function() {
	$( '#slider' ).sliderCaptcha();	
})

Full customization

All available options. The following example uses the default options.

$(document).ready( function () {
	$( '#slider' ).sliderCaptcha({
		type: 'normal',
		textFeedbackAnimation: 'overlap',
		styles: {
			knobColor: '',
			knobColorAfterUnlock: '#5CDF3B',
			backgroundColor: '',
			textColor: '',
			textColorAfterUnlock: '#000'
		},
		width: '100%',
		height: ''
		hintText: 'Swipe to Unlock',
		hintTextSize: '',
		hintTextAfterUnlock: 'Unlocked',
		face: {
			icon: '',
			top: '',
			right: '',
			textColor: '',
			iconAfterUnlock: '',
			topAfterUnlock: '',
			rightAfterUnlock: '',
			textColorAfterUnlock: ''
		},

		// events
		events: {
			beforeUnlock: function() {},
			afterUnlock: function() {},
			beforeSubmit: function() {},
			submitAfterUnlock: 0,
			validateOnServer: 0,
			validateOnServerParamName: 'slider_captcha_validated'
		}		
	});
})

Options

All the options demystified:

type: (default 'normal') The options 'normal' and 'filled' are eligible. The latter causes the slider to fill the slider bar while user control it.

textFeedbackAnimation: (default 'overlap') This option is only available with the 'filled' slider type. Push and swipe out the feedback text in slider bar ('swipe'), push the feedback text in slider bar ('swipe_overlap') or overlap text feedback ('overlap').

styles: (default { knobColor: '', knobColorAfterUnlock: '#5CDF3B', backgroundColor: '', textColor: '', textColorAfterUnlock: '#000', width: '100%', height: '' } ) General styles, including color, text and dimensions options.

hintText: (default 'Swipe to Unlock') Text to be displayed in initial state.

hintTextSize: '' (default '') Hint text font size.

hintTextAfterUnlock: (default 'Unlocked') Text to be displayed after the slider has been unlocked.

face: (default { icon: '', top: '', right: '', textColor: '', iconAfterUnlock: '', topAfterUnlock: '', rightAfterUnlock: '', textColorAfterUnlock: '' }) Slider knob options, including face content (entypo font) , color and offset.

events: (default { beforeUnlock: function() {}, afterUnlock: function() {}, beforeSubmit: function() {}, noSubmit: function() {} ,submitAfterUnlock: 0, highValidationOnServer:0, validateOnServer: 0, validateOnServerParamName: 'slider_captcha_validated' }) Events options, like functions to be called before and after unlock and before submit. Here can be activated if the validation will be performed in server (validateOnServer) and with which param name in form request should be used (validateOnServerParamName), and if submit should be performed after the unlock (submitAfterUnlock).

Examples

Example 1

$(document).ready(function() {
	$( '#slider' ).sliderCaptcha({
		face: {
			icon: 'plus',
			iconAfterUnlock: 'stop'
		}
	});
})

Example 2

$(document).ready(function() {
	$( '#slider_filled' ).sliderCaptcha({
		type: "filled",
		styles: {
			width: '300px'
		}
	});
})

Example 3

$(document).ready(function() {
	$( '#slider_full' ).sliderCaptcha({
		type: "filled",
		textFeedbackAnimation: 'swipe_overlap',
		hintText: "Swipe to submit",
		hintTextSize: '12px',
		hintTextAfterUnlock: 'You can submit now',
		styles: {
			knobColor: "#5CDF3B",
			knobColorAfterUnlock: "#000000",
			backgroundColor: "#444",
			textColor: "#fff",
			textColorAfterUnlock: "#fff",
			width: '90%',
			height: '35px'
		},
		face: {
			top: 4,
			right: 9,
			icon: 'right-thin',
			textColor: '#ddd',
			textColorAfterUnlock: '#5CDF3B',
			topAfterUnlock: 3,
			rightAfterUnlock: 9,				
			iconAfterUnlock: 'flag'
		},
		events: {
			afterUnlock: function () {
				console.log("afterUnlock event");
			},
			beforeUnlock: function () {
				console.log("afterSubmit event");
			},
			beforeSubmit: function () {
				console.log("beforeSubmit event");
			},
			noSubmit: function () {
				console.log("noSubmit event");
			},			
			submitAfterUnlock: 0,
			validateOnServer: 1,
			highValidationOnServer: 0,
			validateOnServerParamName: "my_form_param_name"
		}
	});
})

Changelog

0.4

- Foundation css issue resolved
- High server validation option

0.3.1

- Added getUnitSize function for mismatch units

0.3

- Text animation code issue resolved
- New options name

0.2

- IE browsers issues resolved
- Text animation code refactorization

0.1

  • Initial release.

License

This plugin is available under the GPLv3 license.

jquery-ui-slider-captcha's People

Contributors

jpargana avatar vaurdan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jquery-ui-slider-captcha's Issues

User Experience

Hi!

I have a lot of users complaining that the captcha is broken (they can't validate it) when in reality they are having problems with the interface not being forgiving enough.

The range of success is far too narrow. Many users drag past the end of the bar and let go, or let go not quite at the end of the bar, in both cases users thought they performed the actions correctly, and were punished with not being able to complete the form.

I've seen users try to slide more than 10 times without being able to figure out that they need to let go more precisely at the exact end.

It would substantially improve the usability and popularity of your captcha if you made the success zone larger and more forgiving, or at the very least allowed it to be customized in the options.

jquery-ui-slider-captcha not working

Hi

I have downloaded the Zip file. When I opened the index.html file in browser its not working. I have downloaded all the jquery file (which are not included in the ZIP folder) referenced in the index.html file.
but the slider is not working. the slider is not movable.

  1. How can I make this work? Do you have a full sample folder available where the file is working properly.
  2. Is it compatible with asp.net website?

looking forward to your response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.