diff --git a/jquery.realperson.css b/jquery.realperson.css index e8b23e6..e4ec3f9 100644 --- a/jquery.realperson.css +++ b/jquery.realperson.css @@ -2,6 +2,11 @@ .realperson-challenge { display: block; color: #000; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; } .realperson-text { font-family: "Courier New",monospace; @@ -9,6 +14,7 @@ font-weight: bold; letter-spacing: -1px; line-height: 3px; + cursor: default; } .realperson-regen { padding-top: 4px; diff --git a/jquery.realperson.js b/jquery.realperson.js index 8e23fd0..0347397 100644 --- a/jquery.realperson.js +++ b/jquery.realperson.js @@ -9,6 +9,7 @@ /* Real person manager. */ function RealPerson() { this._defaults = { + placeholder: null, // CAPTCHA container element (selector) length: 6, // Number of characters to use includeNumbers: false, // True to use numbers as well as letters regenerate: 'Click to change', // Instruction text to regenerate @@ -109,8 +110,14 @@ $.extend(RealPerson.prototype, { options[name] = value; } $.extend(inst.options, options); - target.prevAll('.' + this.propertyName + '-challenge,.' + this.propertyName + '-hash'). - remove().end().before(this._generateHTML(target, inst)); + if (inst.options.placeholder == null) { + target.prevAll('.' + this.propertyName + '-challenge,.' + this.propertyName + '-hash'). + remove().end().before(this._generateHTML(target, inst)); + } else { + var placeholder = inst.options.placeholder; + $(placeholder).html(this._generateHTML(target, inst)); + $(placeholder + ' > .' + this.propertyName + '-challenge').data('target-input', target); + } }, /* Generate the additional content for this control. @@ -228,7 +235,12 @@ var plugin = $.realperson = new RealPerson(); // Singleton instance $(document).on('click', 'div.' + plugin.propertyName + '-challenge', function() { if (!$(this).hasClass(plugin.propertyName + '-disabled')) { - $(this).nextAll('.' + plugin.markerClassName).realperson('option', {}); + var targetInput = $(this).data('target-input'); + if (targetInput && targetInput.length > 0) { + targetInput.realperson('option', {}); + } else { + $(this).nextAll('.' + plugin.markerClassName).realperson('option', {}); + } } }); diff --git a/realPersonBasic.html b/realPersonBasic.html index 5428c18..bdf9dad 100644 --- a/realPersonBasic.html +++ b/realPersonBasic.html @@ -12,7 +12,10 @@ @@ -26,8 +29,16 @@

jQuery Real Person

documentation reference page.

-

-

+ + + + + + + + + +