1/** 2 * jQuery Captcha Basic 3 * 4 * @fileoverview Plugin object 5 * @link https://github.com/pemre/jquery-captcha-basic/ 6 * @author Emre Piskin (http://rencs.com/) 7 * @requires jQuery 1.12.4+ 8 */ 9 10(function($) { 11 "use strict"; 12 13 $.fn.captcha = function(param) { 14 15 // DEFAULT VARIABLES 16 var params = $.extend({ 17 idCaptchaText: 'captchaText', // The ID for the captcha text. Default is 'captchaText'. 18 idCaptchaInput: 'captchaInput', // The ID for the captcha input. Default is 'captchaInput'. 19 class: '' // Class name for the submit button toggle. Default is ''. 20 }, param); 21 22 // Find and disable the submit button 23 var submit = $(this).find('input[type=submit]'); 24 submit.attr('disabled', 'disabled'); 25 26 // Insert captcha text and input before the submit button with the given ID's 27 $('<label id="' + params.idCaptchaText + '"></label>').insertBefore(submit); 28 $('<input id="' + params.idCaptchaInput + '" aria-label="Captcha Input" type="text" required>').insertBefore(submit); 29 30 // Select text and input elements to fill 31 var label = this.find('#' + params.idCaptchaText); 32 var input = this.find('#' + params.idCaptchaInput); 33 34 // Generate random numbers and the sum of them 35 var rndmNr1 = Math.floor(Math.random() * 10), 36 rndmNr2 = Math.floor(Math.random() * 10), 37 totalNr = rndmNr1 + rndmNr2; 38 39 // Print the numbers to screen 40 $(label).text(rndmNr1 + ' + ' + rndmNr2 + ' ='); 41 42 // Check the input value, enable it if the sum is correct 43 $(input).keyup(function () { 44 if ($(this).val() == totalNr) 45 submit.removeAttr('disabled').addClass(params.class); 46 else 47 submit.attr('disabled', 'disabled').removeClass(params.class); 48 }); 49 50 // Don't breake jQuery chain! 51 return this; 52 } 53})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.