PageSourceSearch

https://www.heyuan.gov.cn/mjs/jquery_003.js

js heyuan.gov.cn collected 2026-10-02 08:04:53 UTC 40,692 bytes, 1,260 lines download raw bytes

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