PageSourceSearch

https://unvdandop.cm/media/mod_rscontact/js/jquery.validate.js?1e0720f48f24e3cc6e5cee70112e2163

js unvdandop.cm collected 2026-10-07 03:47:00 UTC 44,595 bytes, 1,379 lines download raw bytes

1/*!
2 * jQuery Validation Plugin v1.13.0
3 *
4 * http://jqueryvalidation.org/
5 *
6 * Copyright (c) 2014 Jörn Zaefferer
7 * Released under the MIT license
8 */
9(function( factory ) {
10	if ( typeof define === "function" && define.amd ) {
11		define( ["jquery"], factory );
12	} else {
13		factory( jQuery );
14	}
15}(function( $ ) {
16
17$.extend($.fn, {
18	// http://jqueryvalidation.org/validate/
19	validate: function( options ) {
20
21		// if nothing is selected, return nothing; can't chain anyway
22		if ( !this.length ) {
23			if ( options && options.debug && window.console ) {
24				console.warn( "Nothing selected, can't validate, returning nothing." );
25			}
26			return;
27		}
28
29		// check if a validator for this form was already created
30		var validator = $.data( this[ 0 ], "validator" );
31		if ( validator ) {
32			return validator;
33		}
34
35		// Add novalidate tag if HTML5.
36		this.attr( "novalidate", "novalidate" );
37
38		validator = new $.validator( options, this[ 0 ] );
39		$.data( this[ 0 ], "validator", validator );
40
41		if ( validator.settings.onsubmit ) {
42
43			this.validateDelegate( ":submit", "click", function( event ) {
44				if ( validator.settings.submitHandler ) {
45					validator.submitButton = event.target;
46				}
47				// allow suppressing validation by adding a cancel class to the submit button
48				if ( $( event.target ).hasClass( "cancel" ) ) {
49					validator.cancelSubmit = true;
50				}
51
52				// allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
53				if ( $( event.target ).attr( "formnovalidate" ) !== undefined ) {
54					validator.cancelSubmit = true;
55				}
56			});
57
58			// validate the form on submit
59			this.submit( function( event ) {
60				if ( validator.settings.debug ) {
61					// prevent form submit to be able to see console output
62					event.preventDefault();
63				}
64				function handle() {
65					var hidden;
66					if ( validator.settings.submitHandler ) {
67						if ( validator.submitButton ) {
68							// insert a hidden input as a replacement for the missing submit button
69							hidden = $( "<input type='hidden'/>" )
70								.attr( "name", validator.submitButton.name )
71								.val( $( validator.submitButton ).val() )
72								.appendTo( validator.currentForm );
73						}
74						validator.settings.submitHandler.call( validator, validator.currentForm, event );
75						if ( validator.submitButton ) {
76							// and clean up afterwards; thanks to no-block-scope, hidden can be referenced
77							hidden.remove();
78						}
79						return false;
80					}
81					return true;
82				}
83
84				// prevent submit for invalid forms or custom submit handlers
85				if ( validator.cancelSubmit ) {
86					validator.cancelSubmit = false;
87					return handle();
88				}
89				if ( validator.form() ) {
90					if ( validator.pendingRequest ) {
91						validator.formSubmitted = true;
92						return false;
93					}
94					return handle();
95				} else {
96					validator.focusInvalid();
97					return false;
98				}
99			});
100		}
101
102		return validator;
103	},
104	// http://jqueryvalidation.org/valid/
105	valid: function() {
106		var valid, validator;
107
108		if ( $( this[ 0 ] ).is( "form" ) ) {
109			valid = this.validate().form();
110		} else {
111			valid = true;
112			validator = $( this[ 0 ].form ).validate();
113			this.each( function() {
114				valid = validator.element( this ) && valid;
115			});
116		}
117		return valid;
118	},
119	// attributes: space separated list of attributes to retrieve and remove
120	removeAttrs: function( attributes ) {
121		var result = {},
122			$element = this;
123		$.each( attributes.split( /\s/ ), function( index, value ) {
124			result[ value ] = $element.attr( value );
125			$element.removeAttr( value );
126		});
127		return result;
128	},
129	// http://jqueryvalidation.org/rules/
130	rules: function( command, argument ) {
131		var element = this[ 0 ],
132			settings, staticRules, existingRules, data, param, filtered;
133
134		if ( command ) {
135			settings = $.data( element.form, "validator" ).settings;
136			staticRules = settings.rules;
137			existingRules = $.validator.staticRules( element );
138			switch ( command ) {
139			case "add":
140				$.extend( existingRules, $.validator.normalizeRule( argument ) );
141				// remove messages from rules, but allow them to be set separately
142				delete existingRules.messages;
143				staticRules[ element.name ] = existingRules;
144				if ( argument.messages ) {
145					settings.messages[ element.name ] = $.extend( settings.messages[ element.name ], argument.messages );
146				}
147				break;
148			case "remove":
149				if ( !argument ) {
150					delete staticRules[ element.name ];
151					return existingRules;
152				}
153				filtered = {};
154				$.each( argument.split( /\s/ ), function( index, method ) {
155					filtered[ method ] = existingRules[ method ];
156					delete existingRules[ method ];
157					if ( method === "required" ) {
158						$( element ).removeAttr( "aria-required" );
159					}
160				});
161				return filtered;
162			}
163		}
164
165		data = $.validator.normalizeRules(
166		$.extend(
167			{},
168			$.validator.classRules( element ),
169			$.validator.attributeRules( element ),
170			$.validator.dataRules( element ),
171			$.validator.staticRules( element )
172		), element );
173
174		// make sure required is at front
175		if ( data.required ) {
176			param = data.required;
177			delete data.required;
178			data = $.extend( { required: param }, data );
179			$( element ).attr( "aria-required", "true" );
180		}
181
182		// make sure remote is at back
183		if ( data.remote ) {
184			param = data.remote;
185			delete data.remote;
186			data = $.extend( data, { remote: param });
187		}
188
189		return data;
190	}
191});
192
193// Custom selectors
194$.extend( $.expr[ ":" ], {
195	// http://jqueryvalidation.org/blank-selector/
196	blank: function( a ) {
197		return !$.trim( "" + $( a ).val() );
198	},
199	// http://jqueryvalidation.org/filled-selector/
200	filled: function( a ) {
201		return !!$.trim( "" + $( a ).val() );
202	},
203	// http://jqueryvalidation.org/unchecked-selector/
204	unchecked: function( a ) {
205		return !$( a ).prop( "checked" );
206	}
207});
208
209// constructor for validator
210$.validator = function( options, form ) {
211	this.settings = $.extend( true, {}, $.validator.defaults, options );
212	this.currentForm = form;
213	this.init();
214};
215
216// http://jqueryvalidation.org/jQuery.validator.format/
217$.validator.format = function( source, params ) {
218	if ( arguments.length === 1 ) {
219		return function() {
220			var args = $.makeArray( arguments );
221			args.unshift( source );
222			return $.validator.format.apply( this, args );
223		};
224	}
225	if ( arguments.length > 2 && params.constructor !== Array  ) {
226		params = $.makeArray( arguments ).slice( 1 );
227	}
228	if ( params.constructor !== Array ) {
229		params = [ params ];
230	}
231	$.each( params, function( i, n ) {
232		source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() {
233			return n;
234		});
235	});
236	return source;
237};
238
239$.extend( $.validator, {
240
241	defaults: {
242		messages: {},
243		groups: {},
244		rules: {},
245		errorClass: "error",
246		validClass: "valid",
247		errorElement: "label",
248		focusInvalid: true,
249		errorContainer: $( [] ),
250		errorLabelContainer: $( [] ),
251		onsubmit: true,
252		ignore: ":hidden",
253		ignoreTitle: false,
254		onfocusin: function( element ) {
255			this.lastActive = element;
256
257			// hide error label and remove error class on focus if enabled
258			if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
259				if ( this.settings.unhighlight ) {
260					this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.val
260idClass );
261				}
262				this.hideThese( this.errorsFor( element ) );
263			}
264		},
265		onfocusout: function( element ) {
266			if ( !this.checkable( element ) && ( element.name in this.submitted || !this.optional( element ) ) ) {
267				this.element( element );
268			}
269		},
270		onkeyup: function( element, event ) {
271			if ( event.which === 9 && this.elementValue( element ) === "" ) {
272				return;
273			} else if ( element.name in this.submitted || element === this.lastElement ) {
274				this.element( element );
275			}
276		},
277		onclick: function( element ) {
278			// click on selects, radiobuttons and checkboxes
279			if ( element.name in this.submitted ) {
280				this.element( element );
281
282			// or option elements, check parent select in that case
283			} else if ( element.parentNode.name in this.submitted ) {
284				this.element( element.parentNode );
285			}
286		},
287		highlight: function( element, errorClass, validClass ) {
288			if ( element.type === "radio" ) {
289				this.findByName( element.name ).addClass( errorClass ).removeClass( validClass );
290			} else {
291				$( element ).addClass( errorClass ).removeClass( validClass );
292			}
293		},
294		unhighlight: function( element, errorClass, validClass ) {
295			if ( element.type === "radio" ) {
296				this.findByName( element.name ).removeClass( errorClass ).addClass( validClass );
297			} else {
298				$( element ).removeClass( errorClass ).addClass( validClass );
299			}
300		}
301	},
302
303	// http://jqueryvalidation.org/jQuery.validator.setDefaults/
304	setDefaults: function( settings ) {
305		$.extend( $.validator.defaults, settings );
306	},
307
308	messages: {
309		required: "This field is required.",
310		remote: "Please fix this field.",
311		email: "Please enter a valid email address.",
312		url: "Please enter a valid URL.",
313		date: "Please enter a valid date.",
314		dateISO: "Please enter a valid date ( ISO ).",
315		number: "Please enter a valid number.",
316		digits: "Please enter only digits.",
317		alphanumeric: "Please enter only alphanumeric characters.",
318		creditcard: "Please enter a valid credit card number.",
319		equalTo: "Please enter the same value again.",
320		maxlength: $.validator.format( "Please enter no more than {0} characters." ),
321		minlength: $.validator.format( "Please enter at least {0} characters." ),
322		rangelength: $.validator.format( "Please enter a value between {0} and {1} characters long." ),
323		range: $.validator.format( "Please enter a value between {0} and {1}." ),
324		max: $.validator.format( "Please enter a value less than or equal to {0}." ),
325		min: $.validator.format( "Please enter a value greater than or equal to {0}." )
326	},
327
328	autoCreateRanges: false,
329
330	prototype: {
331
332		init: function() {
333			this.labelContainer = $( this.settings.errorLabelContainer );
334			this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm );
335			this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer );
336			this.submitted = {};
337			this.valueCache = {};
338			this.pendingRequest = 0;
339			this.pending = {};
340			this.invalid = {};
341			this.reset();
342
343			var groups = ( this.groups = {} ),
344				rules;
345			$.each( this.settings.groups, function( key, value ) {
346				if ( typeof value === "string" ) {
347					value = value.split( /\s/ );
348				}
349				$.each( value, function( index, name ) {
350					groups[ name ] = key;
351				});
352			});
353			rules = this.settings.rules;
354			$.each( rules, function( key, value ) {
355				rules[ key ] = $.validator.normalizeRule( value );
356			});
357
358			function delegate( event ) {
359				var validator = $.data( this[ 0 ].form, "validator" ),
360					eventType = "on" + event.type.replace( /^validate/, "" ),
361					settings = validator.settings;
362				if ( settings[ eventType ] && !this.is( settings.ignore ) ) {
363					settings[ eventType ].call( validator, this[ 0 ], event );
364				}
365			}
366			$( this.currentForm )
367				.validateDelegate( ":text, [type='password'], [type='file'], select, textarea, " +
368					"[type='number'], [type='search'] ,[type='tel'], [type='url'], " +
369					"[type='email'], [type='datetime'], [type='date'], [type='month'], " +
370					"[type='week'], [type='time'], [type='datetime-local'], " +
371					"[type='range'], [type='color'], [type='radio'], [type='checkbox']",
372					"focusin focusout keyup", delegate)
373				// Support: Chrome, oldIE
374				// "select" is provided as event.target when clicking a option
375				.validateDelegate("select, option, [type='radio'], [type='checkbox']", "click", delegate);
376
377			if ( this.settings.invalidHandler ) {
378				$( this.currentForm ).bind( "invalid-form.validate", this.settings.invalidHandler );
379			}
380
381			// Add aria-required to any Static/Data/Class required fields before first validation
382			// Screen readers require this attribute to be present before the initial submission http://www.w3.org/TR/WCAG-TECHS/ARIA2.html
383			$( this.currentForm ).find( "[required], [data-rule-required], .required" ).attr( "aria-required", "true" );
384		},
385
386		// http://jqueryvalidation.org/Validator.form/
387		form: function() {
388			this.checkForm();
389			$.extend( this.submitted, this.errorMap );
390			this.invalid = $.extend({}, this.errorMap );
391			if ( !this.valid() ) {
392				$( this.currentForm ).triggerHandler( "invalid-form", [ this ]);
393			}
394			this.showErrors();
395			return this.valid();
396		},
397
398		checkForm: function() {
399			this.prepareForm();
400			for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) {
401				this.check( elements[ i ] );
402			}
403			return this.valid();
404		},
405
406		// http://jqueryvalidation.org/Validator.element/
407		element: function( element ) {
408			var cleanElement = this.clean( element ),
409				checkElement = this.validationTargetFor( cleanElement ),
410				result = true;
411
412			this.lastElement = checkElement;
413
414			if ( checkElement === undefined ) {
415				delete this.invalid[ cleanElement.name ];
416			} else {
417				this.prepareElement( checkElement );
418				this.currentElements = $( checkElement );
419
420				result = this.check( checkElement ) !== false;
421				if ( result ) {
422					delete this.invalid[ checkElement.name ];
423				} else {
424					this.invalid[ checkElement.name ] = true;
425				}
426			}
427			// Add aria-invalid status for screen readers
428			$( element ).attr( "aria-invalid", !result );
429
430			if ( !this.numberOfInvalids() ) {
431				// Hide error containers on last error
432				this.toHide = this.toHide.add( this.containers );
433			}
434			this.showErrors();
435			return result;
436		},
437
438		// http://jqueryvalidation.org/Validator.showErrors/
439		showErrors: function( errors ) {
440			if ( errors ) {
441				// add items to error list and map
442				$.extend( this.errorMap, errors );
443				this.errorList = [];
444				for ( var name in errors ) {
445					this.errorList.push({
446						message: errors[ name ],
447						element: this.findByName( name )[ 0 ]
448					});
449				}
450				// remove items from success list
451				this.successList = $.grep( this.successList, function( element ) {
452					return !( element.name in errors );
453				});
454			}
455			if ( this.settings.showErrors ) {
456				this.settings.showErrors.call( this, this.errorMap, this.errorList );
457			} else {
458				this.defaultShowErrors();
459			}
460		},
461
462		// http://jqueryvalidation.org/Validator.resetForm/
463		resetForm: function() {
464			if ( $.fn.resetForm ) {
465				$( this.currentForm ).resetForm();
466			}
467			this.submitted = {};
468			this.lastElement = null;
469			this.prepareForm();
470			this.hideErrors();
471			this.elements()
472					.removeClass( this.settings.errorClass )
473					.removeData( "previousValue" )
474					.removeAttr( "aria-invalid" );
475		},
476
477		numberOfInvalids: function() {
478			return this.objectLength( this.invalid );
479		},
480
481		objectLength: function( obj ) {
482			/* jshint unused: false */
483			var count = 0,
484				i;
485			for ( i in obj ) {
486				count++;
487			}
488			return count;
489		},
490
491		hideErrors: function() {
492			this.hideThese( this.toHide );
493		},
494
495		hideThese: function( errors ) {
496			errors.not( this.containers ).text( "" );
497			this.addWrapper( errors ).hide();
498		},
499
500		valid: function() {
501			return this.size() === 0;
502		},
503
504		size: function() {
505			return this.errorList.length;
506		},
507
508		focusInvalid: function() {
509			if ( this.settings.focusInvalid ) {
510				try {
511					$(  /* this.findLastActive() || */  this.errorList.length && this.errorList[ 0 ].element || [])
512					.filter( ":visible" )
513					.focus()
514					// manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
515					/* .trigger( "focusin" ); */
516				} catch ( e ) {
517					// ignore IE throwing errors when focusing hidden elements
518				}
519			}
520		},
521
522 	/* 	findLastActive: function() {
523			var lastActive = this.lastActive;
524			return lastActive && $.grep( this.errorList, function( n ) {
525				return n.element.name === lastActive.name;
526			}).length === 1 && lastActive;
527		},  */
528
529		elements: function() {
530			var validator = this,
531				rulesCache = {};
532
533			// select all valid inputs inside the form (no submit or reset buttons)
534			return $( this.currentForm )
535			.find( "input, select, textarea" )
536			.not( ":submit, :reset, :image, [disabled]" )
537			.not( this.settings.ignore )
538			.filter( function() {
539				if ( !this.name && validator.settings.debug && window.console ) {
540					console.error( "%o has no name assigned", this );
541				}
542
543				// select only the first element for each name, and only those with rules specified
544				if ( this.name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
545					return false;
546				}
547
548				rulesCache[ this.name ] = true;
549				return true;
550			});
551		},
552
553		clean: function( selector ) {
554			return $( selector )[ 0 ];
555		},
556
557		errors: function() {
558			var errorClass = this.settings.labelErrorClass.split( " " ).join( "." );
559			return $( this.settings.errorElement + "." + errorClass, this.errorContext );
560		},
561
562		reset: function() {
563			this.successList = [];
564			this.errorList = [];
565			this.errorMap = {};
566			this.toShow = $( [] );
567			this.toHide = $( [] );
568			this.currentElements = $( [] );
569		},
570
571		prepareForm: function() {
572			this.reset();
573			this.toHide = this.errors().add( this.containers );
574		},
575
576		prepareElement: function( element ) {
577			this.reset();
578			this.toHide = this.errorsFor( element );
579		},
580
581		elementValue: function( element ) {
582			var val,
583				$element = $( element ),
584				type = element.type;
585
586			if ( type === "radio" || type === "checkbox" ) {
587				return $( "input[name='" + element.name + "']:checked" ).val();
588			} else if ( type === "number" && typeof element.validity !== "undefined" ) {
589				return element.validity.badInput ? false : $element.val();
590			}
591
592			val = $element.val();
593			if ( typeof val === "string" ) {
594				return val.replace(/\r/g, "" );
595			}
596			return val;
597		},
598
599		check: function( element ) {
600			element = this.validationTargetFor( this.clean( element ) );
601
602			var rules = $( element ).rules(),
603				rulesCount = $.map( rules, function( n, i ) {
604					return i;
605				}).length,
606				dependencyMismatch = false,
607				val = this.elementValue( element ),
608				result, method, rule;
609
610			for ( method in rules ) {
611				rule = { method: method, parameters: rules[ method ] };
612				try {
613
614					result = $.validator.methods[ method ].call( this, val, element, rule.parameters );
615
616					// if a method indicates that the field is optional and therefore valid,
617					// don't mark it as valid when there are no other rules
618					if ( result === "dependency-mismatch" && rulesCount === 1 ) {
619						dependencyMismatch = true;
620						continue;
621					}
622					dependencyMismatch = false;
623
624					if ( result === "pending" ) {
625						this.toHide = this.toHide.not( this.errorsFor( element ) );
626						return;
627					}
628
629					if ( !result ) {
630						this.formatAndAdd( element, rule );
631						return false;
632					}
633				} catch ( e ) {
634					if ( this.settings.debug && window.console ) {
635						console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
636					}
637					throw e;
638				}
639			}
640			if ( dependencyMismatch ) {
641				return;
642			}
643			if ( this.objectLength( rules ) ) {
644				this.successList.push( element );
645			}
646			return true;
647		},
648
649		// return the custom message for the given element and validation method
650		// specified in the element's HTML5 data attribute
651		// return the generic message if present and no method specific message is present
652		customDataMessage: function( element, method ) {
653			return $( element ).data( "msg" + method.charAt( 0 ).toUpperCase() +
654				method.substring( 1 ).toLowerCase() ) || $( element ).data( "msg" );
655		},
656
657		// return the custom message for the given element name and validation method
658		customMessage: function( name, method ) {
659			var m = this.settings.messages[ name ];
660			return m && ( m.constructor === String ? m : m[ method ]);
661		},
662
663		// return the first defined argument, allowing empty strings
664		findDefined: function() {
665			for ( var i = 0; i < arguments.length; i++) {
666				if ( arguments[ i ] !== undefined ) {
667					return arguments[ i ];
668				}
669			}
670			return undefined;
671		},
672
673		defaultMessage: function( element, method ) {
674			return this.findDefined(
675				this.customMessage( element.name, method ),
676				this.customDataMessage( element, method ),
677				// title is never undefined, so handle empty string as undefined
678				!this.settings.ignoreTitle && element.title || undefined,
679				$.validator.messages[ method ],
680				"<strong>Warning: No message defined for " + element.name + "</strong>"
681			);
682		},
683
684		formatAndAdd: function( element, rule ) {
685			var message = this.defaultMessage( element, rule.method ),
686				theregex = /\$?\{(\d+)\}/g;
687			if ( typeof message === "function" ) {
688				message = message.call( this, rule.parameters, element );
689			} else if ( theregex.test( message ) ) {
690				message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters );
691			}
692			this.errorList.push({
693				message: message,
694				element: element,
695				method: rule.method
696			});
697
698			this.errorMap[ element.name ] = message;
699			this.submitted[ element.name ] = message;
700		},
701
702		addWrapper: function( toToggle ) {
703			if ( this.settings.wrapper ) {
704				toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
705			}
706			return toToggle;
707		},
708
709		defaultShowErrors: function() {
710			var i, elements, error;
711			for ( i = 0; this.errorList[ i ]; i++ ) {
712				error = this.errorList[ i ];
713				if ( this.settings.highlight ) {
714					 this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.val
714idClass );
715				}
716				this.showLabel( error.element, error.message );
717				if ( this.checkable( error.element ) ) {
718					$( error.element ).parent().parent().parent().addClass( this.settings.errorClass );
719				}
720				else {
721					$( error.element ).parent().parent().addClass( this.settings.errorClass );
722				}
723				
724			}
725			if ( this.errorList.length ) {
726				this.toShow = this.toShow.add( this.containers );
727				
728			}
729			if ( this.settings.success ) {
730				for ( i = 0; this.successList[ i ]; i++ ) {
731					
732					this.showLabel( this.successList[ i ] );
733				}
734			}
735			if ( this.settings.unhighlight ) {
736				for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) {
737					this.settings.unhighlight.call( this, elements[ i ], this.errorClass, this.settings.validClass );
738					$( elements[ i ] ).parents().removeClass( this.settings.errorClass );
739				}
740			}
741			this.toHide = this.toHide.not( this.toShow );
742			this.hideErrors();
743			this.addWrapper( this.toShow ).show();
744		},
745
746		validElements: function() {
747			return this.currentElements.not( this.invalidElements() );
748		},
749
750		invalidElements: function() {
751			return $( this.errorList ).map(function() {
752				return this.element;
753			});
754		},
755
756		showLabel: function( element, message ) {
757			var place, group, errorID,
758				error = this.errorsFor( element ),
759				elementID = this.idOrName( element ),
760				describedBy = $( element ).attr( "aria-describedby" );
761
762			if ( error.length ) {
763				// refresh error/success class
764				error.removeClass( this.settings.validClass ).addClass( this.settings.labelErrorClass );
765				
766				// replace message on existing label
767				error.html( message );
768				
769			} else {
770				// create error element
771				error = $( "<" + this.settings.errorElement + ">" )
772					.attr( "id", elementID + "-error" )
773					.addClass( this.settings.labelErrorClass )
774					.html( message || "" );	
775					
776				
777				// Maintain reference to the element to be placed into the DOM
778				place = error;
779				if ( this.settings.wrapper ) {
780					// make sure the element is visible, even in IE
781					// actually showing the wrapped element is handled elsewhere
782					place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent();
783				}
784				if ( this.labelContainer.length ) {
785					this.labelContainer.append( place );
786				} else if ( this.settings.errorPlacement ) {
787					this.settings.errorPlacement( place, $( element ) );
788				} else {
789					/* place.insertAfter( $(element).nextAll('span:first') ); */
790					place.insertAfter( $(element) );
791				}
792
793				// Link error back to the element
794				if ( error.is( "label" ) ) {
795					// If the error is a label, then associate using 'for'
796					error.attr( "for", elementID );
797					
798				} else if ( error.parents( "label[for='" + elementID + "']" ).length === 0 ) {
799					// If the element is not a child of an associated label, then it's necessary
800					// to explicitly apply aria-describedby
801					
802					errorID = error.attr( "id" );
803					// Respect existing non-error aria-describedby
804					if ( !describedBy ) {
805						describedBy = errorID;
806					} else if ( !describedBy.match( new RegExp( "\b" + errorID + "\b" ) ) ) {
807						// Add to end of list if not already present
808						describedBy += " " + errorID;
809					}
810					$( element ).attr( "aria-describedby", describedBy );
811
812					// If this element is grouped, then assign to all elements in the same group
813					group = this.groups[ element.name ];
814					if ( group ) {
815						$.each( this.groups, function( name, testgroup ) {
816							if ( testgroup === group ) {
817								$( "[name='" + name + "']", this.currentForm )
818									.attr( "aria-describedby", error.attr( "id" ) );
819							}
820						});
821					}
822				} 
823			} 
824			
825			if ( !message && this.settings.success ) {
826				error.text( "" );
827				if ( typeof this.settings.success === "string" ) {
828					error.addClass( this.settings.success );
829				} else {
830					this.settings.success( error, element );					
831				}
832			}
833			this.toShow = this.toShow.add( error );
834		},
835
836		errorsFor: function( element ) {
837			var name = this.idOrName( element ),
838				describer = $( element ).attr( "aria-describedby" ),
839				selector = "label[for='" + name + "'], label[for='" + name + "'] *";
840			// aria-describedby should directly reference the error element
841			if ( describer ) {
842				selector = selector + ", #" + describer.replace( /\s+/g, ", #" );
843			}
844			return this
845				.errors()
846				.filter( selector );
847		},
848
849		idOrName: function( element ) {
850			return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.i
vendor: 7,244 bytes, lines 850-1101
850d || element.name );
851		},
852
853		validationTargetFor: function( element ) {
854			// if radio/checkbox, validate first element in group instead
855			if ( this.checkable( element ) ) {
856				element = this.findByName( element.name ).not( this.settings.ignore )[ 0 ];
857			}
858			return element;
859		},
860
861		checkable: function( element ) {
862			return ( /radio|checkbox/i ).test( element.type );
863		},
864
865		findByName: function( name ) {
866			return $( this.currentForm ).find( "[name='" + name + "']" );
867		},
868
869		getLength: function( value, element ) {
870			switch ( element.nodeName.toLowerCase() ) {
871			case "select":
872				return $( "option:selected", element ).length;
873			case "input":
874				if ( this.checkable( element ) ) {
875					return this.findByName( element.name ).filter( ":checked" ).length;
876				}
877			}
878			return value.length;
879		},
880
881		depend: function( param, element ) {
882			return this.dependTypes[typeof param] ? this.dependTypes[typeof param]( param, element ) : true;
883		},
884
885		dependTypes: {
886			"boolean": function( param ) {
887				return param;
888			},
889			"string": function( param, element ) {
890				return !!$( param, element.form ).length;
891			},
892			"function": function( param, element ) {
893				return param( element );
894			}
895		},
896
897		optional: function( element ) {
898			var val = this.elementValue( element );
899			return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch";
900		},
901
902		startRequest: function( element ) {
903			if ( !this.pending[ element.name ] ) {
904				this.pendingRequest++;
905				this.pending[ element.name ] = true;
906			}
907		},
908
909		stopRequest: function( element, valid ) {
910			this.pendingRequest--;
911			// sometimes synchronization fails, make sure pendingRequest is never < 0
912			if ( this.pendingRequest < 0 ) {
913				this.pendingRequest = 0;
914			}
915			delete this.pending[ element.name ];
916			if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
917				$( this.currentForm ).submit();
918				this.formSubmitted = false;
919			} else if (!valid && this.pendingRequest === 0 && this.formSubmitted ) {
920				$( this.currentForm ).triggerHandler( "invalid-form", [ this ]);
921				this.formSubmitted = false;
922			}
923		},
924
925		previousValue: function( element ) {
926			return $.data( element, "previousValue" ) || $.data( element, "previousValue", {
927				old: null,
928				valid: true,
929				message: this.defaultMessage( element, "remote" )
930			});
931		}
932
933	},
934
935	classRuleSettings: {
936		required: { required: true },
937		email: { email: true },
938		url: { url: true },
939		date: { date: true },
940		dateISO: { dateISO: true },
941		number: { number: true },
942		digits: { digits: true },
943		alphanumeric: {alphanumeric: true},
944		creditcard: { creditcard: true }
945	},
946
947	addClassRules: function( className, rules ) {
948		if ( className.constructor === String ) {
949			this.classRuleSettings[ className ] = rules;
950		} else {
951			$.extend( this.classRuleSettings, className );
952		}
953	},
954
955	classRules: function( element ) {
956		var rules = {},
957			classes = $( element ).attr( "class" );
958
959		if ( classes ) {
960			$.each( classes.split( " " ), function() {
961				if ( this in $.validator.classRuleSettings ) {
962					$.extend( rules, $.validator.classRuleSettings[ this ]);
963				}
964			});
965		}
966		return rules;
967	},
968
969	attributeRules: function( element ) {
970		var rules = {},
971			$element = $( element ),
972			type = element.getAttribute( "type" ),
973			method, value;
974
975		for ( method in $.validator.methods ) {
976
977			// support for <input required> in both html5 and older browsers
978			if ( method === "required" ) {
979				value = element.getAttribute( method );
980				// Some browsers return an empty string for the required attribute
981				// and non-HTML5 browsers might have required="" markup
982				if ( value === "" ) {
983					value = true;
984				}
985				// force non-HTML5 browsers to return bool
986				value = !!value;
987			} else {
988				value = $element.attr( method );
989			}
990
991			// convert the value to a number for number inputs, and for text for backwards compability
992			// allows type="date" and others to be compared as strings
993			if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
994				value = Number( value );
995			}
996
997			if ( value || value === 0 ) {
998				rules[ method ] = value;
999			} else if ( type === method && type !== "range" ) {
1000				// exception: the jquery validate 'range' method
1001				// does not test for the html5 'range' type
1002				rules[ method ] = true;
1003			}
1004		}
1005
1006		// maxlength may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
1007		if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) {
1008			delete rules.maxlength;
1009		}
1010
1011		return rules;
1012	},
1013
1014	dataRules: function( element ) {
1015		var method, value,
1016			rules = {}, $element = $( element );
1017		for ( method in $.validator.methods ) {
1018			value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() );
1019			if ( value !== undefined ) {
1020				rules[ method ] = value;
1021			}
1022		}
1023		return rules;
1024	},
1025
1026	staticRules: function( element ) {
1027		var rules = {},
1028			validator = $.data( element.form, "validator" );
1029
1030		if ( validator.settings.rules ) {
1031			rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {};
1032		}
1033		return rules;
1034	},
1035
1036	normalizeRules: function( rules, element ) {
1037		// handle dependency check
1038		$.each( rules, function( prop, val ) {
1039			// ignore rule when param is explicitly false, eg. required:false
1040			if ( val === false ) {
1041				delete rules[ prop ];
1042				return;
1043			}
1044			if ( val.param || val.depends ) {
1045				var keepRule = true;
1046				switch ( typeof val.depends ) {
1047				case "string":
1048					keepRule = !!$( val.depends, element.form ).length;
1049					break;
1050				case "function":
1051					keepRule = val.depends.call( element, element );
1052					break;
1053				}
1054				if ( keepRule ) {
1055					rules[ prop ] = val.param !== undefined ? val.param : true;
1056				} else {
1057					delete rules[ prop ];
1058				}
1059			}
1060		});
1061
1062		// evaluate parameters
1063		$.each( rules, function( rule, parameter ) {
1064			rules[ rule ] = $.isFunction( parameter ) ? parameter( element ) : parameter;
1065		});
1066
1067		// clean number parameters
1068		$.each([ "minlength", "maxlength" ], function() {
1069			if ( rules[ this ] ) {
1070				rules[ this ] = Number( rules[ this ] );
1071			}
1072		});
1073		$.each([ "rangelength", "range" ], function() {
1074			var parts;
1075			if ( rules[ this ] ) {
1076				if ( $.isArray( rules[ this ] ) ) {
1077					rules[ this ] = [ Number( rules[ this ][ 0 ]), Number( rules[ this ][ 1 ] ) ];
1078				} else if ( typeof rules[ this ] === "string" ) {
1079					parts = rules[ this ].replace(/[\[\]]/g, "" ).split( /[\s,]+/ );
1080					rules[ this ] = [ Number( parts[ 0 ]), Number( parts[ 1 ] ) ];
1081				}
1082			}
1083		});
1084
1085		if ( $.validator.autoCreateRanges ) {
1086			// auto-create ranges
1087			if ( rules.min && rules.max ) {
1088				rules.range = [ rules.min, rules.max ];
1089				delete rules.min;
1090				delete rules.max;
1091			}
1092			if ( rules.minlength && rules.maxlength ) {
1093				rules.rangelength = [ rules.minlength, rules.maxlength ];
1094				delete rules.minlength;
1095				delete rules.maxlength;
1096			}
1097		}
1098
1099		return rules;
1100	},
1101
1102	// Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
1103	normalizeRule: function( data ) {
1104		if ( typeof data === "string" ) {
1105			var transformed = {};
1106			$.each( data.split( /\s/ ), function() {
1107				transformed[ this ] = true;
1108			});
1109			data = transformed;
1110		}
1111		return data;
1112	},
1113
1114	// http://jqueryvalidation.org/jQuery.validator.addMethod/
1115	addMethod: function( name, method, message ) {
1116		$.validator.methods[ name ] = method;
1117		$.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ];
1118		if ( method.length < 3 ) {
1119			$.validator.addClassRules( name, $.validator.normalizeRule( name ) );
1120		}
1121	},
1122
1123	methods: {
1124		// http://jqueryvalidation.org/required-method/
1125		required: function( value, element, param ) {
1126			// check if dependency is met
1127			if ( !this.depend( param, element ) ) {
1128				return "dependency-mismatch";
1129			}
1130			if ( element.nodeName.toLowerCase() === "select" ) {
1131				// could be an array for select-multiple or a string, both are fine this way
1132				var val = $( element ).val();
1133				return val && val.length > 0;
1134			}
1135			if ( this.checkable( element ) ) {
1136				return this.getLength( value, element ) > 0;
1137			}
1138			return $.trim( value ).length > 0;
1139		},
1140
1141		// http://jqueryvalidation.org/email-method/
1142		email: function( value, element ) {
1143			// From http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#e-mail-state-%28type=email%29
1144			// Retrieved 2014-01-14
1145			// If you have a problem with this implementation, report a bug against the above spec
1146			// Or use custom methods to implement your own email validation
1147			return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
1148		},
1149
1150		// http://jqueryvalidation.org/url-method/
1151		url: function( value, element ) {
1152			// contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
1153			return this.optional( element ) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value );
1154		},
1155
1156		// http://jqueryvalidation.org/date-method/
1157		date: function( value, element ) {
1158			return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
1159		},
1160
1161		// http://jqueryvalidation.org/dateISO-method/
1162		dateISO: function( value, element ) {
1163			return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
1164		},
1165
1166		// http://jqueryvalidation.org/number-method/
1167		number: function( value, element ) {
1168			return this.optional( element ) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
1169		},
1170
1171		// http://jqueryvalidation.org/digits-method/
1172		digits: function( value, element ) {
1173			return this.optional( element ) || /^\d+$/.test( value );
1174		},
1175		
1176		alphanumeric: function( value, element) {
1177			return this.optional ( element ) || /[a-zA-Z0-9]+$/.test( value );
1178		},
1179
1180		// http://jqueryvalidation.org/creditcard-method/
1181		// based on http://en.wikipedia.org/wiki/Luhn/
1182		creditcard: function( value, element ) {
1183			if ( this.optional( element ) ) {
1184				return "dependency-mismatch";
1185			}
1186			// accept only spaces, digits and dashes
1187			if ( /[^0-9 \-]+/.test( value ) ) {
1188				return false;
1189			}
1190			var nCheck = 0,
1191				nDigit = 0,
1192				bEven = false,
1193				n, cDigit;
1194
1195			value = value.replace( /\D/g, "" );
1196
1197			// Basing min and max length on
1198			// http://developer.ean.com/general_info/Valid_Credit_Card_Types
1199			if ( value.length < 13 || value.length > 19 ) {
1200				return false;
1201			}
1202
1203			for ( n = value.length - 1; n >= 0; n--) {
1204				cDigit = value.charAt( n );
1205				nDigit = parseInt( cDigit, 10 );
1206				if ( bEven ) {
1207					if ( ( nDigit *= 2 ) > 9 ) {
1208						nDigit -= 9;
1209					}
1210				}
1211				nCheck += nDigit;
1212				bEven = !bEven;
1213			}
1214
1215			return ( nCheck % 10 ) === 0;
1216		},
1217
1218		// http://jqueryvalidation.org/minlength-method/
1219		minlength: function( value, element, param ) {
1220			var length = $.isArray( value ) ? value.length : this.getLength( $.trim( value ), element );
1221			return this.optional( element ) || length >= param;
1222		},
1223
1224		// http://jqueryvalidation.org/maxlength-method/
1225		maxlength: function( value, element, param ) {
1226			var length = $.isArray( value ) ? value.length : this.getLength( $.trim( value ), element );
1227			return this.optional( element ) || length <= param;
1228		},
1229
1230		// http://jqueryvalidation.org/rangelength-method/
1231		rangelength: function( value, element, param ) {
1232			var length = $.isArray( value ) ? value.length : this.getLength( $.trim( value ), element );
1233			return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
1234		},
1235
1236		// http://jqueryvalidation.org/min-method/
1237		min: function( value, element, param ) {
1238			return this.optional( element ) || value >= param;
1239		},
1240
1241		// http://jqueryvalidation.org/max-method/
1242		max: function( value, element, param ) {
1243			return this.optional( element ) || value <= param;
1244		},
1245
1246		// http://jqueryvalidation.org/range-method/
1247		range: function( value, element, param ) {
1248			return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
1249		},
1250
1251		// http://jqueryvalidation.org/equalTo-method/
1252		equalTo: function( value, element, param ) {
1253			// bind to the blur event of the target in order to revalidate whenever the target field is updated
1254			// TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
1255			var target = $( param );
1256			if ( this.settings.onfocusout ) {
1257				target.unbind( ".validate-equalTo" ).bind( "blur.validate-equalTo", function() {
1258					$( element ).valid();
1259				});
1260			}
1261			return value === target.val();
1262		},
1263
1264		// http://jqueryvalidation.org/remote-method/
1265		remote: function( value, element, param ) {
1266			if ( this.optional( element ) ) {
1267				return "dependency-mismatch";
1268			}
1269
1270			var previous = this.previousValue( element ),
1271				validator, data;
1272
1273			if (!this.settings.messages[ element.name ] ) {
1274				this.settings.messages[ element.name ] = {};
1275			}
1276			previous.originalMessage = this.settings.messages[ element.name ].remote;
1277			this.settings.messages[ element.name ].remote = previous.message;
1278
1279			param = typeof param === "string" && { url: param } || param;
1280
1281			if ( previous.old === value ) {
1282				return previous.valid;
1283			}
1284
1285			previous.old = value;
1286			validator = this;
1287			this.startRequest( element );
1288			data = {};
1289			data[ element.name ] = value;
1290			$.ajax( $.extend( true, {
1291				url: param,
1292				mode: "abort",
1293				port: "validate" + element.name,
1294				dataType: "json",
1295				data: data,
1296				context: validator.currentForm,
1297				success: function( response ) {
1298					var valid = response === true || response === "true",
1299						errors, message, submitted;
1300
1301					validator.settings.messages[ element.name ].remote = previous.originalMessage;
1302					if ( valid ) {
1303						submitted = validator.formSubmitted;
1304						validator.prepareElement( element );
1305						validator.formSubmitted = submitted;
1306						validator.successList.push( element );
1307						delete validator.invalid[ element.name ];
1308						validator.showErrors();
1309					} else {
1310						errors = {};
1311						message = response || validator.defaultMessage( element, "remote" );
1312						errors[ element.name ] = previous.message = $.isFunction( message ) ? message( value ) : message;
1313						validator.invalid[ element.name ] = true;
1314						validator.showErrors( errors );
1315					}
1316					previous.valid = valid;
1317					validator.stopRequest( element, valid );
1318				}
1319			}, param ) );
1320			return "pending";
1321		}
1322
1323	}
1324
1325});
1326
1327$.format = function deprecated() {
1328	throw "$.format has been deprecated. Please use $.validator.format instead.";
1329};
1330
1331// ajax mode: abort
1332// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
1333// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
1334
1335var pendingRequests = {},
1336	ajax;
1337// Use a prefilter if available (1.5+)
1338if ( $.ajaxPrefilter ) {
1339	$.ajaxPrefilter(function( settings, _, xhr ) {
1340		var port = settings.port;
1341		if ( settings.mode === "abort" ) {
1342			if ( pendingRequests[port] ) {
1343				pendingRequests[port].abort();
1344			}
1345			pendingRequests[port] = xhr;
1346		}
1347	});
1348} else {
1349	// Proxy ajax
1350	ajax = $.ajax;
1351	$.ajax = function( settings ) {
1352		var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
1353			port = ( "port" in settings ? settings : $.ajaxSettings ).port;
1354		if ( mode === "abort" ) {
1355			if ( pendingRequests[port] ) {
1356				pendingRequests[port].abort();
1357			}
1358			pendingRequests[port] = ajax.apply(this, arguments);
1359			return pendingRequests[port];
1360		}
1361		return ajax.apply(this, arguments);
1362	};
1363}
1364
1365// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
1366// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
1367
1368$.extend($.fn, {
1369	validateDelegate: function( delegate, type, handler ) {
1370		return this.bind(type, function( event ) {
1371			var target = $(event.target);
1372			if ( target.is(delegate) ) {
1373				return handler.apply(target, arguments);
1374			}
1375		});
1376	}
1377});
1378
1379}));

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.