PageSourceSearch

https://www.skysouq.com/assets/js/vendors/jquery.validate.js?v=1790259492

js skysouq.com collected 2026-09-24 14:18:54 UTC 53,434 bytes, 1,182 lines download raw bytes

vendor: 12,908 bytes, lines 1-303
1(function(factory) {
2    if (typeof define === "function" && define.amd) {
3        define(["jquery"], factory);
4    } else if (typeof module === "object" && module.exports) {
5        module.exports = factory(require("jquery"));
6    } else {
7        factory(jQuery);
8    }
9}(function($) {
10    $.extend($.fn, {
11        validate: function(options) {
12            if (!this.length) {
13                if (options && options.debug && window.console) {
14                    console.warn("Nothing selected, can't validate, returning nothing.");
15                }
16                return;
17            }
18            var validator = $.data(this[0], "validator");
19            if (validator) {
20                return validator;
21            }
22            this.attr("novalidate", "novalidate");
23            validator = new $.validator(options, this[0]);
24            $.data(this[0], "validator", validator);
25            if (validator.settings.onsubmit) {
26                this.on("click.validate", ":submit", function(event) {
27                    validator.submitButton = event.currentTarget;
28                    if ($(this).hasClass("cancel")) {
29                        validator.cancelSubmit = true;
30                    }
31                    if ($(this).attr("formnovalidate") !== undefined) {
32                        validator.cancelSubmit = true;
33                    }
34                });
35                this.on("submit.validate", function(event) {
36                    if (validator.settings.debug) {
37                        event.preventDefault();
38                    }
39
40                    function handle() {
41                        var hidden, result;
42                        if (validator.submitButton && (validator.settings.submitHandler || validator.formSubmitted)) {
43                            hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val($(validator.submitButton).val()).appendTo(validator.currentForm);
44                        }
45                        if (validator.settings.submitHandler) {
46                            result = validator.settings.submitHandler.call(validator, validator.currentForm, event);
47                            if (hidden) {
48                                hidden.remove();
49                            }
50                            if (result !== undefined) {
51                                return result;
52                            }
53                            return false;
54                        }
55                        return true;
56                    }
57                    if (validator.cancelSubmit) {
58                        validator.cancelSubmit = false;
59                        return handle();
60                    }
61                    if (validator.form()) {
62                        if (validator.pendingRequest) {
63                            validator.formSubmitted = true;
64                            return false;
65                        }
66                        return handle();
67                    } else {
68                        validator.focusInvalid();
69                        return false;
70                    }
71                });
72            }
73            return validator;
74        },
75        valid: function() {
76            var valid, validator, errorList;
77            if ($(this[0]).is("form")) {
78                valid = this.validate().form();
79            } else {
80                errorList = [];
81                valid = true;
82                validator = $(this[0].form).validate();
83                this.each(function() {
84                    valid = validator.element(this) && valid;
85                    if (!valid) {
86                        errorList = errorList.concat(validator.errorList);
87                    }
88                });
89                validator.errorList = errorList;
90            }
91            return valid;
92        },
93        rules: function(command, argument) {
94            var element = this[0],
95                settings, staticRules, existingRules, data, param, filtered;
96            if (element == null) {
97                return;
98            }
99            if (!element.form && element.hasAttribute("contenteditable")) {
100                element.form = this.closest("form")[0];
101                element.name = this.attr("name");
102            }
103            if (element.form == null) {
104                return;
105            }
106            if (command) {
107                settings = $.data(element.form, "validator").settings;
108                staticRules = settings.rules;
109                existingRules = $.validator.staticRules(element);
110                switch (command) {
111                    case "add":
112                        $.extend(existingRules, $.validator.normalizeRule(argument));
113                        delete existingRules.messages;
114                        staticRules[element.name] = existingRules;
115                        if (argument.messages) {
116                            settings.messages[element.name] = $.extend(settings.messages[element.name], argument.messages);
117                        }
118                        break;
119                    case "remove":
120                        if (!argument) {
121                            delete staticRules[element.name];
122                            return existingRules;
123                        }
124                        filtered = {};
125                        $.each(argument.split(/\s/), function(index, method) {
126                            filtered[method] = existingRules[method];
127                            delete existingRules[method];
128                        });
129                        return filtered;
130                }
131            }
132            data = $.validator.normalizeRules($.extend({}, $.validator.classRules(element), $.validator.attributeRules(element), $.validator.dataRules(element), $.validator.staticRules(element)), element);
133            if (data.required) {
134                param = data.required;
135                delete data.required;
136                data = $.extend({
137                    required: param
138                }, data);
139            }
140            if (data.remote) {
141                param = data.remote;
142                delete data.remote;
143                data = $.extend(data, {
144                    remote: param
145                });
146            }
147            return data;
148        }
149    });
150    $.extend($.expr.pseudos || $.expr[":"], {
151        blank: function(a) {
152            return !$.trim("" + $(a).val());
153        },
154        filled: function(a) {
155            var val = $(a).val();
156            return val !== null && !!$.trim("" + val);
157        },
158        unchecked: function(a) {
159            return !$(a).prop("checked");
160        }
161    });
162    $.validator = function(options, form) {
163        this.settings = $.extend(true, {}, $.validator.defaults, options);
164        this.currentForm = form;
165        this.init();
166    };
167    $.validator.format = function(source, params) {
168        if (arguments.length === 1) {
169            return function() {
170                var args = $.makeArray(arguments);
171                args.unshift(source);
172                return $.validator.format.apply(this, args);
173            };
174        }
175        if (params === undefined) {
176            return source;
177        }
178        if (arguments.length > 2 && params.constructor !== Array) {
179            params = $.makeArray(arguments).slice(1);
180        }
181        if (params.constructor !== Array) {
182            params = [params];
183        }
184        $.each(params, function(i, n) {
185            source = source.replace(new RegExp("\\{" + i + "\\}", "g"), function() {
186                return n;
187            });
188        });
189        return source;
190    };
191    $.extend($.validator, {
192        defaults: {
193            messages: {},
194            groups: {},
195            rules: {},
196            errorClass: "error",
197            pendingClass: "pending",
198            validClass: "valid",
199            errorElement: "span",
200            focusCleanup: false,
201            focusInvalid: true,
202            errorContainer: $([]),
203            errorLabelContainer: $([]),
204            onsubmit: true,
205            ignore: ":hidden",
206            ignoreTitle: false,
207            onfocusin: function(element) {
208                this.lastActive = element;
209                if (this.settings.focusCleanup) {
210                    if (this.settings.unhighlight) {
211                        this.settings.unhighlight.call(this, element, this.settings.errorClass, this.settings.validClass);
212                    }
213                    this.hideThese(this.errorsFor(element));
214                }
215            },
216            onfocusout: function(element) {
217                if (!this.checkable(element) && (element.name in this.submitted || !this.optional(element))) {
218                    this.element(element);
219                }
220            },
221            onkeyup: function(element, event) {
222                var excludedKeys = [16, 17, 18, 20, 35, 36, 37, 38, 39, 40, 45, 144, 225];
223                if (event.which === 9 && this.elementValue(element) === "" || $.inArray(event.keyCode, excludedKeys) !== -1) {
224                    return;
225                } else if (element.name in this.submitted || element.name in this.invalid) {
226                    this.element(element);
227                }
228            },
229            onclick: function(element) {
230                if (element.name in this.submitted) {
231                    this.element(element);
232                } else if (element.parentNode.name in this.submitted) {
233                    this.element(element.parentNode);
234                }
235            },
236            highlight: function(element, errorClass, validClass) {
237                if (element.type === "radio") {
238                    this.findByName(element.name).addClass(errorClass).removeClass(validClass);
239                } else {
240                    $(element).addClass(errorClass).removeClass(validClass);
241                }
242            },
243            unhighlight: function(element, errorClass, validClass) {
244                if (element.type === "radio") {
245                    this.findByName(element.name).removeClass(errorClass).addClass(validClass);
246                } else {
247                    $(element).removeClass(errorClass).addClass(validClass);
248                }
249            }
250        },
251        setDefaults: function(settings) {
252            $.extend($.validator.defaults, settings);
253        },
254        messages: {
255            required: "This field is required.",
256            remote: "Please fix this field.",
257            email: "Please enter a valid email address.",
258            url: "Please enter a valid URL.",
259            date: "Please enter a valid date.",
260            dateISO: "Please enter a valid date (ISO).",
261            number: "Please enter a valid number.",
262            digits: "Please enter only digits.",
263            equalTo: "Please enter the same value again.",
264            maxlength: $.validator.format("Please enter no more than {0} characters."),
265            minlength: $.validator.format("Please enter at least {0} characters."),
266            rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
267            range: $.validator.format("Please enter a value between {0} and {1}."),
268            max: $.validator.format("Please enter a value less than or equal to {0}."),
269            min: $.validator.format("Please enter a value greater than or equal to {0}."),
270            step: $.validator.format("Please enter a multiple of {0}.")
271        },
272        autoCreateRanges: false,
273        prototype: {
274            init: function() {
275                this.labelContainer = $(this.settings.errorLabelContainer);
276                this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
277                this.containers = $(this.settings.errorContainer).add(this.settings.errorLabelContainer);
278                this.submitted = {};
279                this.valueCache = {};
280                this.pendingRequest = 0;
281                this.pending = {};
282                this.invalid = {};
283                this.reset();
284                var groups = (this.groups = {}),
285                    rules;
286                $.each(this.settings.groups, function(key, value) {
287                    if (typeof value === "string") {
288                        value = value.split(/\s/);
289                    }
290                    $.each(value, function(index, name) {
291                        groups[name] = key;
292                    });
293                });
294                rules = this.settings.rules;
295                $.each(rules, function(key, value) {
296                    rules[key] = $.validator.normalizeRule(value);
297                });
298
299                function delegate(event) {
300                    if (!this.form && this.hasAttribute("contenteditable")) {
301                        this.form = $(this).closest("form")[0];
302                        this.name = $(this).attr("name");
303                    }
304                    var validator = $.data(this.form, "validator"),
305                        eventType = "on" + event.type.replace(/^validate/, ""),
306                        settings = validator.settings;
307                    if (settings[eventType] && !$(this).is(settings.ignore)) {
308                        settings[eventType].call(validator, this, event);
309                    }
310                }
311                $(this.currentForm).on("focusin.validate focusout.validate keyup.validate", ":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " + "[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " + "[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " + "[type='radio'], [type='checkbox'], [contenteditable], [type='button']", delegate).on("click.validate", "select, option, [type='radio'], [type='checkbox']", delegate);
312                if (this.settings.invalidHandler) {
313                    $(this.currentForm).on("invalid-form.validate", this.settings.invalidHandler);
314                }
315            },
316            form: function() {
317                this.checkForm();
318                $.extend(this.submitted, this.errorMap);
319                this.invalid = $.extend({}, this.errorMap);
320                if (!this.valid()) {
321                    $(this.currentForm).triggerHandler("invalid-form", [this]);
322                }
323                this.showErrors();
324                return this.valid();
325            },
326            checkForm: function() {
327			    this.prepareForm();
328			        for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
329			            if (this.findByName( elements[i].name ).length != undefined && this.findByName( elements[i].name ).length > 1) {
330			                for (var cnt = 0; cnt < this.findByName( elements[i].name ).length; cnt++) {
331			                    this.check( this.findByName( elements[i].name )[cnt] );
332			                }
333			            } 
334			            else {
335			                this.check( elements[i] );
336			            }
337			        }
338			    return this.valid();
339			},
340            /* checkForm: function() {
341                this.prepareForm();
342                for (var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++) {
343                    this.check(elements[i]);
344                }
345                return this.valid();
346            },*/
347            element: function(element) {
348                var cleanElement = this.clean(element),
349                    checkElement = this.validationTargetFor(cleanElement),
350                    v = this,
351                    result = true,
352                    rs, group;
353                if (checkElement === undefined) {
354                    delete this.invalid[cleanElement.name];
355                } else {
356                    this.prepareElement(checkElement);
357                    this.currentElements = $(checkElement);
358                    group = this.groups[checkElement.name];
359                    if (group) {
360                        $.each(this.groups, function(name, testgroup) {
361                            if (testgroup === group && name !== checkElement.name) {
362                                cleanElement = v.validationTargetFor(v.clean(v.findByName(name)));
363                                if (cleanElement && cleanElement.name in v.invalid) {
364                                    v.currentElements.push(cleanElement);
365                                    result = v.check(cleanElement) && result;
366                                }
367                            }
368                        });
369                    }
370                    rs = this.check(checkElement) !== false;
371                    result = result && rs;
372                    if (rs) {
373                        this.invalid[checkElement.name] = false;
374                    } else {
375                        this.invalid[checkElement.name] = true;
376                    }
377                    if (!this.numberOfInvalids()) {
378                        this.toHide = this.toHide.add(this.containers
vendor: 13,059 bytes, lines 378-668
378);
379                    }
380                    this.showErrors();
381                    $(element).attr("aria-invalid", !rs);
382                }
383                return result;
384            },
385            showErrors: function(errors) {
386                if (errors) {
387                    var validator = this;
388                    $.extend(this.errorMap, errors);
389                    this.errorList = $.map(this.errorMap, function(message, name) {
390                        return {
391                            message: message,
392                            element: validator.findByName(name)[0]
393                        };
394                    });
395                    this.successList = $.grep(this.successList, function(element) {
396                        return !(element.name in errors);
397                    });
398                }
399                if (this.settings.showErrors) {
400                    this.settings.showErrors.call(this, this.errorMap, this.errorList);
401                } else {
402                    this.defaultShowErrors();
403                }
404            },
405            resetForm: function() {
406                if ($.fn.resetForm) {
407                    $(this.currentForm).resetForm();
408                }
409                this.invalid = {};
410                this.submitted = {};
411                this.prepareForm();
412                this.hideErrors();
413                var elements = this.elements().removeData("previousValue").removeAttr("aria-invalid");
414                this.resetElements(elements);
415            },
416            resetElements: function(elements) {
417                var i;
418                if (this.settings.unhighlight) {
419                    for (i = 0; elements[i]; i++) {
420                        this.settings.unhighlight.call(this, elements[i], this.settings.errorClass, "");
421                        this.findByName(elements[i].name).removeClass(this.settings.validClass);
422                    }
423                } else {
424                    elements.removeClass(this.settings.errorClass).removeClass(this.settings.validClass);
425                }
426            },
427            numberOfInvalids: function() {
428                return this.objectLength(this.invalid);
429            },
430            objectLength: function(obj) {
431                var count = 0,
432                    i;
433                for (i in obj) {
434                    if (obj[i] !== undefined && obj[i] !== null && obj[i] !== false) {
435                        count++;
436                    }
437                }
438                return count;
439            },
440            hideErrors: function() {
441                this.hideThese(this.toHide);
442            },
443            hideThese: function(errors) {
444                errors.not(this.containers).text("");
445                this.addWrapper(errors).hide();
446            },
447            valid: function() {
448                return this.size() === 0;
449            },
450            size: function() {
451                return this.errorList.length;
452            },
453            focusInvalid: function() {
454                if (this.settings.focusInvalid) {
455                    try {
456                        $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible").focus().trigger("focusin");
457                    } catch (e) {}
458                }
459            },
460            findLastActive: function() {
461                var lastActive = this.lastActive;
462                return lastActive && $.grep(this.errorList, function(n) {
463                    return n.element.name === lastActive.name;
464                }).length === 1 && lastActive;
465            },
466            elements: function() {
467                var validator = this,
468                    rulesCache = {};
469                return $(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function() {
470                    var name = this.name || $(this).attr("name");
471                    if (!name && validator.settings.debug && window.console) {
472                        console.error("%o has no name assigned", this);
473                    }
474                    if (this.hasAttribute("contenteditable")) {
475                        this.form = $(this).closest("form")[0];
476                        this.name = name;
477                    }
478                    if (name in rulesCache || !validator.objectLength($(this).rules())) {
479                        return false;
480                    }
481                    rulesCache[name] = true;
482                    return true;
483                });
484            },
485            clean: function(selector) {
486                return $(selector)[0];
487            },
488            errors: function() {
489                var errorClass = this.settings.errorClass.split(" ").join(".");
490                return $(this.settings.errorElement + "." + errorClass, this.errorContext);
491            },
492            resetInternals: function() {
493                this.successList = [];
494                this.errorList = [];
495                this.errorMap = {};
496                this.toShow = $([]);
497                this.toHide = $([]);
498            },
499            reset: function() {
500                this.resetInternals();
501                this.currentElements = $([]);
502            },
503            prepareForm: function() {
504                this.reset();
505                this.toHide = this.errors().add(this.containers);
506            },
507            prepareElement: function(element) {
508                this.reset();
509                this.toHide = this.errorsFor(element);
510            },
511            elementValue: function(element) {
512                var $element = $(element),
513                    type = element.type,
514                    val, idx;
515                if (type === "radio" || type === "checkbox") {
516                    return this.findByName(element.name).filter(":checked").val();
517                } else if (type === "number" && typeof element.validity !== "undefined") {
518                    return element.validity.badInput ? "NaN" : $element.val();
519                }
520                if (element.hasAttribute("contenteditable")) {
521                    val = $element.text();
522                } else {
523                    val = $element.val();
524                }
525                if (type === "file") {
526                    if (val.substr(0, 12) === "C:\\fakepath\\") {
527                        return val.substr(12);
528                    }
529                    idx = val.lastIndexOf("/");
530                    if (idx >= 0) {
531                        return val.substr(idx + 1);
532                    }
533                    idx = val.lastIndexOf("\\");
534                    if (idx >= 0) {
535                        return val.substr(idx + 1);
536                    }
537                    return val;
538                }
539                if (typeof val === "string") {
540                    return val.replace(/\r/g, "");
541                }
542                return val;
543            },
544            check: function(element) {
545                element = this.validationTargetFor(this.clean(element));
546                var rules = $(element).rules(),
547                    rulesCount = $.map(rules, function(n, i) {
548                        return i;
549                    }).length,
550                    dependencyMismatch = false,
551                    val = this.elementValue(element),
552                    result, method, rule, normalizer;
553                if (typeof rules.normalizer === "function") {
554                    normalizer = rules.normalizer;
555                } else if (typeof this.settings.normalizer === "function") {
556                    normalizer = this.settings.normalizer;
557                }
558                if (normalizer) {
559                    val = normalizer.call(element, val);
560                    if (typeof val !== "string") {
561                        throw new TypeError("The normalizer should return a string value.");
562                    }
563                    delete rules.normalizer;
564                }
565                for (method in rules) {
566                    rule = {
567                        method: method,
568                        parameters: rules[method]
569                    };
570                    try {
571                        result = $.validator.methods[method].call(this, val, element, rule.parameters);
572                        if (result === "dependency-mismatch" && rulesCount === 1) {
573                            dependencyMismatch = true;
574                            continue;
575                        }
576                        dependencyMismatch = false;
577                        if (result === "pending") {
578                            this.toHide = this.toHide.not(this.errorsFor(element));
579                            return;
580                        }
581                        if (!result) {
582                            this.formatAndAdd(element, rule);
583                            return false;
584                        }
585                    } catch (e) {
586                        if (this.settings.debug && window.console) {
587                            console.log("Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e);
588                        }
589                        if (e instanceof TypeError) {
590                            e.message += ".  Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.";
591                        }
592                        throw e;
593                    }
594                }
595                if (dependencyMismatch) {
596                    return;
597                }
598                if (this.objectLength(rules)) {
599                    this.successList.push(element);
600                }
601                return true;
602            },
603            customDataMessage: function(element, method) {
604                return $(element).data("msg" + method.charAt(0).toUpperCase() + method.substring(1).toLowerCase()) || $(element).data("msg");
605            },
606            customMessage: function(name, method) {
607                var m = this.settings.messages[name];
608                return m && (m.constructor === String ? m : m[method]);
609            },
610            findDefined: function() {
611                for (var i = 0; i < arguments.length; i++) {
612                    if (arguments[i] !== undefined) {
613                        return arguments[i];
614                    }
615                }
616                return undefined;
617            },
618            defaultMessage: function(element, rule) {
619                if (typeof rule === "string") {
620                    rule = {
621                        method: rule
622                    };
623                }
624                var message = this.findDefined(this.customMessage(element.name, rule.method), this.customDataMessage(element, rule.method), !this.settings.ignoreTitle && element.title || undefined, $.validator.messages[rule.method], "<strong>Warning: No message defined for " + element.name + "</strong>"),
625                    theregex = /\$?\{(\d+)\}/g;
626                if (typeof message === "function") {
627                    message = message.call(this, rule.parameters, element);
628                } else if (theregex.test(message)) {
629                    message = $.validator.format(message.replace(theregex, "{$1}"), rule.parameters);
630                }
631                return message;
632            },
633            formatAndAdd: function(element, rule) {
634                var message = this.defaultMessage(element, rule);
635                this.errorList.push({
636                    message: message,
637                    element: element,
638                    method: rule.method
639                });
640                this.errorMap[element.name] = message;
641                this.submitted[element.name] = message;
642            },
643            addWrapper: function(toToggle) {
644                if (this.settings.wrapper) {
645                    toToggle = toToggle.add(toToggle.parent(this.settings.wrapper));
646                }
647                return toToggle;
648            },
649            defaultShowErrors: function() {
650                var i, elements, error;
651                for (i = 0; this.errorList[i]; i++) {
652                    error = this.errorList[i];
653                    if (this.settings.highlight) {
654                        this.settings.highlight.call(this, error.element, this.settings.errorClass, this.settings.validClass);
655                    }
656                    this.showLabel(error.element, error.message);
657                }
658                if (this.errorList.length) {
659                    this.toShow = this.toShow.add(this.containers);
660                }
661                if (this.settings.success) {
662                    for (i = 0; this.successList[i]; i++) {
663                        this.showLabel(this.successList[i]);
664                    }
665                }
666                if (this.settings.unhighlight) {
667                    for (i = 0, elements = this.validElements(); elements[i]; i++) {
668                        this.settings.unhighlight.call(this, elements[i], this.settings.errorClass, this.settings.val
668idClass);
669                    }
670                }
671                this.toHide = this.toHide.not(this.toShow);
672                this.hideErrors();
673                this.addWrapper(this.toShow).show();
674            },
675            validElements: function() {
676                return this.currentElements.not(this.invalidElements());
677            },
678            invalidElements: function() {
679                return $(this.errorList).map(function() {
680                    return this.element;
681                });
682            },
683            showLabel: function(element, message) {
684                var place, group, errorID, v, error = this.errorsFor(element),
685                    elementID = this.idOrName(element),
686                    describedBy = $(element).attr("aria-describedby");
687                if (error.length) {
688                    error.removeClass(this.settings.validClass).addClass(this.settings.errorClass);
689                    error.html(message);
690                } else {
691                    error = $("<" + this.settings.errorElement + ">").attr("id", elementID + "-error").addClass(this.settings.errorClass).html(message || "");
692                    place = error;
693                    if (this.settings.wrapper) {
694                        place = error.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
695                    }
696                    if (this.labelContainer.length) {
697                        this.labelContainer.append(place);
698                    } else if (this.settings.errorPlacement) {
699                        this.settings.errorPlacement.call(this, place, $(element));
700                    } else {
701                        place.insertAfter(element);
702                    }
703                    if (error.is("label")) {
704                        error.attr("for", elementID);
705                    } else if (error.parents("label[for='" + this.escapeCssMeta(elementID) + "']").length === 0) {
706                        errorID = error.attr("id");
707                        if (!describedBy) {
708                            describedBy = errorID;
709                        } else if (!describedBy.match(new RegExp("\\b" + this.escapeCssMeta(errorID) + "\\b"))) {
710                            describedBy += " " + errorID;
711                        }
712                        $(element).attr("aria-describedby", describedBy);
713                        group = this.groups[element.name];
714                        if (group) {
715                            v = this;
716                            $.each(v.groups, function(name, testgroup) {
717                                if (testgroup === group) {
718                                    $("[name='" + v.escapeCssMeta(name) + "']", v.currentForm).attr("aria-describedby", error.attr("id"));
719                                }
720                            });
721                        }
722                    }
723                }
724                if (!message && this.settings.success) {
725                    error.text("");
726                    if (typeof this.settings.success === "string") {
727                        error.addClass(this.settings.success);
728                    } else {
729                        this.settings.success(error, element);
730                    }
731                }
732                this.toShow = this.toShow.add(error);
733            },
734            errorsFor: function(element) {
735                var name = this.escapeCssMeta(this.idOrName(element)),
736                    describer = $(element).attr("aria-describedby"),
737                    selector = "label[for='" + name + "'], label[for='" + name + "'] *";
738                if (describer) {
739                    selector = selector + ", #" + this.escapeCssMeta(describer).replace(/\s+/g, ", #");
740                }
741                return this.errors().filter(selector);
742            },
743            escapeCssMeta: function(string) {
744                return string.replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1");
745            },
746            idOrName: function(element) {
747                return this.groups[element.name] || (this.checkable(element) ? element.name : element.i
vendor: 19,248 bytes, lines 747-1182
747d || element.name);
748            },
749            validationTargetFor: function(element) {
750                if (this.checkable(element)) {
751                    element = this.findByName(element.name);
752                }
753                return $(element).not(this.settings.ignore)[0];
754            },
755            checkable: function(element) {
756                return (/radio|checkbox/i).test(element.type);
757            },
758            findByName: function(name) {
759                return $(this.currentForm).find("[name='" + this.escapeCssMeta(name) + "']");
760            },
761            getLength: function(value, element) {
762                switch (element.nodeName.toLowerCase()) {
763                    case "select":
764                        return $("option:selected", element).length;
765                    case "input":
766                        if (this.checkable(element)) {
767                            return this.findByName(element.name).filter(":checked").length;
768                        }
769                }
770                return value.length;
771            },
772            depend: function(param, element) {
773                return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true;
774            },
775            dependTypes: {
776                "boolean": function(param) {
777                    return param;
778                },
779                "string": function(param, element) {
780                    return !!$(param, element.form).length;
781                },
782                "function": function(param, element) {
783                    return param(element);
784                }
785            },
786            optional: function(element) {
787                var val = this.elementValue(element);
788                return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch";
789            },
790            startRequest: function(element) {
791                if (!this.pending[element.name]) {
792                    this.pendingRequest++;
793                    $(element).addClass(this.settings.pendingClass);
794                    this.pending[element.name] = true;
795                }
796            },
797            stopRequest: function(element, valid) {
798                this.pendingRequest--;
799                if (this.pendingRequest < 0) {
800                    this.pendingRequest = 0;
801                }
802                delete this.pending[element.name];
803                $(element).removeClass(this.settings.pendingClass);
804                if (valid && this.pendingRequest === 0 && this.formSubmitted && this.form()) {
805                    $(this.currentForm).submit();
806                    if (this.submitButton) {
807                        $("input:hidden[name='" + this.submitButton.name + "']", this.currentForm).remove();
808                    }
809                    this.formSubmitted = false;
810                } else if (!valid && this.pendingRequest === 0 && this.formSubmitted) {
811                    $(this.currentForm).triggerHandler("invalid-form", [this]);
812                    this.formSubmitted = false;
813                }
814            },
815            previousValue: function(element, method) {
816                method = typeof method === "string" && method || "remote";
817                return $.data(element, "previousValue") || $.data(element, "previousValue", {
818                    old: null,
819                    valid: true,
820                    message: this.defaultMessage(element, {
821                        method: method
822                    })
823                });
824            },
825            destroy: function() {
826                this.resetForm();
827                $(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur");
828            }
829        },
830        classRuleSettings: {
831            required: {
832                required: true
833            },
834            email: {
835                email: true
836            },
837            url: {
838                url: true
839            },
840            date: {
841                date: true
842            },
843            dateISO: {
844                dateISO: true
845            },
846            number: {
847                number: true
848            },
849            digits: {
850                digits: true
851            },
852            creditcard: {
853                creditcard: true
854            }
855        },
856        addClassRules: function(className, rules) {
857            if (className.constructor === String) {
858                this.classRuleSettings[className] = rules;
859            } else {
860                $.extend(this.classRuleSettings, className);
861            }
862        },
863        classRules: function(element) {
864            var rules = {},
865                classes = $(element).attr("class");
866            if (classes) {
867                $.each(classes.split(" "), function() {
868                    if (this in $.validator.classRuleSettings) {
869                        $.extend(rules, $.validator.classRuleSettings[this]);
870                    }
871                });
872            }
873            return rules;
874        },
875        normalizeAttributeRule: function(rules, type, method, value) {
876            if (/min|max|step/.test(method) && (type === null || /number|range|text/.test(type))) {
877                value = Number(value);
878                if (isNaN(value)) {
879                    value = undefined;
880                }
881            }
882            if (value || value === 0) {
883                rules[method] = value;
884            } else if (type === method && type !== "range") {
885                rules[method] = true;
886            }
887        },
888        attributeRules: function(element) {
889            var rules = {},
890                $element = $(element),
891                type = element.getAttribute("type"),
892                method, value;
893            for (method in $.validator.methods) {
894                if (method === "required") {
895                    value = element.getAttribute(method);
896                    if (value === "") {
897                        value = true;
898                    }
899                    value = !!value;
900                } else {
901                    value = $element.attr(method);
902                }
903                this.normalizeAttributeRule(rules, type, method, value);
904            }
905            if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
906                delete rules.maxlength;
907            }
908            return rules;
909        },
910        dataRules: function(element) {
911            var rules = {},
912                $element = $(element),
913                type = element.getAttribute("type"),
914                method, value;
915            for (method in $.validator.methods) {
916                value = $element.data("rule" + method.charAt(0).toUpperCase() + method.substring(1).toLowerCase());
917                this.normalizeAttributeRule(rules, type, method, value);
918            }
919            return rules;
920        },
921        staticRules: function(element) {
922            var rules = {},
923                validator = $.data(element.form, "validator");
924            if (validator.settings.rules) {
925                rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
926            }
927            return rules;
928        },
929        normalizeRules: function(rules, element) {
930            $.each(rules, function(prop, val) {
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                        $.data(element.form, "validator").resetElements($(element));
949                        delete rules[prop];
950                    }
951                }
952            });
953            $.each(rules, function(rule, parameter) {
954                rules[rule] = $.isFunction(parameter) && rule !== "normalizer" ? parameter(element) : parameter;
955            });
956            $.each(["minlength", "maxlength"], function() {
957                if (rules[this]) {
958                    rules[this] = Number(rules[this]);
959                }
960            });
961            $.each(["rangelength", "range"], function() {
962                var parts;
963                if (rules[this]) {
964                    if ($.isArray(rules[this])) {
965                        rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
966                    } else if (typeof rules[this] === "string") {
967                        parts = rules[this].replace(/[\[\]]/g, "").split(/[\s,]+/);
968                        rules[this] = [Number(parts[0]), Number(parts[1])];
969                    }
970                }
971            });
972            if ($.validator.autoCreateRanges) {
973                if (rules.min != null && rules.max != null) {
974                    rules.range = [rules.min, rules.max];
975                    delete rules.min;
976                    delete rules.max;
977                }
978                if (rules.minlength != null && rules.maxlength != null) {
979                    rules.rangelength = [rules.minlength, rules.maxlength];
980                    delete rules.minlength;
981                    delete rules.maxlength;
982                }
983            }
984            return rules;
985        },
986        normalizeRule: function(data) {
987            if (typeof data === "string") {
988                var transformed = {};
989                $.each(data.split(/\s/), function() {
990                    transformed[this] = true;
991                });
992                data = transformed;
993            }
994            return data;
995        },
996        addMethod: function(name, method, message) {
997            $.validator.methods[name] = method;
998            $.validator.messages[name] = message !== undefined ? message : $.validator.messages[name];
999            if (method.length < 3) {
1000                $.validator.addClassRules(name, $.validator.normalizeRule(name));
1001            }
1002        },
1003        methods: {
1004            required: function(value, element, param) {
1005                if (!this.depend(param, element)) {
1006                    return "dependency-mismatch";
1007                }
1008                if (element.nodeName.toLowerCase() === "select") {
1009                    var val = $(element).val();
1010                    return val && val.length > 0;
1011                }
1012                if (this.checkable(element)) {
1013                    return this.getLength(value, element) > 0;
1014                }
1015                return value.length > 0;
1016            },
1017            email: function(value, element) {
1018                return this.optional(element) || /^[a-zA-Z0-9_\.%\+\-]+@[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,}$/.test(value);
1019            },
1020            url: function(value, element) {
1021                return this.optional(element) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(value);
1022            },
1023            date: function(value, element) {
1024                return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString());
1025            },
1026            dateISO: function(value, element) {
1027                return this.optional(element) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);
1028            },
1029            number: function(value, element) {
1030                return this.optional(element) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
1031            },
1032            digits: function(value, element) {
1033                return this.optional(element) || /^\d+$/.test(value);
1034            },
1035            minlength: function(value, element, param) {
1036                var length = $.isArray(value) ? value.length : this.getLength(value, element);
1037                return this.optional(element) || length >= param;
1038            },
1039            maxlength: function(value, element, param) {
1040                var length = $.isArray(value) ? value.length : this.getLength(value, element);
1041                return this.optional(element) || length <= param;
1042            },
1043            rangelength: function(value, element, param) {
1044                var length = $.isArray(value) ? value.length : this.getLength(value, element);
1045                return this.optional(element) || (length >= param[0] && length <= param[1]);
1046            },
1047            min: function(value, element, param) {
1048                return this.optional(element) || value >= param;
1049            },
1050            max: function(value, element, param) {
1051                return this.optional(element) || value <= param;
1052            },
1053            range: function(value, element, param) {
1054                return this.optional(element) || (value >= param[0] && value <= param[1]);
1055            },
1056            step: function(value, element, param) {
1057                var type = $(element).attr("type"),
1058                    errorMessage = "Step attribute on input type " + type + " is not supported.",
1059                    supportedTypes = ["text", "number", "range"],
1060                    re = new RegExp("\\b" + type + "\\b"),
1061                    notSupported = type && !re.test(supportedTypes.join()),
1062                    decimalPlaces = function(num) {
1063                        var match = ("" + num).match(/(?:\.(\d+))?$/);
1064                        if (!match) {
1065                            return 0;
1066                        }
1067                        return match[1] ? match[1].length : 0;
1068                    },
1069                    toInt = function(num) {
1070                        return Math.round(num * Math.pow(10, decimals));
1071                    },
1072                    valid = true,
1073                    decimals;
1074                if (notSupported) {
1075                    throw new Error(errorMessage);
1076                }
1077                decimals = decimalPlaces(param);
1078                if (decimalPlaces(value) > decimals || toInt(value) % toInt(param) !== 0) {
1079                    valid = false;
1080                }
1081                return this.optional(element) || valid;
1082            },
1083            equalTo: function(value, element, param) {
1084                var target = $(param);
1085                if (this.settings.onfocusout && target.not(".validate-equalTo-blur").length) {
1086                    target.addClass("validate-equalTo-blur").on("blur.validate-equalTo", function() {
1087                        $(element).valid();
1088                    });
1089                }
1090                return value === target.val();
1091            },
1092            remote: function(value, element, param, method) {
1093                if (this.optional(element)) {
1094                    return "dependency-mismatch";
1095                }
1096                method = typeof method === "string" && method || "remote";
1097                var previous = this.previousValue(element, method),
1098                    validator, data, optionDataString;
1099                if (!this.settings.messages[element.name]) {
1100                    this.settings.messages[element.name] = {};
1101                }
1102                previous.originalMessage = previous.originalMessage || this.settings.messages[element.name][method];
1103                this.settings.messages[element.name][method] = previous.message;
1104                param = typeof param === "string" && {
1105                    url: param
1106                } || param;
1107                optionDataString = $.param($.extend({
1108                    data: value
1109                }, param.data));
1110                if (previous.old === optionDataString) {
1111                    return previous.valid;
1112                }
1113                previous.old = optionDataString;
1114                validator = this;
1115                this.startRequest(element);
1116                data = {};
1117                data[element.name] = value;
1118                $.ajax($.extend(true, {
1119                    mode: "abort",
1120                    port: "validate" + element.name,
1121                    dataType: "json",
1122                    data: data,
1123                    context: validator.currentForm,
1124                    success: function(response) {
1125                        var valid = response === true || response === "true",
1126                            errors, message, submitted;
1127                        validator.settings.messages[element.name][method] = previous.originalMessage;
1128                        if (valid) {
1129                            submitted = validator.formSubmitted;
1130                            validator.resetInternals();
1131                            validator.toHide = validator.errorsFor(element);
1132                            validator.formSubmitted = submitted;
1133                            validator.successList.push(element);
1134                            validator.invalid[element.name] = false;
1135                            validator.showErrors();
1136                        } else {
1137                            errors = {};
1138                            message = response || validator.defaultMessage(element, {
1139                                method: method,
1140                                parameters: value
1141                            });
1142                            errors[element.name] = previous.message = message;
1143                            validator.invalid[element.name] = true;
1144                            validator.showErrors(errors);
1145                        }
1146                        previous.valid = valid;
1147                        validator.stopRequest(element, valid);
1148                    }
1149                }, param));
1150                return "pending";
1151            }
1152        }
1153    });
1154    var pendingRequests = {},
1155        ajax;
1156    if ($.ajaxPrefilter) {
1157        $.ajaxPrefilter(function(settings, _, xhr) {
1158            var port = settings.port;
1159            if (settings.mode === "abort") {
1160                if (pendingRequests[port]) {
1161                    pendingRequests[port].abort();
1162                }
1163                pendingRequests[port] = xhr;
1164            }
1165        });
1166    } else {
1167        ajax = $.ajax;
1168        $.ajax = function(settings) {
1169            var mode = ("mode" in settings ? settings : $.ajaxSettings).mode,
1170                port = ("port" in settings ? settings : $.ajaxSettings).port;
1171            if (mode === "abort") {
1172                if (pendingRequests[port]) {
1173                    pendingRequests[port].abort();
1174                }
1175                pendingRequests[port] = ajax.apply(this, arguments);
1176                return pendingRequests[port];
1177            }
1178            return ajax.apply(this, arguments);
1179        };
1180    }
1181    return $;
1182}));

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.