(function (window, document, $, undefined) { var possibleCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var defaults = { selector: "#captcha", text: null, randomText: true, randomColours: true, width: 300, height: 200, colour1: null, colour2: null, font: 'bold 48px "Comic Sans MS", cursive, sans-serif', onError: function() { alert('Captcha inválido.'); } }; var CAPTCHA = function (config) { var that = this; this._settings = $.extend({}, defaults, config || {}); this._container = $(this._settings.selector); var canvasWrapper = $('
').appendTo(this._container); // this._canvas = $('').appendTo(canvasWrapper).width(this._settings.width).height(this._settings.height); this._canvas = $('').appendTo(canvasWrapper).width(220).height(75); var controlWrapper = $('
').appendTo(this._container); this._input = $('').addClass('form-control') .attr('id','txtCaptcha').attr('placeholder','Código de Seguridad').attr('type','text').attr('autocomplete','off') .on('keypress', function (e) { if (e.which == 13) { that.validate(that._input.val()); } }) .appendTo(controlWrapper); // this._button = $('