{"version":3,"file":"slick.min.js","sources":["../../../js/realperson/jquery.realperson.js"],"sourcesContent":["(function($) { // Hide scope, no $ conflict\r\n\r\n\tvar pluginName = 'realperson';\r\n\t\r\n\tvar ALPHABETIC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\r\n\tvar ALPHANUMERIC = ALPHABETIC + '0123456789';\r\n\tvar DOTS = [\r\n\t\t[' * ', ' * * ', ' * * ', ' * * ', ' ***** ', '* *', '* *'],\r\n\t\t['****** ', '* *', '* *', '****** ', '* *', '* *', '****** '],\r\n\t\t[' ***** ', '* *', '* ', '* ', '* ', '* *', ' ***** '],\r\n\t\t['****** ', '* *', '* *', '* *', '* *', '* *', '****** '],\r\n\t\t['*******', '* ', '* ', '**** ', '* ', '* ', '*******'],\r\n\t\t['*******', '* ', '* ', '**** ', '* ', '* ', '* '],\r\n\t\t[' ***** ', '* *', '* ', '* ', '* ***', '* *', ' ***** '],\r\n\t\t['* *', '* *', '* *', '*******', '* *', '* *', '* *'],\r\n\t\t['*******', ' * ', ' * ', ' * ', ' * ', ' * ', '*******'],\r\n\t\t[' *', ' *', ' *', ' *', ' *', '* *', ' ***** '],\r\n\t\t['* *', '* ** ', '* ** ', '** ', '* ** ', '* ** ', '* *'],\r\n\t\t['* ', '* ', '* ', '* ', '* ', '* ', '*******'],\r\n\t\t['* *', '** **', '* * * *', '* * *', '* *', '* *', '* *'],\r\n\t\t['* *', '** *', '* * *', '* * *', '* * *', '* **', '* *'],\r\n\t\t[' ***** ', '* *', '* *', '* *', '* *', '* *', ' ***** '],\r\n\t\t['****** ', '* *', '* *', '****** ', '* ', '* ', '* '],\r\n\t\t[' ***** ', '* *', '* *', '* *', '* * *', '* * ', ' **** *'],\r\n\t\t['****** ', '* *', '* *', '****** ', '* * ', '* * ', '* *'],\r\n\t\t[' ***** ', '* *', '* ', ' ***** ', ' *', '* *', ' ***** '],\r\n\t\t['*******', ' * ', ' * ', ' * ', ' * ', ' * ', ' * '],\r\n\t\t['* *', '* *', '* *', '* *', '* *', '* *', ' ***** '],\r\n\t\t['* *', '* *', ' * * ', ' * * ', ' * * ', ' * * ', ' * '],\r\n\t\t['* *', '* *', '* *', '* * *', '* * * *', '** **', '* *'],\r\n\t\t['* *', ' * * ', ' * * ', ' * ', ' * * ', ' * * ', '* *'],\r\n\t\t['* *', ' * * ', ' * * ', ' * ', ' * ', ' * ', ' * '],\r\n\t\t['*******', ' * ', ' * ', ' * ', ' * ', ' * ', '*******'],\r\n\t\t[' *** ', ' * * ', '* * *', '* * *', '* * *', ' * * ', ' *** '],\r\n\t\t[' * ', ' ** ', ' * * ', ' * ', ' * ', ' * ', '*******'],\r\n\t\t[' ***** ', '* *', ' *', ' * ', ' ** ', ' ** ', '*******'],\r\n\t\t[' ***** ', '* *', ' *', ' ** ', ' *', '* *', ' ***** '],\r\n\t\t[' * ', ' ** ', ' * * ', ' * * ', '*******', ' * ', ' * '],\r\n\t\t['*******', '* ', '****** ', ' *', ' *', '* *', ' ***** '],\r\n\t\t[' **** ', ' * ', '* ', '****** ', '* *', '* *', ' ***** '],\r\n\t\t['*******', ' * ', ' * ', ' * ', ' * ', ' * ', '* '],\r\n\t\t[' ***** ', '* *', '* *', ' ***** ', '* *', '* *', ' ***** '],\r\n\t\t[' ***** ', '* *', '* *', ' ******', ' *', ' * ', ' **** ']];\r\n\r\n\t/** Create the real person plugin.\r\n\t\t
Displays a challenge to confirm that the viewer is a real person.
\r\n\t\tExpects HTML like:
\r\n\t\t<input...>\r\n\t\t
Provide inline configuration like:
\r\n\t\t<input data-realperson=\"name: 'value'\">...>\r\n\t \t@module RealPerson\r\n\t\t@augments JQPlugin\r\n\t\t@example $(selector).realperson()\r\n $(selector).realperson({length: 200, toggle: false}) */\r\n\t$.JQPlugin.createPlugin({\r\n\t\r\n\t\t/** The name of the plugin. */\r\n\t\tname: pluginName,\r\n\r\n\t\t/** The set of alphabetic characters. */\r\n\t\talphabetic: ALPHABETIC,\r\n\t\t/** The set of alphabetic and numeric characters. */\r\n\t\talphanumeric: ALPHANUMERIC,\r\n\t\t/** The set dots that make up each character. */\r\n\t\tdefaultDots: DOTS,\r\n\r\n\t\t/** More/less change callback.\r\n\t\t\tTriggered when the more/less button is clicked.\r\n\t\t\t@callback changeCallback\r\n\t\t\t@param expanding {boolean} True if expanding the text, false if collapsing. */\r\n\t\t\t\r\n\t\t/** Default settings for the plugin.\r\n\t\t\t@property [length=6] {number} Number of characters to use.\r\n\t\t\t@property [regenerate='Click to change'] {string} Instruction text to regenerate.\r\n\t\t\t@property [hashName='{n}Hash'] {string} Name of the hash value field to compare with,\r\n\t\t\t\t\t\tuse {n} to substitute with the original field name.\r\n\t\t\t@property [dot='*'] {string} The character to use for the dot patterns.\r\n\t\t\t@property [dots=defaultDots] {string[][]} The dot patterns per letter in chars.\r\n\t\t\t@property [chars=alphabetic] {string} The characters allowed. */\r\n\t\tdefaultOptions: {\r\n\t\t\tlength: 6,\r\n\t\t\tregenerate: 'Click to change',\r\n\t\t\thashName: '{n}Hash',\r\n\t\t\tdot: '*',\r\n\t\t\tdots: DOTS,\r\n\t\t\tchars: ALPHABETIC\r\n\t\t},\r\n\t\t\r\n\t\t_getters: ['getHash'],\r\n\r\n\t\t_challengeClass: pluginName + '-challenge',\r\n\t\t_disabledClass: pluginName + '-disabled',\r\n\t\t_hashClass: pluginName + '-hash',\r\n\t\t_regenerateClass: pluginName + '-regen',\r\n\t\t_textClass: pluginName + '-text',\r\n\r\n\t\t_optionsChanged: function(elem, inst, options) {\r\n\t\t\t$.extend(inst.options, options);\r\n\t\t\tvar text = '';\r\n\t\t\tfor (var i = 0; i < inst.options.length; i++) {\r\n\t\t\t\ttext += inst.options.chars.charAt(Math.floor(Math.random() * inst.options.chars.length));\r\n\t\t\t}\r\n\t\t\tinst.hash = hash(text + salt);\r\n\t\t\tvar self = this;\r\n\t\t\telem.closest('form').off('.' + inst.name).\r\n\t\t\t\ton('submit.' + inst.name, function() {\r\n\t\t\t\t\tvar name = inst.options.hashName.replace(/\\{n\\}/, elem.attr('name'));\r\n\t\t\t\t\tvar form = $(this);\r\n\t\t\t\t\tform.find('input[name=\"' + name + '\"]').remove();\r\n\t\t\t\t\tform.append('');\r\n\t\t\t\t\tsetTimeout(function() {\r\n\t\t\t\t\t\tform.find('input[name=\"' + name + '\"]').remove();\r\n\t\t\t\t\t}, 0);\r\n\t\t\t\t});\r\n\t\t\telem.prevAll('.' + this._challengeClass + ',.' + this._hashClass).remove().end().\r\n\t\t\t\tbefore(this._generateHTML(inst, text)).\r\n\t\t\t\tprevAll('div.' + this._challengeClass).click(function() {\r\n\t\t\t\t\tif (!$(this).hasClass(self._disabledClass)) {\r\n\t\t\t\t\t\telem.realperson('option', {});\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t},\r\n\r\n\t\t/* Enable the plugin functionality for a control.\r\n\t\t @param elem {element} The control to affect. */\r\n\t\tenable: function(elem) {\r\n\t\t\telem = $(elem);\r\n\t\t\tif (!elem.hasClass(this._getMarker())) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\telem.removeClass(this._disabledClass).prop('disabled', false).\r\n\t\t\t\tprevAll('.' + this._challengeClass).removeClass(this._disabledClass);\r\n\t\t},\r\n\r\n\t\t/* Disable the plugin functionality for a control.\r\n\t\t @param elem {element} The control to affect. */\r\n\t\tdisable: function(elem) {\r\n\t\t\telem = $(elem);\r\n\t\t\tif (!elem.hasClass(this._getMarker())) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\telem.addClass(this._disabledClass).prop('disabled', true).\r\n\t\t\t\tprevAll('.' + this._challengeClass).addClass(this._disabledClass);\r\n\t\t},\r\n\t\t\r\n\t\t/* Retrieve the hash value.\r\n\t\t @param elem {Element} The control with the hash.\r\n\t\t @return {number} The hash value. */\r\n\t\tgetHash: function (elem) {\r\n\t\t\tvar inst = this._getInst(elem);\r\n\t\t\treturn inst ? inst.hash : 0;\r\n\t\t},\r\n\t\t\r\n\t\t/* Generate the additional content for this control.\r\n\t\t @param inst {object} The current instance settings.\r\n\t\t @param text {string} The text to display.\r\n\t\t @return {string} The additional content. */\r\n\t\t_generateHTML: function(inst, text) {\r\n\t\t var html = '