1/* Author Rick,Wayne */ 2 3function numberQaptcha(options){ 4 5 var defaultOptions={ 6 form: null, 7 numberAmount: 4, 8 topicPHP: '', 9 imageContainer: null, 10 triggerContainer: null, 11 resetButton: null, 12 send: function(){} 13 }; 14 15 var answer = ''; 16 var qaptchaInput; //answer input 17 var timeInput; //trigger time input 18 var qaptchaStartTime; 19 var triggerTimeRecord; 20 this.options = $.extend({}, defaultOptions, options); 21 22 this.trigger = function(data){ 23 24 //time record 25 var triggerTime = (new Date()).getTime(); 26 triggerTimeRecord.push((triggerTime - qaptchaStartTime)); 27 timeInput.val(triggerTimeRecord.join(',')); 28 29 //answer rcord 30 answer += data.toString(); 31 32 //send 33 if(answer.length >= this.options.numberAmount){ 34 35 qaptchaInput.val(answer); 36 this.options.send && this.options.send(this); 37 } 38 39 }; 40 41 this.init = function(){ 42 43 //init 44 thisNumberQaptcha = this; 45 answer = ''; 46 qaptchaStartTime = (new Date()).getTime(); 47 triggerTimeRecord = []; 48 this.options.form.find('input[name="numberQaptcha"]').remove(); 49 this.options.form.find('input[name="numberQaptchaTime"]').remove(); 50 $(this.options.imageContainer).empty().addClass('loading'); 51 $(this.options.triggerContainer).empty(); 52 $(this.options.resetButton).off('click.numberQaptcha'); 53 54 //add input 55 qaptchaInput = $('<input name="numberQaptcha" />').hide(); 56 this.options.form.append(qaptchaInput); 57 timeInput = $('<input name="numberQaptchaTime" />').hide(); 58 this.options.form.append(timeInput); 59 60 //create image 61 var topic = $('<img />'); 62 topic.attr('src', this.options.topicPHP + '?t=' + (new Date()).getTime()); 63 topic.appendTo($(this.options.imageContainer)); 64 65 //create trigger 66 for(var i=0;i<this.options.numberAmount;i++){ 67 var trigger = $('<div></div>').addClass('trigger').data('number', i); 68 trigger.appendTo(this.options.triggerContainer); 69 70 trigger.on('click.numberQaptcha',function(){ 71 $(this).off('click.numberQaptcha'); 72 $(this).addClass('active'); 73 thisNumberQaptcha.trigger($(this).data('number')); 74 }); 75 } 76 77 //create reset 78 $(this.options.resetButton).on('click.numberQaptcha',function(){ 79 thisNumberQaptcha.init(); 80 }); 81 82 $(this.options.imageContainer).removeClass('loading'); 83 84 }; 85 86 this.destroy = function(){ 87 88 89 90 }; 91}
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.