PageSourceSearch

https://parksfield.org/jquery/QapTcha.jquery.js

js parksfield.org collected 2026-10-02 14:16:45 UTC 3,230 bytes, 98 lines download raw bytes

1/************************************************************************
2*************************************************************************
3@Name :       	QapTcha - jQuery Plugin
4@Revison :    	4.2
5@Date : 		06/09/2012  - dd/mm/YYYY
6@Author:     	 ALPIXEL Agency - (www.myjqueryplugins.com - www.alpixel.fr)
7@License :		 Open Source - MIT License : http://www.opensource.org/licenses/mit-license.php
8
9**************************************************************************
10*************************************************************************/
11jQuery.QapTcha = {
12	build : function(options)
13	{
14        var defaults = {
15			txtLock : 'Locked : drag bar full right to unlock',
16			txtUnlock : 'Unlocked : form can be submitted',
17			disabledSubmit : true,
18			autoRevert : true,
19			PHPfile : 'php/Qaptcha.jquery.php',
20			autoSubmit : false
21        };
22
23		if(this.length>0)
24		return jQuery(this).each(function(i) {
25			/** Vars **/
26			var
27				opts = $.extend(defaults, options),
28				$this = $(this),
29				form = $('form').has($this),
30				Clr = jQuery('<div>',{'class':'clr'}),
31				bgSlider = jQuery('<div>',{'class':'bgSlider'}),
32				Slider = jQuery('<div>',{'class':'Slider'}),
33				TxtStatus = jQuery('<div>',{'class':' TxtStatus dropError',text:opts.txtLock}),
34				inputQapTcha = jQuery('<input>',{name:generatePass(32),value:generatePass(7),type:'hidden'});
35
36			/** Disabled submit button **/
37			if(opts.disabledSubmit) form.find('input[type=\'submit\']').attr('disabled','disabled');
38
39			/** Construct DOM **/
40			bgSlider.appendTo($this);
41			Clr.insertAfter(bgSlider);
42			TxtStatus.insertAfter(Clr);
43			inputQapTcha.appendTo($this);
44			Slider.appendTo(bgSlider);
45			$this.show();
46
47			Slider.draggable({
48				revert: function(){
49					if(opts.autoRevert)
50					{
51						if(parseInt(Slider.css("left")) > (bgSlider.width()-Slider.width()-10)) return false;
52						else return true;
53					}
54				},
55				containment: bgSlider,
56				axis:'x',
57				stop: function(event,ui){
58					if(ui.position.left > (bgSlider.width()-Slider.width()-10))
59					{
60						// set the SESSION iQaptcha in PHP file
61						$.post(opts.PHPfile,{
62							action : 'qaptcha',
63							qaptcha_key : inputQapTcha.attr('name')
64						},
65						function(data) {
66							if(!data.error)
67							{
68								Slider.draggable('disable').css('cursor','default');
69								inputQapTcha.val('');
70								TxtStatus.text(opts.txtUnlock).addClass('dropSuccess').removeClass('dropError');
71								form.find('input[type=\'submit\']').removeAttr('disabled');
72								if(opts.autoSubmit) form.find('input[type=\'submit\']').trigger('click');
73								/*added by shell lanius*/
74								document.getElementById("lock-img").src="img/lock1.png";
75								$(".QapTcha .bgSlider").css("background-color","green");
76								/*end added code*/
77								
78								
79								
80							}
81						},'json');
82					}
83				}
84			});
85
86			function generatePass(nb) {
87		        var chars = 'azertyupqsdfghjkmwxcvbn23456789AZERTYUPQSDFGHJKMWXCVBN_-#@';
88		        var pass = '';
89		        for(i=0;i<nb;i++){
90		            var wpos = Math.round(Math.random()*chars.length);
91		            pass += chars.substring(wpos,wpos+1);
92		        }
93		        return pass;
94		    }
95
96		});
97	}
98}; jQuery.fn.QapTcha = jQuery.QapTcha.build;

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.