PageSourceSearch

https://sendgiftpakistan.com/blog/wp-content/themes/WCM010013/js/megnor/jquery.validate.js?ver=6.0.16

js sendgiftpakistan.com collected 2026-10-02 07:10:45 UTC 39,333 bytes, 1,087 lines download raw bytes

1/**
2 * jQuery Validation Plugin 1.11.0pre
3 *
4 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
5 * http://docs.jquery.com/Plugins/Validation
6 *
7 * Copyright 2013 Jörn Zaefferer
8 * Released under the MIT license:
9 *   http://www.opensource.org/licenses/mit-license.php
10 */
11(function($) {
12$.extend($.fn, {
13	// http://docs.jquery.com/Plugins/Validation/validate
14	validate: function( options ) {
15		// if nothing is selected, return nothing; can't chain anyway
16		if ( !this.length ) {
17			if ( options && options.debug && window.console ) {
18				console.warn( "Nothing selected, can't validate, returning nothing." );
19			}
20			return;
21		}
22		// check if a validator for this form was already created
23		var validator = $.data( this[0], "validator" );
24		if ( validator ) {
25			return validator;
26		}
27		// Add novalidate tag if HTML5.
28		this.attr( "novalidate", "novalidate" );
29		validator = new $.validator( options, this[0] );
30		$.data( this[0], "validator", validator );
31		if ( validator.settings.onsubmit ) {
32			this.validateDelegate( ":submit", "click", function( event ) {
33				if ( validator.settings.submitHandler ) {
34					validator.submitButton = event.target;
35				}
36				// allow suppressing validation by adding a cancel class to the submit button
37				if ( $(event.target).hasClass("cancel") ) {
38					validator.cancelSubmit = true;
39				}
40			});
41			// validate the form on submit
42			this.submit( function( event ) {
43				if ( validator.settings.debug ) {
44					// prevent form submit to be able to see console output
45					event.preventDefault();
46				}
47				function handle() {
48					var hidden;
49					if ( validator.settings.submitHandler ) {
50						if ( validator.submitButton ) {
51							// insert a hidden input as a replacement for the missing submit button
52							hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);
53						}
54						validator.settings.submitHandler.call( validator, validator.currentForm, event );
55						if ( validator.submitButton ) {
56							// and clean up afterwards; thanks to no-block-scope, hidden can be referenced
57							hidden.remove();
58						}
59						return false;
60					}
61					return true;
62				}
63				// prevent submit for invalid forms or custom submit handlers
64				if ( validator.cancelSubmit ) {
65					validator.cancelSubmit = false;
66					return handle();
67				}
68				if ( validator.form() ) {
69					if ( validator.pendingRequest ) {
70						validator.formSubmitted = true;
71						return false;
72					}
73					return handle();
74				} else {
75					validator.focusInvalid();
76					return false;
77				}
78			});
79		}
80		return validator;
81	},
82	// http://docs.jquery.com/Plugins/Validation/valid
83	valid: function() {
84		if ( $(this[0]).is("form")) {
85			return this.validate().form();
86		} else {
87			var valid = true;
88			var validator = $(this[0].form).validate();
89			this.each(function() {
90				valid &= validator.element(this);
91			});
92			return valid;
93		}
94	},
95	// attributes: space seperated list of attributes to retrieve and remove
96	removeAttrs: function( attributes ) {
97		var result = {},
98			$element = this;
99		$.each(attributes.split(/\s/), function( index, value ) {
100			result[value] = $element.attr(value);
101			$element.removeAttr(value);
102		});
103		return result;
104	},
105	// http://docs.jquery.com/Plugins/Validation/rules
106	rules: function( command, argument ) {
107		var element = this[0];
108		if ( command ) {
109			var settings = $.data(element.form, "validator").settings;
110			var staticRules = settings.rules;
111			var existingRules = $.validator.staticRules(element);
112			switch(command) {
113			case "add":
114				$.extend(existingRules, $.validator.normalizeRule(argument));
115				staticRules[element.name] = existingRules;
116				if ( argument.messages ) {
117					settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
118				}
119				break;
120			case "remove":
121				if ( !argument ) {
122					delete staticRules[element.name];
123					return existingRules;
124				}
125				var filtered = {};
126				$.each(argument.split(/\s/), function( index, method ) {
127					filtered[method] = existingRules[method];
128					delete existingRules[method];
129				});
130				return filtered;
131			}
132		}
133		var data = $.validator.normalizeRules(
134		$.extend(
135			{},
136			$.validator.classRules(element),
137			$.validator.attributeRules(element),
138			$.validator.dataRules(element),
139			$.validator.staticRules(element)
140		), element);
141		// make sure required is at front
142		if ( data.required ) {
143			var param = data.required;
144			delete data.required;
145			data = $.extend({required: param}, data);
146		}
147		return data;
148	}
149});
150// Custom selectors
151$.extend($.expr[":"], {
152	// http://docs.jquery.com/Plugins/Validation/blank
153	blank: function( a ) { return !$.trim("" + a.value); },
154	// http://docs.jquery.com/Plugins/Validation/filled
155	filled: function( a ) { return !!$.trim("" + a.value); },
156	// http://docs.jquery.com/Plugins/Validation/unchecked
157	unchecked: function( a ) { return !a.checked; }
158});
159// constructor for validator
160$.validator = function( options, form ) {
161	this.settings = $.extend( true, {}, $.validator.defaults, options );
162	this.currentForm = form;
163	this.init();
164};
165$.validator.format = function( source, params ) {
166	if ( arguments.length === 1 ) {
167		return function() {
168			var args = $.makeArray(arguments);
169			args.unshift(source);
170			return $.validator.format.apply( this, args );
171		};
172	}
173	if ( arguments.length > 2 && params.constructor !== Array  ) {
174		params = $.makeArray(arguments).slice(1);
175	}
176	if ( params.constructor !== Array ) {
177		params = [ params ];
178	}
179	$.each(params, function( i, n ) {
180		source = source.replace( new RegExp("\\{" + i + "\\}", "g"), function() {
181			return n;
182		});
183	});
184	return source;
185};
186$.extend($.validator, {
187	defaults: {
188		messages: {},
189		groups: {},
190		rules: {},
191		errorClass: "error",
192		validClass: "valid",
193		errorElement: "label",
194		focusInvalid: true,
195		errorContainer: $([]),
196		errorLabelContainer: $([]),
197		onsubmit: true,
198		ignore: ":hidden",
199		ignoreTitle: false,
200		onfocusin: function( element, event ) {
201			this.lastActive = element;
202			// hide error label and remove error class on focus if enabled
203			if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
204				if ( this.settings.unhighlight ) {
205					this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.val
205idClass );
206				}
207				this.addWrapper(this.errorsFor(element)).hide();
208			}
209		},
210		onfocusout: function( element, event ) {
211			if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
212				this.element(element);
213			}
214		},
215		onkeyup: function( element, event ) {
216			if ( event.which === 9 && this.elementValue(element) === "" ) {
217				return;
218			} else if ( element.name in this.submitted || element === this.lastElement ) {
219				this.element(element);
220			}
221		},
222		onclick: function( element, event ) {
223			// click on selects, radiobuttons and checkboxes
224			if ( element.name in this.submitted ) {
225				this.element(element);
226			}
227			// or option elements, check parent select in that case
228			else if ( element.parentNode.name in this.submitted ) {
229				this.element(element.parentNode);
230			}
231		},
232		highlight: function( element, errorClass, validClass ) {
233			if ( element.type === "radio" ) {
234				this.findByName(element.name).addClass(errorClass).removeClass(validClass);
235			} else {
236				$(element).addClass(errorClass).removeClass(validClass);
237			}
238		},
239		unhighlight: function( element, errorClass, validClass ) {
240			if ( element.type === "radio" ) {
241				this.findByName(element.name).removeClass(errorClass).addClass(validClass);
242			} else {
243				$(element).removeClass(errorClass).addClass(validClass);
244			}
245		}
246	},
247	// http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
248	setDefaults: function( settings ) {
249		$.extend( $.validator.defaults, settings );
250	},
251	messages: {
252		required: "This field is required.",
253		remote: "Please fix this field.",
254		email: "Please enter a valid email address.",
255		url: "Please enter a valid URL.",
256		date: "Please enter a valid date.",
257		dateISO: "Please enter a valid date (ISO).",
258		number: "Please enter a valid number.",
259		digits: "Please enter only digits.",
260		creditcard: "Please enter a valid credit card number.",
261		equalTo: "Please enter the same value again.",
262		maxlength: $.validator.format("Please enter no more than {0} characters."),
263		minlength: $.validator.format("Please enter at least {0} characters."),
264		rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
265		range: $.validator.format("Please enter a value between {0} and {1}."),
266		max: $.validator.format("Please enter a value less than or equal to {0}."),
267		min: $.validator.format("Please enter a value greater than or equal to {0}.")
268	},
269	autoCreateRanges: false,
270	prototype: {
271		init: function() {
272			this.labelContainer = $(this.settings.errorLabelContainer);
273			this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
274			this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
275			this.submitted = {};
276			this.valueCache = {};
277			this.pendingRequest = 0;
278			this.pending = {};
279			this.invalid = {};
280			this.reset();
281			var groups = (this.groups = {});
282			$.each(this.settings.groups, function( key, value ) {
283				if ( typeof value === "string" ) {
284					value = value.split(/\s/);
285				}
286				$.each(value, function( index, name ) {
287					groups[name] = key;
288				});
289			});
290			var rules = this.settings.rules;
291			$.each(rules, function( key, value ) {
292				rules[key] = $.validator.normalizeRule(value);
293			});
294			function delegate(event) {
295				var validator = $.data(this[0].form, "validator"),
296					eventType = "on" + event.type.replace(/^validate/, "");
297				if ( validator.settings[eventType] ) {
298					validator.settings[eventType].call(validator, this[0], event);
299				}
300			}
301			$(this.currentForm)
302				.validateDelegate(":text, [type='password'], [type='file'], select, textarea, " +
303					"[type='number'], [type='search'] ,[type='tel'], [type='url'], " +
304					"[type='email'], [type='datetime'], [type='date'], [type='month'], " +
305					"[type='week'], [type='time'], [type='datetime-local'], " +
306					"[type='range'], [type='color'] ",
307					"focusin focusout keyup", delegate)
308				.validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate);
309			if ( this.settings.invalidHandler ) {
310				$(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
311			}
312		},
313		// http://docs.jquery.com/Plugins/Validation/Validator/form
314		form: function() {
315			this.checkForm();
316			$.extend(this.submitted, this.errorMap);
317			this.invalid = $.extend({}, this.errorMap);
318			if ( !this.valid() ) {
319				$(this.currentForm).triggerHandler("invalid-form", [this]);
320			}
321			this.showErrors();
322			return this.valid();
323		},
324		checkForm: function() {
325			this.prepareForm();
326			for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
327				this.check( elements[i] );
328			}
329			return this.valid();
330		},
331		// http://docs.jquery.com/Plugins/Validation/Validator/element
332		element: function( element ) {
333			element = this.validationTargetFor( this.clean( element ) );
334			this.lastElement = element;
335			this.prepareElement( element );
336			this.currentElements = $(element);
337			var result = this.check( element ) !== false;
338			if ( result ) {
339				delete this.invalid[element.name];
340			} else {
341				this.invalid[element.name] = true;
342			}
343			if ( !this.numberOfInvalids() ) {
344				// Hide error containers on last error
345				this.toHide = this.toHide.add( this.containers );
346			}
347			this.showErrors();
348			return result;
349		},
350		// http://docs.jquery.com/Plugins/Validation/Validator/showErrors
351		showErrors: function( errors ) {
352			if ( errors ) {
353				// add items to error list and map
354				$.extend( this.errorMap, errors );
355				this.errorList = [];
356				for ( var name in errors ) {
357					this.errorList.push({
358						message: errors[name],
359						element: this.findByName(name)[0]
360					});
361				}
362				// remove items from success list
363				this.successList = $.grep( this.successList, function( element ) {
364					return !(element.name in errors);
365				});
366			}
367			if ( this.settings.showErrors ) {
368				this.settings.showErrors.call( this, this.errorMap, this.errorList );
369			} else {
370				this.defaultShowErrors();
371			}
372		},
373		// http://docs.jquery.com/Plugins/Validation/Validator/resetForm
374		resetForm: function() {
375			if ( $.fn.resetForm ) {
376				$(this.currentForm).resetForm();
377			}
378			this.submitted = {};
379			this.lastElement = null;
380			this.prepareForm();
381			this.hideErrors();
382			this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" );
383		},
384		numberOfInvalids: function() {
385			return this.objectLength(this.invalid);
386		},
387		objectLength: function( obj ) {
388			var count = 0;
389			for ( var i in obj ) {
390				count++;
391			}
392			return count;
393		},
394		hideErrors: function() {
395			this.addWrapper( this.toHide ).hide();
396		},
397		valid: function() {
398			return this.size() === 0;
399		},
400		size: function() {
401			return this.errorList.length;
402		},
403		focusInvalid: function() {
404			if ( this.settings.focusInvalid ) {
405				try {
406					$(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])
407					.filter(":visible")
408					.focus()
409					// manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
410					.trigger("focusin");
411				} catch(e) {
412					// ignore IE throwing errors when focusing hidden elements
413				}
414			}
415		},
416		findLastActive: function() {
417			var lastActive = this.lastActive;
418			return lastActive && $.grep(this.errorList, function( n ) {
419				return n.element.name === lastActive.name;
420			}).length === 1 && lastActive;
421		},
422		elements: function() {
423			var validator = this,
424				rulesCache = {};
425			// select all valid inputs inside the form (no submit or reset buttons)
426			return $(this.currentForm)
427			.find("input, select, textarea")
428			.not(":submit, :reset, :image, [disabled]")
429			.not( this.settings.ignore )
430			.filter(function() {
431				if ( !this.name ) {
432					if ( window.console ) {
433						console.error( "%o has no name assigned", this );
434					}
435					throw new Error( "Failed to validate, found an element with no name assigned. See console for element reference." );
436				}
437				// select only the first element for each name, and only those with rules specified
438				if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) {
439					return false;
440				}
441				rulesCache[this.name] = true;
442				return true;
443			});
444		},
445		clean: function( selector ) {
446			return $(selector)[0];
447		},
448		errors: function() {
449			var errorClass = this.settings.errorClass.replace(" ", ".");
450			return $(this.settings.errorElement + "." + errorClass, this.errorContext);
451		},
452		reset: function() {
453			this.successList = [];
454			this.errorList = [];
455			this.errorMap = {};
456			this.toShow = $([]);
457			this.toHide = $([]);
458			this.currentElements = $([]);
459		},
460		prepareForm: function() {
461			this.reset();
462			this.toHide = this.errors().add( this.containers );
463		},
464		prepareElement: function( element ) {
465			this.reset();
466			this.toHide = this.errorsFor(element);
467		},
468		elementValue: function( element ) {
469			var type = $(element).attr("type"),
470				val = $(element).val();
471			if ( type === "radio" || type === "checkbox" ) {
472				return $("input[name='" + $(element).attr("name") + "']:checked").val();
473			}
474			if ( typeof val === "string" ) {
475				return val.replace(/\r/g, "");
476			}
477			return val;
478		},
479		check: function( element ) {
480			element = this.validationTargetFor( this.clean( element ) );
481			var rules = $(element).rules();
482			var dependencyMismatch = false;
483			var val = this.elementValue(element);
484			var result;
485			for (var method in rules ) {
486				var rule = { method: method, parameters: rules[method] };
487				try {
488					result = $.validator.methods[method].call( this, val, element, rule.parameters );
489					// if a method indicates that the field is optional and therefore valid,
490					// don't mark it as valid when there are no other rules
491					if ( result === "dependency-mismatch" ) {
492						dependencyMismatch = true;
493						continue;
494					}
495					dependencyMismatch = false;
496					if ( result === "pending" ) {
497						this.toHide = this.toHide.not( this.errorsFor(element) );
498						return;
499					}
500					if ( !result ) {
501						this.formatAndAdd( element, rule );
502						return false;
503					}
504				} catch(e) {
505					if ( this.settings.debug && window.console ) {
506						console.log( "Exception occured when checking element " + element.i
506d + ", check the '" + rule.method + "' method.", e );
507					}
508					throw e;
509				}
510			}
511			if ( dependencyMismatch ) {
512				return;
513			}
514			if ( this.objectLength(rules) ) {
515				this.successList.push(element);
516			}
517			return true;
518		},
519		// return the custom message for the given element and validation method
520		// specified in the element's HTML5 data attribute
521		customDataMessage: function( element, method ) {
522			return $(element).data("msg-" + method.toLowerCase()) || (element.attributes && $(element).attr("data-msg-" + method.toLowerCase()));
523		},
524		// return the custom message for the given element name and validation method
525		customMessage: function( name, method ) {
526			var m = this.settings.messages[name];
527			return m && (m.constructor === String ? m : m[method]);
528		},
529		// return the first defined argument, allowing empty strings
530		findDefined: function() {
531			for(var i = 0; i < arguments.length; i++) {
532				if ( arguments[i] !== undefined ) {
533					return arguments[i];
534				}
535			}
536			return undefined;
537		},
538		defaultMessage: function( element, method ) {
539			return this.findDefined(
540				this.customMessage( element.name, method ),
541				this.customDataMessage( element, method ),
542				// title is never undefined, so handle empty string as undefined
543				!this.settings.ignoreTitle && element.title || undefined,
544				$.validator.messages[method],
545				"<strong>Warning: No message defined for " + element.name + "</strong>"
546			);
547		},
548		formatAndAdd: function( element, rule ) {
549			var message = this.defaultMessage( element, rule.method ),
550				theregex = /\$?\{(\d+)\}/g;
551			if ( typeof message === "function" ) {
552				message = message.call(this, rule.parameters, element);
553			} else if (theregex.test(message)) {
554				message = $.validator.format(message.replace(theregex, "{$1}"), rule.parameters);
555			}
556			this.errorList.push({
557				message: message,
558				element: element
559			});
560			this.errorMap[element.name] = message;
561			this.submitted[element.name] = message;
562		},
563		addWrapper: function( toToggle ) {
564			if ( this.settings.wrapper ) {
565				toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
566			}
567			return toToggle;
568		},
569		defaultShowErrors: function() {
570			var i, elements;
571			for ( i = 0; this.errorList[i]; i++ ) {
572				var error = this.errorList[i];
573				if ( this.settings.highlight ) {
574					this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
575				}
576				this.showLabel( error.element, error.message );
577			}
578			if ( this.errorList.length ) {
579				this.toShow = this.toShow.add( this.containers );
580			}
581			if ( this.settings.success ) {
582				for ( i = 0; this.successList[i]; i++ ) {
583					this.showLabel( this.successList[i] );
584				}
585			}
586			if ( this.settings.unhighlight ) {
587				for ( i = 0, elements = this.validElements(); elements[i]; i++ ) {
588					this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
589				}
590			}
591			this.toHide = this.toHide.not( this.toShow );
592			this.hideErrors();
593			this.addWrapper( this.toShow ).show();
594		},
595		validElements: function() {
596			return this.currentElements.not(this.invalidElements());
597		},
598		invalidElements: function() {
599			return $(this.errorList).map(function() {
600				return this.element;
601			});
602		},
603		showLabel: function( element, message ) {
604			var label = this.errorsFor( element );
605			if ( label.length ) {
606				// refresh error/success class
607				label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
608				// check if we have a generated label, replace the message then
609				if ( label.attr("generated") ) {
610					label.html(message);
611				}
612			} else {
613				// create label
614				label = $("<" + this.settings.errorElement + "/>")
615					.attr({"for":  this.idOrName(element), generated: true})
616					.addClass(this.settings.errorClass)
617					.html(message || "");
618				if ( this.settings.wrapper ) {
619					// make sure the element is visible, even in IE
620					// actually showing the wrapped element is handled elsewhere
621					label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
622				}
623				if ( !this.labelContainer.append(label).length ) {
624					if ( this.settings.errorPlacement ) {
625						this.settings.errorPlacement(label, $(element) );
626					} else {
627						label.insertAfter(element);
628					}
629				}
630			}
631			if ( !message && this.settings.success ) {
632				label.text("");
633				if ( typeof this.settings.success === "string" ) {
634					label.addClass( this.settings.success );
635				} else {
636					this.settings.success( label, element );
637				}
638			}
639			this.toShow = this.toShow.add(label);
640		},
641		errorsFor: function( element ) {
642			var name = this.idOrName(element);
643			return this.errors().filter(function() {
644				return $(this).attr("for") === name;
645			});
646		},
647		idOrName: function( element ) {
648			return this.groups[element.name] || (this.checkable(element) ? element.name : element.i
648d || element.name);
649		},
650		validationTargetFor: function( element ) {
651			// if radio/checkbox, validate first element in group instead
652			if ( this.checkable(element) ) {
653				element = this.findByName( element.name ).not(this.settings.ignore)[0];
654			}
655			return element;
656		},
657		checkable: function( element ) {
658			return (/radio|checkbox/i).test(element.type);
659		},
660		findByName: function( name ) {
661			return $(this.currentForm).find("[name='" + name + "']");
662		},
663		getLength: function( value, element ) {
664			switch( element.nodeName.toLowerCase() ) {
665			case "select":
666				return $("option:selected", element).length;
667			case "input":
668				if ( this.checkable( element) ) {
669					return this.findByName(element.name).filter(":checked").length;
670				}
671			}
672			return value.length;
673		},
674		depend: function( param, element ) {
675			return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true;
676		},
677		dependTypes: {
678			"boolean": function( param, element ) {
679				return param;
680			},
681			"string": function( param, element ) {
682				return !!$(param, element.form).length;
683			},
684			"function": function( param, element ) {
685				return param(element);
686			}
687		},
688		optional: function( element ) {
689			var val = this.elementValue(element);
690			return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch";
691		},
692		startRequest: function( element ) {
693			if ( !this.pending[element.name] ) {
694				this.pendingRequest++;
695				this.pending[element.name] = true;
696			}
697		},
698		stopRequest: function( element, valid ) {
699			this.pendingRequest--;
700			// sometimes synchronization fails, make sure pendingRequest is never < 0
701			if ( this.pendingRequest < 0 ) {
702				this.pendingRequest = 0;
703			}
704			delete this.pending[element.name];
705			if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
706				$(this.currentForm).submit();
707				this.formSubmitted = false;
708			} else if (!valid && this.pendingRequest === 0 && this.formSubmitted) {
709				$(this.currentForm).triggerHandler("invalid-form", [this]);
710				this.formSubmitted = false;
711			}
712		},
713		previousValue: function( element ) {
714			return $.data(element, "previousValue") || $.data(element, "previousValue", {
715				old: null,
716				valid: true,
717				message: this.defaultMessage( element, "remote" )
718			});
719		}
720	},
721	classRuleSettings: {
722		required: {required: true},
723		email: {email: true},
724		url: {url: true},
725		date: {date: true},
726		dateISO: {dateISO: true},
727		number: {number: true},
728		digits: {digits: true},
729		creditcard: {creditcard: true}
730	},
731	addClassRules: function( className, rules ) {
732		if ( className.constructor === String ) {
733			this.classRuleSettings[className] = rules;
734		} else {
735			$.extend(this.classRuleSettings, className);
736		}
737	},
738	classRules: function( element ) {
739		var rules = {};
740		var classes = $(element).attr("class");
741		if ( classes ) {
742			$.each(classes.split(" "), function() {
743				if ( this in $.validator.classRuleSettings ) {
744					$.extend(rules, $.validator.classRuleSettings[this]);
745				}
746			});
747		}
748		return rules;
749	},
750	attributeRules: function( element ) {
751		var rules = {};
752		var $element = $(element);
753		for (var method in $.validator.methods) {
754			var value;
755			// support for <input required> in both html5 and older browsers
756			if ( method === "required" ) {
757				value = $element.get(0).getAttribute(method);
758				// Some browsers return an empty string for the required attribute
759				// and non-HTML5 browsers might have required="" markup
760				if ( value === "" ) {
761					value = true;
762				}
763				// force non-HTML5 browsers to return bool
764				value = !!value;
765			} else {
766				value = $element.attr(method);
767			}
768			if ( value ) {
769				rules[method] = value;
770			} else if ( $element[0].getAttribute("type") === method ) {
771				rules[method] = true;
772			}
773		}
774		// maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
775		if ( rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength) ) {
776			delete rules.maxlength;
777		}
778		return rules;
779	},
780	dataRules: function( element ) {
781		var method, value,
782			rules = {}, $element = $(element);
783		for (method in $.validator.methods) {
784			value = $element.data("rule-" + method.toLowerCase());
785			if ( value !== undefined ) {
786				rules[method] = value;
787			}
788		}
789		return rules;
790	},
791	staticRules: function( element ) {
792		var rules = {};
793		var validator = $.data(element.form, "validator");
794		if ( validator.settings.rules ) {
795			rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
796		}
797		return rules;
798	},
799	normalizeRules: function( rules, element ) {
800		// handle dependency check
801		$.each(rules, function( prop, val ) {
802			// ignore rule when param is explicitly false, eg. required:false
803			if ( val === false ) {
804				delete rules[prop];
805				return;
806			}
807			if ( val.param || val.depends ) {
808				var keepRule = true;
809				switch (typeof val.depends) {
810				case "string":
811					keepRule = !!$(val.depends, element.form).length;
812					break;
813				case "function":
814					keepRule = val.depends.call(element, element);
815					break;
816				}
817				if ( keepRule ) {
818					rules[prop] = val.param !== undefined ? val.param : true;
819				} else {
820					delete rules[prop];
821				}
822			}
823		});
824		// evaluate parameters
825		$.each(rules, function( rule, parameter ) {
826			rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
827		});
828		// clean number parameters
829		$.each(["minlength", "maxlength", "min", "max"], function() {
830			if ( rules[this] ) {
831				rules[this] = Number(rules[this]);
832			}
833		});
834		$.each(["rangelength", "range"], function() {
835			var parts;
836			if ( rules[this] ) {
837				if ( $.isArray(rules[this]) ) {
838					rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
839				} else if ( typeof rules[this] === "string" ) {
840					parts = rules[this].split(/[\s,]+/);
841					rules[this] = [Number(parts[0]), Number(parts[1])];
842				}
843			}
844		});
845		if ( $.validator.autoCreateRanges ) {
846			// auto-create ranges
847			if ( rules.min && rules.max ) {
848				rules.range = [rules.min, rules.max];
849				delete rules.min;
850				delete rules.max;
851			}
852			if ( rules.minlength && rules.maxlength ) {
853				rules.rangelength = [rules.minlength, rules.maxlength];
854				delete rules.minlength;
855				delete rules.maxlength;
856			}
857		}
858		return rules;
859	},
860	// Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
861	normalizeRule: function( data ) {
862		if ( typeof data === "string" ) {
863			var transformed = {};
864			$.each(data.split(/\s/), function() {
865				transformed[this] = true;
866			});
867			data = transformed;
868		}
869		return data;
870	},
871	// http://docs.jquery.com/Plugins/Validation/Validator/addMethod
872	addMethod: function( name, method, message ) {
873		$.validator.methods[name] = method;
874		$.validator.messages[name] = message !== undefined ? message : $.validator.messages[name];
875		if ( method.length < 3 ) {
876			$.validator.addClassRules(name, $.validator.normalizeRule(name));
877		}
878	},
879	methods: {
880		// http://docs.jquery.com/Plugins/Validation/Methods/required
881		required: function( value, element, param ) {
882			// check if dependency is met
883			if ( !this.depend(param, element) ) {
884				return "dependency-mismatch";
885			}
886			if ( element.nodeName.toLowerCase() === "select" ) {
887				// could be an array for select-multiple or a string, both are fine this way
888				var val = $(element).val();
889				return val && val.length > 0;
890			}
891			if ( this.checkable(element) ) {
892				return this.getLength(value, element) > 0;
893			}
894			return $.trim(value).length > 0;
895		},
896		// http://docs.jquery.com/Plugins/Validation/Methods/remote
897		remote: function( value, element, param ) {
898			if ( this.optional(element) ) {
899				return "dependency-mismatch";
900			}
901			var previous = this.previousValue(element);
902			if (!this.settings.messages[element.name] ) {
903				this.settings.messages[element.name] = {};
904			}
905			previous.originalMessage = this.settings.messages[element.name].remote;
906			this.settings.messages[element.name].remote = previous.message;
907			param = typeof param === "string" && {url:param} || param;
908			if ( previous.old === value ) {
909				return previous.valid;
910			}
911			previous.old = value;
912			var validator = this;
913			this.startRequest(element);
914			var data = {};
915			data[element.name] = value;
916			$.ajax($.extend(true, {
917				url: param,
918				mode: "abort",
919				port: "validate" + element.name,
920				dataType: "json",
921				data: data,
922				success: function( response ) {
923					validator.settings.messages[element.name].remote = previous.originalMessage;
924					var valid = response === true || response === "true";
925					if ( valid ) {
926						var submitted = validator.formSubmitted;
927						validator.prepareElement(element);
928						validator.formSubmitted = submitted;
929						validator.successList.push(element);
930						delete validator.invalid[element.name];
931						validator.showErrors();
932					} else {
933						var errors = {};
934						var message = response || validator.defaultMessage( element, "remote" );
935						errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
936						validator.invalid[element.name] = true;
937						validator.showErrors(errors);
938					}
939					previous.valid = valid;
940					validator.stopRequest(element, valid);
941				}
942			}, param));
943			return "pending";
944		},
945		// http://docs.jquery.com/Plugins/Validation/Methods/minlength
946		minlength: function( value, element, param ) {
947			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
948			return this.optional(element) || length >= param;
949		},
950		// http://docs.jquery.com/Plugins/Validation/Methods/maxlength
951		maxlength: function( value, element, param ) {
952			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
953			return this.optional(element) || length <= param;
954		},
955		// http://docs.jquery.com/Plugins/Validation/Methods/rangelength
956		rangelength: function( value, element, param ) {
957			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
958			return this.optional(element) || ( length >= param[0] && length <= param[1] );
959		},
960		// http://docs.jquery.com/Plugins/Validation/Methods/min
961		min: function( value, element, param ) {
962			return this.optional(element) || value >= param;
963		},
964		// http://docs.jquery.com/Plugins/Validation/Methods/max
965		max: function( value, element, param ) {
966			return this.optional(element) || value <= param;
967		},
968		// http://docs.jquery.com/Plugins/Validation/Methods/range
969		range: function( value, element, param ) {
970			return this.optional(element) || ( value >= param[0] && value <= param[1] );
971		},
972		// http://docs.jquery.com/Plugins/Validation/Methods/email
973		email: function( value, element ) {
974			// contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
975			return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([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])))$/i.test(value);
976		},
977		// http://docs.jquery.com/Plugins/Validation/Methods/url
978		url: function( value, element ) {
979			// contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
980			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);
981		},
982		// http://docs.jquery.com/Plugins/Validation/Methods/date
983		date: function( value, element ) {
984			return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString());
985		},
986		// http://docs.jquery.com/Plugins/Validation/Methods/dateISO
987		dateISO: function( value, element ) {
988			return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value);
989		},
990		// http://docs.jquery.com/Plugins/Validation/Methods/number
991		number: function( value, element ) {
992			return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
993		},
994		// http://docs.jquery.com/Plugins/Validation/Methods/digits
995		digits: function( value, element ) {
996			return this.optional(element) || /^\d+$/.test(value);
997		},
998		// http://docs.jquery.com/Plugins/Validation/Methods/creditcard
999		// based on http://en.wikipedia.org/wiki/Luhn
1000		creditcard: function( value, element ) {
1001			if ( this.optional(element) ) {
1002				return "dependency-mismatch";
1003			}
1004			// accept only spaces, digits and dashes
1005			if ( /[^0-9 \-]+/.test(value) ) {
1006				return false;
1007			}
1008			var nCheck = 0,
1009				nDigit = 0,
1010				bEven = false;
1011			value = value.replace(/\D/g, "");
1012			for (var n = value.length - 1; n >= 0; n--) {
1013				var cDigit = value.charAt(n);
1014				nDigit = parseInt(cDigit, 10);
1015				if ( bEven ) {
1016					if ( (nDigit *= 2) > 9 ) {
1017						nDigit -= 9;
1018					}
1019				}
1020				nCheck += nDigit;
1021				bEven = !bEven;
1022			}
1023			return (nCheck % 10) === 0;
1024		},
1025		// http://docs.jquery.com/Plugins/Validation/Methods/equalTo
1026		equalTo: function( value, element, param ) {
1027			// bind to the blur event of the target in order to revalidate whenever the target field is updated
1028			// TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
1029			var target = $(param);
1030			if ( this.settings.onfocusout ) {
1031				target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() {
1032					$(element).valid();
1033				});
1034			}
1035			return value === target.val();
1036		}
1037	}
1038});
1039// deprecated, use $.validator.format instead
1040$.format = $.validator.format;
1041}(jQuery));
1042// ajax mode: abort
1043// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
1044// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
1045(function($) {
1046	var pendingRequests = {};
1047	// Use a prefilter if available (1.5+)
1048	if ( $.ajaxPrefilter ) {
1049		$.ajaxPrefilter(function( settings, _, xhr ) {
1050			var port = settings.port;
1051			if ( settings.mode === "abort" ) {
1052				if ( pendingRequests[port] ) {
1053					pendingRequests[port].abort();
1054				}
1055				pendingRequests[port] = xhr;
1056			}
1057		});
1058	} else {
1059		// Proxy ajax
1060		var ajax = $.ajax;
1061		$.ajax = function( settings ) {
1062			var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
1063				port = ( "port" in settings ? settings : $.ajaxSettings ).port;
1064			if ( mode === "abort" ) {
1065				if ( pendingRequests[port] ) {
1066					pendingRequests[port].abort();
1067				}
1068				return (pendingRequests[port] = ajax.apply(this, arguments));
1069			}
1070			return ajax.apply(this, arguments);
1071		};
1072	}
1073}(jQuery));
1074// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
1075// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
1076(function($) {
1077	$.extend($.fn, {
1078		validateDelegate: function( delegate, type, handler ) {
1079			return this.bind(type, function( event ) {
1080				var target = $(event.target);
1081				if ( target.is(delegate) ) {
1082					return handler.apply(target, arguments);
1083				}
1084			});
1085		}
1086	});
1087}(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.