PageSourceSearch

https://www.guamplay.com/include/js/jquery/jquery.validate.js

js guamplay.com collected 2026-10-08 07:43:05 UTC 43,158 bytes, 1,327 lines download raw bytes

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