Skip to content

Commit 9d136e6

Browse files
author
Keith Wood
committed
Release 2.0.1
1 parent e51dd26 commit 9d136e6

7 files changed

+53
-15
lines changed

bower.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "kbwood_realperson",
3+
"version": "2.0.1",
4+
"description": "This plugin enhances an input field to help reduce automated form submission. * Server-side scripts for PHP, Java, C#, ColdFusion, Rails, Python.",
5+
"keywords": [
6+
"captcha",
7+
"ui",
8+
"validation"
9+
],
10+
"license": "MIT",
11+
"authors": [
12+
"Keith Wood"
13+
],
14+
"main": "jquery.realperson.js",
15+
"ignore": [
16+
"*.gif",
17+
"*.html",
18+
"*.json",
19+
"*.md",
20+
"*.png",
21+
"jquery.realperson-*.js",
22+
"jquery.*.min.js"
23+
],
24+
"dependencies": [
25+
"jquery": ">=1.7"
26+
]
27+
}

jquery.plugin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474

7575
/** Abstract base class for collection plugins v1.0.1.
7676
Written by Keith Wood (kbwood{at}iinet.com.au) December 2013.
77-
Licensed under the MIT (https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) license.
77+
Licensed under the MIT (http://keith-wood.name/licence.html) license.
7878
@module $.JQPlugin
7979
@abstract */
8080
JQClass.classes.JQPlugin = JQClass.extend({

jquery.plugin.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jquery.realperson.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/* Real Person jQuery plugin styles v2.0.0. */
1+
/* Real Person jQuery plugin styles v2.0.1. */
22
.realperson-challenge {
33
display: block;
44
color: #000;
55
}
66
.realperson-text {
7-
font-family: "Courier New",monospace;
7+
font-family: "Courier New",monospace !important;
88
font-size: 6px;
99
font-weight: bold;
1010
letter-spacing: -1px;

jquery.realperson.js

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* http://keith-wood.name/realPerson.html
2-
Real Person Form Submission for jQuery v2.0.0.
2+
Real Person Form Submission for jQuery v2.0.1.
33
Written by Keith Wood (kwood{at}iinet.com.au) June 2009.
4-
Available under the MIT (https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) license.
4+
Available under the MIT (http://keith-wood.name/licence.html) license.
55
Please attribute the author if you use it. */
66

77
(function($) { // Hide scope, no $ conflict
@@ -91,6 +91,8 @@
9191
dots: DOTS,
9292
chars: ALPHABETIC
9393
},
94+
95+
_getters: ['getHash'],
9496

9597
_challengeClass: pluginName + '-challenge',
9698
_disabledClass: pluginName + '-disabled',
@@ -104,6 +106,7 @@
104106
for (var i = 0; i < inst.options.length; i++) {
105107
text += inst.options.chars.charAt(Math.floor(Math.random() * inst.options.chars.length));
106108
}
109+
inst.hash = hash(text + salt);
107110
var self = this;
108111
elem.closest('form').off('.' + inst.name).
109112
on('submit.' + inst.name, function() {
@@ -120,7 +123,7 @@
120123
before(this._generateHTML(inst, text)).
121124
prevAll('div.' + this._challengeClass).click(function() {
122125
if (!$(this).hasClass(self._disabledClass)) {
123-
$(this).nextAll('.' + self._getMarker()).realperson('option', {});
126+
elem.realperson('option', {});
124127
}
125128
});
126129
},
@@ -146,7 +149,15 @@
146149
elem.addClass(this._disabledClass).prop('disabled', true).
147150
prevAll('.' + this._challengeClass).addClass(this._disabledClass);
148151
},
149-
152+
153+
/* Retrieve the hash value.
154+
@param elem {Element} The control with the hash.
155+
@return {number} The hash value. */
156+
getHash: function(elem) {
157+
var inst = this._getInst(elem);
158+
return inst ? inst.hash : 0;
159+
},
160+
150161
/* Generate the additional content for this control.
151162
@param inst {object} The current instance settings.
152163
@param text {string} The text to display.
@@ -157,8 +168,8 @@
157168
for (var i = 0; i < inst.options.dots[0].length; i++) {
158169
for (var j = 0; j < text.length; j++) {
159170
html += inst.options.dots[inst.options.chars.indexOf(text.charAt(j))][i].
160-
replace(/ /g, '&nbsp;').replace(/\*/g, inst.options.dot) +
161-
'&nbsp;&nbsp;';
171+
replace(/ /g, '&#160;').replace(/\*/g, inst.options.dot) +
172+
'&#160;&#160;';
162173
}
163174
html += '<br>';
164175
}

jquery.realperson.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kbw.realperson.jquery.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"ui",
88
"validation"
99
],
10-
"version": "2.0.0",
10+
"version": "2.0.1",
1111
"author": {
1212
"name": "Keith Wood",
1313
"url": "http://keith-wood.name/"
@@ -22,7 +22,7 @@
2222
"licenses": [
2323
{
2424
"type": "MIT",
25-
"url": "https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt"
25+
"url": "http://keith-wood.name/licence.htmlt"
2626
}
2727
],
2828
"bugs": "https://github.com/kbwood/realperson/issues",

0 commit comments

Comments
 (0)