@chocolatey-software/ccr 2.1.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scripts/validation.js +1315 -1
- package/dist/scripts/validation.min.js +14 -4
- package/package.json +31 -35
|
@@ -7636,6 +7636,1310 @@
|
|
|
7636
7636
|
}
|
|
7637
7637
|
});
|
|
7638
7638
|
|
|
7639
|
+
// node_modules/jquery-validation-unobtrusive/node_modules/jquery-validation/dist/jquery.validate.js
|
|
7640
|
+
var require_jquery_validate2 = __commonJS({
|
|
7641
|
+
"node_modules/jquery-validation-unobtrusive/node_modules/jquery-validation/dist/jquery.validate.js"(exports, module) {
|
|
7642
|
+
(function(factory) {
|
|
7643
|
+
if (typeof define === "function" && define.amd) {
|
|
7644
|
+
define(["jquery"], factory);
|
|
7645
|
+
} else if (typeof module === "object" && module.exports) {
|
|
7646
|
+
module.exports = factory(require_jquery());
|
|
7647
|
+
} else {
|
|
7648
|
+
factory(jQuery);
|
|
7649
|
+
}
|
|
7650
|
+
})(function($2) {
|
|
7651
|
+
$2.extend($2.fn, {
|
|
7652
|
+
// https://jqueryvalidation.org/validate/
|
|
7653
|
+
validate: function(options) {
|
|
7654
|
+
if (!this.length) {
|
|
7655
|
+
if (options && options.debug && window.console) {
|
|
7656
|
+
console.warn("Nothing selected, can't validate, returning nothing.");
|
|
7657
|
+
}
|
|
7658
|
+
return;
|
|
7659
|
+
}
|
|
7660
|
+
var validator = $2.data(this[0], "validator");
|
|
7661
|
+
if (validator) {
|
|
7662
|
+
return validator;
|
|
7663
|
+
}
|
|
7664
|
+
this.attr("novalidate", "novalidate");
|
|
7665
|
+
validator = new $2.validator(options, this[0]);
|
|
7666
|
+
$2.data(this[0], "validator", validator);
|
|
7667
|
+
if (validator.settings.onsubmit) {
|
|
7668
|
+
this.on("click.validate", ":submit", function(event) {
|
|
7669
|
+
validator.submitButton = event.currentTarget;
|
|
7670
|
+
if ($2(this).hasClass("cancel")) {
|
|
7671
|
+
validator.cancelSubmit = true;
|
|
7672
|
+
}
|
|
7673
|
+
if ($2(this).attr("formnovalidate") !== void 0) {
|
|
7674
|
+
validator.cancelSubmit = true;
|
|
7675
|
+
}
|
|
7676
|
+
});
|
|
7677
|
+
this.on("submit.validate", function(event) {
|
|
7678
|
+
if (validator.settings.debug) {
|
|
7679
|
+
event.preventDefault();
|
|
7680
|
+
}
|
|
7681
|
+
function handle() {
|
|
7682
|
+
var hidden, result;
|
|
7683
|
+
if (validator.submitButton && (validator.settings.submitHandler || validator.formSubmitted)) {
|
|
7684
|
+
hidden = $2("<input type='hidden'/>").attr("name", validator.submitButton.name).val($2(validator.submitButton).val()).appendTo(validator.currentForm);
|
|
7685
|
+
}
|
|
7686
|
+
if (validator.settings.submitHandler && !validator.settings.debug) {
|
|
7687
|
+
result = validator.settings.submitHandler.call(validator, validator.currentForm, event);
|
|
7688
|
+
if (hidden) {
|
|
7689
|
+
hidden.remove();
|
|
7690
|
+
}
|
|
7691
|
+
if (result !== void 0) {
|
|
7692
|
+
return result;
|
|
7693
|
+
}
|
|
7694
|
+
return false;
|
|
7695
|
+
}
|
|
7696
|
+
return true;
|
|
7697
|
+
}
|
|
7698
|
+
if (validator.cancelSubmit) {
|
|
7699
|
+
validator.cancelSubmit = false;
|
|
7700
|
+
return handle();
|
|
7701
|
+
}
|
|
7702
|
+
if (validator.form()) {
|
|
7703
|
+
if (validator.pendingRequest) {
|
|
7704
|
+
validator.formSubmitted = true;
|
|
7705
|
+
return false;
|
|
7706
|
+
}
|
|
7707
|
+
return handle();
|
|
7708
|
+
} else {
|
|
7709
|
+
validator.focusInvalid();
|
|
7710
|
+
return false;
|
|
7711
|
+
}
|
|
7712
|
+
});
|
|
7713
|
+
}
|
|
7714
|
+
return validator;
|
|
7715
|
+
},
|
|
7716
|
+
// https://jqueryvalidation.org/valid/
|
|
7717
|
+
valid: function() {
|
|
7718
|
+
var valid, validator, errorList;
|
|
7719
|
+
if ($2(this[0]).is("form")) {
|
|
7720
|
+
valid = this.validate().form();
|
|
7721
|
+
} else {
|
|
7722
|
+
errorList = [];
|
|
7723
|
+
valid = true;
|
|
7724
|
+
validator = $2(this[0].form).validate();
|
|
7725
|
+
this.each(function() {
|
|
7726
|
+
valid = validator.element(this) && valid;
|
|
7727
|
+
if (!valid) {
|
|
7728
|
+
errorList = errorList.concat(validator.errorList);
|
|
7729
|
+
}
|
|
7730
|
+
});
|
|
7731
|
+
validator.errorList = errorList;
|
|
7732
|
+
}
|
|
7733
|
+
return valid;
|
|
7734
|
+
},
|
|
7735
|
+
// https://jqueryvalidation.org/rules/
|
|
7736
|
+
rules: function(command, argument) {
|
|
7737
|
+
var element = this[0], isContentEditable = typeof this.attr("contenteditable") !== "undefined" && this.attr("contenteditable") !== "false", settings, staticRules, existingRules, data, param, filtered;
|
|
7738
|
+
if (element == null) {
|
|
7739
|
+
return;
|
|
7740
|
+
}
|
|
7741
|
+
if (!element.form && isContentEditable) {
|
|
7742
|
+
element.form = this.closest("form")[0];
|
|
7743
|
+
element.name = this.attr("name");
|
|
7744
|
+
}
|
|
7745
|
+
if (element.form == null) {
|
|
7746
|
+
return;
|
|
7747
|
+
}
|
|
7748
|
+
if (command) {
|
|
7749
|
+
settings = $2.data(element.form, "validator").settings;
|
|
7750
|
+
staticRules = settings.rules;
|
|
7751
|
+
existingRules = $2.validator.staticRules(element);
|
|
7752
|
+
switch (command) {
|
|
7753
|
+
case "add":
|
|
7754
|
+
$2.extend(existingRules, $2.validator.normalizeRule(argument));
|
|
7755
|
+
delete existingRules.messages;
|
|
7756
|
+
staticRules[element.name] = existingRules;
|
|
7757
|
+
if (argument.messages) {
|
|
7758
|
+
settings.messages[element.name] = $2.extend(settings.messages[element.name], argument.messages);
|
|
7759
|
+
}
|
|
7760
|
+
break;
|
|
7761
|
+
case "remove":
|
|
7762
|
+
if (!argument) {
|
|
7763
|
+
delete staticRules[element.name];
|
|
7764
|
+
return existingRules;
|
|
7765
|
+
}
|
|
7766
|
+
filtered = {};
|
|
7767
|
+
$2.each(argument.split(/\s/), function(index, method) {
|
|
7768
|
+
filtered[method] = existingRules[method];
|
|
7769
|
+
delete existingRules[method];
|
|
7770
|
+
});
|
|
7771
|
+
return filtered;
|
|
7772
|
+
}
|
|
7773
|
+
}
|
|
7774
|
+
data = $2.validator.normalizeRules(
|
|
7775
|
+
$2.extend(
|
|
7776
|
+
{},
|
|
7777
|
+
$2.validator.classRules(element),
|
|
7778
|
+
$2.validator.attributeRules(element),
|
|
7779
|
+
$2.validator.dataRules(element),
|
|
7780
|
+
$2.validator.staticRules(element)
|
|
7781
|
+
),
|
|
7782
|
+
element
|
|
7783
|
+
);
|
|
7784
|
+
if (data.required) {
|
|
7785
|
+
param = data.required;
|
|
7786
|
+
delete data.required;
|
|
7787
|
+
data = $2.extend({ required: param }, data);
|
|
7788
|
+
}
|
|
7789
|
+
if (data.remote) {
|
|
7790
|
+
param = data.remote;
|
|
7791
|
+
delete data.remote;
|
|
7792
|
+
data = $2.extend(data, { remote: param });
|
|
7793
|
+
}
|
|
7794
|
+
return data;
|
|
7795
|
+
}
|
|
7796
|
+
});
|
|
7797
|
+
var trim = function(str) {
|
|
7798
|
+
return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
7799
|
+
};
|
|
7800
|
+
$2.extend($2.expr.pseudos || $2.expr[":"], {
|
|
7801
|
+
// '|| $.expr[ ":" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support
|
|
7802
|
+
// https://jqueryvalidation.org/blank-selector/
|
|
7803
|
+
blank: function(a) {
|
|
7804
|
+
return !trim("" + $2(a).val());
|
|
7805
|
+
},
|
|
7806
|
+
// https://jqueryvalidation.org/filled-selector/
|
|
7807
|
+
filled: function(a) {
|
|
7808
|
+
var val = $2(a).val();
|
|
7809
|
+
return val !== null && !!trim("" + val);
|
|
7810
|
+
},
|
|
7811
|
+
// https://jqueryvalidation.org/unchecked-selector/
|
|
7812
|
+
unchecked: function(a) {
|
|
7813
|
+
return !$2(a).prop("checked");
|
|
7814
|
+
}
|
|
7815
|
+
});
|
|
7816
|
+
$2.validator = function(options, form) {
|
|
7817
|
+
this.settings = $2.extend(true, {}, $2.validator.defaults, options);
|
|
7818
|
+
this.currentForm = form;
|
|
7819
|
+
this.init();
|
|
7820
|
+
};
|
|
7821
|
+
$2.validator.format = function(source, params) {
|
|
7822
|
+
if (arguments.length === 1) {
|
|
7823
|
+
return function() {
|
|
7824
|
+
var args = $2.makeArray(arguments);
|
|
7825
|
+
args.unshift(source);
|
|
7826
|
+
return $2.validator.format.apply(this, args);
|
|
7827
|
+
};
|
|
7828
|
+
}
|
|
7829
|
+
if (params === void 0) {
|
|
7830
|
+
return source;
|
|
7831
|
+
}
|
|
7832
|
+
if (arguments.length > 2 && params.constructor !== Array) {
|
|
7833
|
+
params = $2.makeArray(arguments).slice(1);
|
|
7834
|
+
}
|
|
7835
|
+
if (params.constructor !== Array) {
|
|
7836
|
+
params = [params];
|
|
7837
|
+
}
|
|
7838
|
+
$2.each(params, function(i, n) {
|
|
7839
|
+
source = source.replace(new RegExp("\\{" + i + "\\}", "g"), function() {
|
|
7840
|
+
return n;
|
|
7841
|
+
});
|
|
7842
|
+
});
|
|
7843
|
+
return source;
|
|
7844
|
+
};
|
|
7845
|
+
$2.extend($2.validator, {
|
|
7846
|
+
defaults: {
|
|
7847
|
+
messages: {},
|
|
7848
|
+
groups: {},
|
|
7849
|
+
rules: {},
|
|
7850
|
+
errorClass: "error",
|
|
7851
|
+
pendingClass: "pending",
|
|
7852
|
+
validClass: "valid",
|
|
7853
|
+
errorElement: "label",
|
|
7854
|
+
focusCleanup: false,
|
|
7855
|
+
focusInvalid: true,
|
|
7856
|
+
ariaDescribedByCleanup: false,
|
|
7857
|
+
errorContainer: $2([]),
|
|
7858
|
+
errorLabelContainer: $2([]),
|
|
7859
|
+
onsubmit: true,
|
|
7860
|
+
ignore: ":hidden",
|
|
7861
|
+
ignoreTitle: false,
|
|
7862
|
+
customElements: [],
|
|
7863
|
+
onfocusin: function(element) {
|
|
7864
|
+
this.lastActive = element;
|
|
7865
|
+
if (this.settings.focusCleanup) {
|
|
7866
|
+
if (this.settings.unhighlight) {
|
|
7867
|
+
this.settings.unhighlight.call(this, element, this.settings.errorClass, this.settings.validClass);
|
|
7868
|
+
}
|
|
7869
|
+
this.hideThese(this.errorsFor(element));
|
|
7870
|
+
}
|
|
7871
|
+
},
|
|
7872
|
+
onfocusout: function(element) {
|
|
7873
|
+
if (!this.checkable(element) && (element.name in this.submitted || !this.optional(element))) {
|
|
7874
|
+
this.element(element);
|
|
7875
|
+
}
|
|
7876
|
+
},
|
|
7877
|
+
onkeyup: function(element, event) {
|
|
7878
|
+
var excludedKeys = [
|
|
7879
|
+
16,
|
|
7880
|
+
17,
|
|
7881
|
+
18,
|
|
7882
|
+
20,
|
|
7883
|
+
35,
|
|
7884
|
+
36,
|
|
7885
|
+
37,
|
|
7886
|
+
38,
|
|
7887
|
+
39,
|
|
7888
|
+
40,
|
|
7889
|
+
45,
|
|
7890
|
+
144,
|
|
7891
|
+
225
|
|
7892
|
+
];
|
|
7893
|
+
if (event.which === 9 && this.elementValue(element) === "" || $2.inArray(event.keyCode, excludedKeys) !== -1) {
|
|
7894
|
+
return;
|
|
7895
|
+
} else if (element.name in this.submitted || element.name in this.invalid) {
|
|
7896
|
+
this.element(element);
|
|
7897
|
+
}
|
|
7898
|
+
},
|
|
7899
|
+
onclick: function(element) {
|
|
7900
|
+
if (element.name in this.submitted) {
|
|
7901
|
+
this.element(element);
|
|
7902
|
+
} else if (element.parentNode.name in this.submitted) {
|
|
7903
|
+
this.element(element.parentNode);
|
|
7904
|
+
}
|
|
7905
|
+
},
|
|
7906
|
+
highlight: function(element, errorClass, validClass) {
|
|
7907
|
+
if (element.type === "radio") {
|
|
7908
|
+
this.findByName(element.name).addClass(errorClass).removeClass(validClass);
|
|
7909
|
+
} else {
|
|
7910
|
+
$2(element).addClass(errorClass).removeClass(validClass);
|
|
7911
|
+
}
|
|
7912
|
+
},
|
|
7913
|
+
unhighlight: function(element, errorClass, validClass) {
|
|
7914
|
+
if (element.type === "radio") {
|
|
7915
|
+
this.findByName(element.name).removeClass(errorClass).addClass(validClass);
|
|
7916
|
+
} else {
|
|
7917
|
+
$2(element).removeClass(errorClass).addClass(validClass);
|
|
7918
|
+
}
|
|
7919
|
+
}
|
|
7920
|
+
},
|
|
7921
|
+
// https://jqueryvalidation.org/jQuery.validator.setDefaults/
|
|
7922
|
+
setDefaults: function(settings) {
|
|
7923
|
+
$2.extend($2.validator.defaults, settings);
|
|
7924
|
+
},
|
|
7925
|
+
messages: {
|
|
7926
|
+
required: "This field is required.",
|
|
7927
|
+
remote: "Please fix this field.",
|
|
7928
|
+
email: "Please enter a valid email address.",
|
|
7929
|
+
url: "Please enter a valid URL.",
|
|
7930
|
+
date: "Please enter a valid date.",
|
|
7931
|
+
dateISO: "Please enter a valid date (ISO).",
|
|
7932
|
+
number: "Please enter a valid number.",
|
|
7933
|
+
digits: "Please enter only digits.",
|
|
7934
|
+
equalTo: "Please enter the same value again.",
|
|
7935
|
+
maxlength: $2.validator.format("Please enter no more than {0} characters."),
|
|
7936
|
+
minlength: $2.validator.format("Please enter at least {0} characters."),
|
|
7937
|
+
rangelength: $2.validator.format("Please enter a value between {0} and {1} characters long."),
|
|
7938
|
+
range: $2.validator.format("Please enter a value between {0} and {1}."),
|
|
7939
|
+
max: $2.validator.format("Please enter a value less than or equal to {0}."),
|
|
7940
|
+
min: $2.validator.format("Please enter a value greater than or equal to {0}."),
|
|
7941
|
+
step: $2.validator.format("Please enter a multiple of {0}.")
|
|
7942
|
+
},
|
|
7943
|
+
autoCreateRanges: false,
|
|
7944
|
+
prototype: {
|
|
7945
|
+
init: function() {
|
|
7946
|
+
this.labelContainer = $2(this.settings.errorLabelContainer);
|
|
7947
|
+
this.errorContext = this.labelContainer.length && this.labelContainer || $2(this.currentForm);
|
|
7948
|
+
this.containers = $2(this.settings.errorContainer).add(this.settings.errorLabelContainer);
|
|
7949
|
+
this.submitted = {};
|
|
7950
|
+
this.valueCache = {};
|
|
7951
|
+
this.pendingRequest = 0;
|
|
7952
|
+
this.pending = {};
|
|
7953
|
+
this.invalid = {};
|
|
7954
|
+
this.reset();
|
|
7955
|
+
var currentForm = this.currentForm, groups = this.groups = {}, rules;
|
|
7956
|
+
$2.each(this.settings.groups, function(key, value) {
|
|
7957
|
+
if (typeof value === "string") {
|
|
7958
|
+
value = value.split(/\s/);
|
|
7959
|
+
}
|
|
7960
|
+
$2.each(value, function(index, name) {
|
|
7961
|
+
groups[name] = key;
|
|
7962
|
+
});
|
|
7963
|
+
});
|
|
7964
|
+
rules = this.settings.rules;
|
|
7965
|
+
$2.each(rules, function(key, value) {
|
|
7966
|
+
rules[key] = $2.validator.normalizeRule(value);
|
|
7967
|
+
});
|
|
7968
|
+
function delegate(event) {
|
|
7969
|
+
var isContentEditable = typeof $2(this).attr("contenteditable") !== "undefined" && $2(this).attr("contenteditable") !== "false";
|
|
7970
|
+
if (!this.form && isContentEditable) {
|
|
7971
|
+
this.form = $2(this).closest("form")[0];
|
|
7972
|
+
this.name = $2(this).attr("name");
|
|
7973
|
+
}
|
|
7974
|
+
if (currentForm !== this.form) {
|
|
7975
|
+
return;
|
|
7976
|
+
}
|
|
7977
|
+
var validator = $2.data(this.form, "validator"), eventType = "on" + event.type.replace(/^validate/, ""), settings = validator.settings;
|
|
7978
|
+
if (settings[eventType] && !$2(this).is(settings.ignore)) {
|
|
7979
|
+
settings[eventType].call(validator, this, event);
|
|
7980
|
+
}
|
|
7981
|
+
}
|
|
7982
|
+
var focusListeners = [
|
|
7983
|
+
":text",
|
|
7984
|
+
"[type='password']",
|
|
7985
|
+
"[type='file']",
|
|
7986
|
+
"select",
|
|
7987
|
+
"textarea",
|
|
7988
|
+
"[type='number']",
|
|
7989
|
+
"[type='search']",
|
|
7990
|
+
"[type='tel']",
|
|
7991
|
+
"[type='url']",
|
|
7992
|
+
"[type='email']",
|
|
7993
|
+
"[type='datetime']",
|
|
7994
|
+
"[type='date']",
|
|
7995
|
+
"[type='month']",
|
|
7996
|
+
"[type='week']",
|
|
7997
|
+
"[type='time']",
|
|
7998
|
+
"[type='datetime-local']",
|
|
7999
|
+
"[type='range']",
|
|
8000
|
+
"[type='color']",
|
|
8001
|
+
"[type='radio']",
|
|
8002
|
+
"[type='checkbox']",
|
|
8003
|
+
"[contenteditable]",
|
|
8004
|
+
"[type='button']"
|
|
8005
|
+
];
|
|
8006
|
+
var clickListeners = ["select", "option", "[type='radio']", "[type='checkbox']"];
|
|
8007
|
+
$2(this.currentForm).on("focusin.validate focusout.validate keyup.validate", focusListeners.concat(this.settings.customElements).join(", "), delegate).on("click.validate", clickListeners.concat(this.settings.customElements).join(", "), delegate);
|
|
8008
|
+
if (this.settings.invalidHandler) {
|
|
8009
|
+
$2(this.currentForm).on("invalid-form.validate", this.settings.invalidHandler);
|
|
8010
|
+
}
|
|
8011
|
+
},
|
|
8012
|
+
// https://jqueryvalidation.org/Validator.form/
|
|
8013
|
+
form: function() {
|
|
8014
|
+
this.checkForm();
|
|
8015
|
+
$2.extend(this.submitted, this.errorMap);
|
|
8016
|
+
this.invalid = $2.extend({}, this.errorMap);
|
|
8017
|
+
if (!this.valid()) {
|
|
8018
|
+
$2(this.currentForm).triggerHandler("invalid-form", [this]);
|
|
8019
|
+
}
|
|
8020
|
+
this.showErrors();
|
|
8021
|
+
return this.valid();
|
|
8022
|
+
},
|
|
8023
|
+
checkForm: function() {
|
|
8024
|
+
this.prepareForm();
|
|
8025
|
+
for (var i = 0, elements = this.currentElements = this.elements(); elements[i]; i++) {
|
|
8026
|
+
this.check(elements[i]);
|
|
8027
|
+
}
|
|
8028
|
+
return this.valid();
|
|
8029
|
+
},
|
|
8030
|
+
// https://jqueryvalidation.org/Validator.element/
|
|
8031
|
+
element: function(element) {
|
|
8032
|
+
var cleanElement = this.clean(element), checkElement = this.validationTargetFor(cleanElement), v = this, result = true, rs, group;
|
|
8033
|
+
if (checkElement === void 0) {
|
|
8034
|
+
delete this.invalid[cleanElement.name];
|
|
8035
|
+
} else {
|
|
8036
|
+
this.prepareElement(checkElement);
|
|
8037
|
+
this.currentElements = $2(checkElement);
|
|
8038
|
+
group = this.groups[checkElement.name];
|
|
8039
|
+
if (group) {
|
|
8040
|
+
$2.each(this.groups, function(name, testgroup) {
|
|
8041
|
+
if (testgroup === group && name !== checkElement.name) {
|
|
8042
|
+
cleanElement = v.validationTargetFor(v.clean(v.findByName(name)));
|
|
8043
|
+
if (cleanElement && cleanElement.name in v.invalid) {
|
|
8044
|
+
v.currentElements.pushStack(cleanElement);
|
|
8045
|
+
result = v.check(cleanElement) && result;
|
|
8046
|
+
}
|
|
8047
|
+
}
|
|
8048
|
+
});
|
|
8049
|
+
}
|
|
8050
|
+
rs = this.check(checkElement) !== false;
|
|
8051
|
+
result = result && rs;
|
|
8052
|
+
if (rs) {
|
|
8053
|
+
this.invalid[checkElement.name] = false;
|
|
8054
|
+
} else {
|
|
8055
|
+
this.invalid[checkElement.name] = true;
|
|
8056
|
+
}
|
|
8057
|
+
if (!this.numberOfInvalids()) {
|
|
8058
|
+
this.toHide = this.toHide.add(this.containers);
|
|
8059
|
+
}
|
|
8060
|
+
this.showErrors();
|
|
8061
|
+
$2(element).attr("aria-invalid", !rs);
|
|
8062
|
+
}
|
|
8063
|
+
return result;
|
|
8064
|
+
},
|
|
8065
|
+
// https://jqueryvalidation.org/Validator.showErrors/
|
|
8066
|
+
showErrors: function(errors) {
|
|
8067
|
+
if (errors) {
|
|
8068
|
+
var validator = this;
|
|
8069
|
+
$2.extend(this.errorMap, errors);
|
|
8070
|
+
this.errorList = $2.map(this.errorMap, function(message, name) {
|
|
8071
|
+
return {
|
|
8072
|
+
message,
|
|
8073
|
+
element: validator.findByName(name)[0]
|
|
8074
|
+
};
|
|
8075
|
+
});
|
|
8076
|
+
this.successList = $2.grep(this.successList, function(element) {
|
|
8077
|
+
return !(element.name in errors);
|
|
8078
|
+
});
|
|
8079
|
+
}
|
|
8080
|
+
if (this.settings.showErrors) {
|
|
8081
|
+
this.settings.showErrors.call(this, this.errorMap, this.errorList);
|
|
8082
|
+
} else {
|
|
8083
|
+
this.defaultShowErrors();
|
|
8084
|
+
}
|
|
8085
|
+
},
|
|
8086
|
+
// https://jqueryvalidation.org/Validator.resetForm/
|
|
8087
|
+
resetForm: function() {
|
|
8088
|
+
if ($2.fn.resetForm) {
|
|
8089
|
+
$2(this.currentForm).resetForm();
|
|
8090
|
+
}
|
|
8091
|
+
this.invalid = {};
|
|
8092
|
+
this.submitted = {};
|
|
8093
|
+
this.prepareForm();
|
|
8094
|
+
this.hideErrors();
|
|
8095
|
+
var elements = this.elements().removeData("previousValue").removeAttr("aria-invalid");
|
|
8096
|
+
this.resetElements(elements);
|
|
8097
|
+
},
|
|
8098
|
+
resetElements: function(elements) {
|
|
8099
|
+
var i;
|
|
8100
|
+
if (this.settings.unhighlight) {
|
|
8101
|
+
for (i = 0; elements[i]; i++) {
|
|
8102
|
+
this.settings.unhighlight.call(
|
|
8103
|
+
this,
|
|
8104
|
+
elements[i],
|
|
8105
|
+
this.settings.errorClass,
|
|
8106
|
+
""
|
|
8107
|
+
);
|
|
8108
|
+
this.findByName(elements[i].name).removeClass(this.settings.validClass);
|
|
8109
|
+
}
|
|
8110
|
+
} else {
|
|
8111
|
+
elements.removeClass(this.settings.errorClass).removeClass(this.settings.validClass);
|
|
8112
|
+
}
|
|
8113
|
+
},
|
|
8114
|
+
numberOfInvalids: function() {
|
|
8115
|
+
return this.objectLength(this.invalid);
|
|
8116
|
+
},
|
|
8117
|
+
objectLength: function(obj) {
|
|
8118
|
+
var count = 0, i;
|
|
8119
|
+
for (i in obj) {
|
|
8120
|
+
if (obj[i] !== void 0 && obj[i] !== null && obj[i] !== false) {
|
|
8121
|
+
count++;
|
|
8122
|
+
}
|
|
8123
|
+
}
|
|
8124
|
+
return count;
|
|
8125
|
+
},
|
|
8126
|
+
hideErrors: function() {
|
|
8127
|
+
this.hideThese(this.toHide);
|
|
8128
|
+
},
|
|
8129
|
+
addErrorAriaDescribedBy: function(element, error, updateGroupMembers) {
|
|
8130
|
+
updateGroupMembers = updateGroupMembers === void 0 ? false : updateGroupMembers;
|
|
8131
|
+
var errorID, v, group, describedBy = $2(element).attr("aria-describedby");
|
|
8132
|
+
errorID = error.attr("id");
|
|
8133
|
+
if (!describedBy) {
|
|
8134
|
+
describedBy = errorID;
|
|
8135
|
+
} else if (!describedBy.match(new RegExp("\\b" + this.escapeCssMeta(errorID) + "\\b"))) {
|
|
8136
|
+
describedBy += " " + errorID;
|
|
8137
|
+
}
|
|
8138
|
+
$2(element).attr("aria-describedby", describedBy);
|
|
8139
|
+
if (updateGroupMembers) {
|
|
8140
|
+
group = this.groups[element.name];
|
|
8141
|
+
if (group) {
|
|
8142
|
+
v = this;
|
|
8143
|
+
$2.each(v.groups, function(name, testgroup) {
|
|
8144
|
+
if (testgroup === group) {
|
|
8145
|
+
v.addErrorAriaDescribedBy($2("[name='" + v.escapeCssMeta(name) + "']", v.currentForm), error, false);
|
|
8146
|
+
}
|
|
8147
|
+
});
|
|
8148
|
+
}
|
|
8149
|
+
}
|
|
8150
|
+
},
|
|
8151
|
+
removeErrorAriaDescribedBy: function(element, error) {
|
|
8152
|
+
var describedBy = $2(element).attr("aria-describedby"), describedByIds = describedBy.split(" "), errorID = error.attr("id"), ind = describedByIds.indexOf(errorID);
|
|
8153
|
+
if (ind > -1) {
|
|
8154
|
+
describedByIds.splice(ind, 1);
|
|
8155
|
+
}
|
|
8156
|
+
if (describedByIds.length) {
|
|
8157
|
+
$2(element).attr("aria-describedby", describedByIds.join(" "));
|
|
8158
|
+
} else {
|
|
8159
|
+
$2(element).removeAttr("aria-describedby");
|
|
8160
|
+
}
|
|
8161
|
+
},
|
|
8162
|
+
hideThese: function(errors) {
|
|
8163
|
+
for (var i = 0; errors[i]; i++) {
|
|
8164
|
+
var error = $2(errors[i]), errorID = error.attr("id") ? this.escapeCssMeta(error.attr("id")) : void 0, element = errorID ? this.elements().filter('[aria-describedby~="' + errorID + '"]') : [];
|
|
8165
|
+
if (this.settings.ariaDescribedByCleanup && element.length) {
|
|
8166
|
+
this.removeErrorAriaDescribedBy(element, error);
|
|
8167
|
+
}
|
|
8168
|
+
if (!error.is(this.containers)) {
|
|
8169
|
+
error.text("");
|
|
8170
|
+
}
|
|
8171
|
+
this.addWrapper(error).hide();
|
|
8172
|
+
}
|
|
8173
|
+
},
|
|
8174
|
+
valid: function() {
|
|
8175
|
+
return this.size() === 0;
|
|
8176
|
+
},
|
|
8177
|
+
size: function() {
|
|
8178
|
+
return this.errorList.length;
|
|
8179
|
+
},
|
|
8180
|
+
focusInvalid: function() {
|
|
8181
|
+
if (this.settings.focusInvalid) {
|
|
8182
|
+
try {
|
|
8183
|
+
$2(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible").trigger("focus").trigger("focusin");
|
|
8184
|
+
} catch (e) {
|
|
8185
|
+
}
|
|
8186
|
+
}
|
|
8187
|
+
},
|
|
8188
|
+
findLastActive: function() {
|
|
8189
|
+
var lastActive = this.lastActive;
|
|
8190
|
+
return lastActive && $2.grep(this.errorList, function(n) {
|
|
8191
|
+
return n.element.name === lastActive.name;
|
|
8192
|
+
}).length === 1 && lastActive;
|
|
8193
|
+
},
|
|
8194
|
+
elements: function() {
|
|
8195
|
+
var validator = this, rulesCache = {}, selectors = ["input", "select", "textarea", "[contenteditable]"], formId = this.currentForm.id, elements;
|
|
8196
|
+
elements = $2(this.currentForm).find(selectors.concat(this.settings.customElements).join(", ")).not(":submit, :reset, :image, :disabled").not(this.settings.ignore);
|
|
8197
|
+
if (formId) {
|
|
8198
|
+
elements = elements.add(
|
|
8199
|
+
$2(selectors.concat(this.settings.customElements).join(", ")).filter("[form='" + validator.escapeCssMeta(formId) + "']").not(":submit, :reset, :image, :disabled").not(this.settings.ignore)
|
|
8200
|
+
);
|
|
8201
|
+
}
|
|
8202
|
+
return elements.filter(function() {
|
|
8203
|
+
var name = this.name || $2(this).attr("name");
|
|
8204
|
+
var isContentEditable = typeof $2(this).attr("contenteditable") !== "undefined" && $2(this).attr("contenteditable") !== "false";
|
|
8205
|
+
if (!name && validator.settings.debug && window.console) {
|
|
8206
|
+
console.error("%o has no name assigned", this);
|
|
8207
|
+
}
|
|
8208
|
+
if (isContentEditable) {
|
|
8209
|
+
this.form = $2(this).closest("form")[0];
|
|
8210
|
+
this.name = name;
|
|
8211
|
+
}
|
|
8212
|
+
if (this.form !== validator.currentForm) {
|
|
8213
|
+
return false;
|
|
8214
|
+
}
|
|
8215
|
+
if (name in rulesCache || !validator.objectLength($2(this).rules())) {
|
|
8216
|
+
return false;
|
|
8217
|
+
}
|
|
8218
|
+
rulesCache[name] = true;
|
|
8219
|
+
return true;
|
|
8220
|
+
});
|
|
8221
|
+
},
|
|
8222
|
+
clean: function(selector) {
|
|
8223
|
+
return $2(selector)[0];
|
|
8224
|
+
},
|
|
8225
|
+
errors: function() {
|
|
8226
|
+
var errorClass = this.settings.errorClass.split(" ").join(".");
|
|
8227
|
+
return $2(this.settings.errorElement + "." + errorClass, this.errorContext);
|
|
8228
|
+
},
|
|
8229
|
+
resetInternals: function() {
|
|
8230
|
+
this.successList = [];
|
|
8231
|
+
this.errorList = [];
|
|
8232
|
+
this.errorMap = {};
|
|
8233
|
+
this.toShow = $2([]);
|
|
8234
|
+
this.toHide = $2([]);
|
|
8235
|
+
},
|
|
8236
|
+
reset: function() {
|
|
8237
|
+
this.resetInternals();
|
|
8238
|
+
this.currentElements = $2([]);
|
|
8239
|
+
},
|
|
8240
|
+
prepareForm: function() {
|
|
8241
|
+
this.reset();
|
|
8242
|
+
this.toHide = this.errors().add(this.containers);
|
|
8243
|
+
},
|
|
8244
|
+
prepareElement: function(element) {
|
|
8245
|
+
this.reset();
|
|
8246
|
+
this.toHide = this.errorsFor(element);
|
|
8247
|
+
},
|
|
8248
|
+
elementValue: function(element) {
|
|
8249
|
+
var $element = $2(element), type = element.type, isContentEditable = typeof $element.attr("contenteditable") !== "undefined" && $element.attr("contenteditable") !== "false", val, idx;
|
|
8250
|
+
if (type === "radio" || type === "checkbox") {
|
|
8251
|
+
return this.findByName(element.name).filter(":checked").val();
|
|
8252
|
+
} else if (type === "number" && typeof element.validity !== "undefined") {
|
|
8253
|
+
return element.validity.badInput ? "NaN" : $element.val();
|
|
8254
|
+
}
|
|
8255
|
+
if (isContentEditable) {
|
|
8256
|
+
val = $element.text();
|
|
8257
|
+
} else {
|
|
8258
|
+
val = $element.val();
|
|
8259
|
+
}
|
|
8260
|
+
if (type === "file") {
|
|
8261
|
+
if (val.substr(0, 12) === "C:\\fakepath\\") {
|
|
8262
|
+
return val.substr(12);
|
|
8263
|
+
}
|
|
8264
|
+
idx = val.lastIndexOf("/");
|
|
8265
|
+
if (idx >= 0) {
|
|
8266
|
+
return val.substr(idx + 1);
|
|
8267
|
+
}
|
|
8268
|
+
idx = val.lastIndexOf("\\");
|
|
8269
|
+
if (idx >= 0) {
|
|
8270
|
+
return val.substr(idx + 1);
|
|
8271
|
+
}
|
|
8272
|
+
return val;
|
|
8273
|
+
}
|
|
8274
|
+
if (typeof val === "string") {
|
|
8275
|
+
return val.replace(/\r/g, "");
|
|
8276
|
+
}
|
|
8277
|
+
return val;
|
|
8278
|
+
},
|
|
8279
|
+
check: function(element) {
|
|
8280
|
+
element = this.validationTargetFor(this.clean(element));
|
|
8281
|
+
var rules = $2(element).rules(), rulesCount = $2.map(rules, function(n, i) {
|
|
8282
|
+
return i;
|
|
8283
|
+
}).length, dependencyMismatch = false, val = this.elementValue(element), result, method, rule, normalizer;
|
|
8284
|
+
this.abortRequest(element);
|
|
8285
|
+
if (typeof rules.normalizer === "function") {
|
|
8286
|
+
normalizer = rules.normalizer;
|
|
8287
|
+
} else if (typeof this.settings.normalizer === "function") {
|
|
8288
|
+
normalizer = this.settings.normalizer;
|
|
8289
|
+
}
|
|
8290
|
+
if (normalizer) {
|
|
8291
|
+
val = normalizer.call(element, val);
|
|
8292
|
+
delete rules.normalizer;
|
|
8293
|
+
}
|
|
8294
|
+
for (method in rules) {
|
|
8295
|
+
rule = { method, parameters: rules[method] };
|
|
8296
|
+
try {
|
|
8297
|
+
result = $2.validator.methods[method].call(this, val, element, rule.parameters);
|
|
8298
|
+
if (result === "dependency-mismatch" && rulesCount === 1) {
|
|
8299
|
+
dependencyMismatch = true;
|
|
8300
|
+
continue;
|
|
8301
|
+
}
|
|
8302
|
+
dependencyMismatch = false;
|
|
8303
|
+
if (result === "pending") {
|
|
8304
|
+
this.toHide = this.toHide.not(this.errorsFor(element));
|
|
8305
|
+
return;
|
|
8306
|
+
}
|
|
8307
|
+
if (!result) {
|
|
8308
|
+
this.formatAndAdd(element, rule);
|
|
8309
|
+
return false;
|
|
8310
|
+
}
|
|
8311
|
+
} catch (e) {
|
|
8312
|
+
if (this.settings.debug && window.console) {
|
|
8313
|
+
console.log("Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e);
|
|
8314
|
+
}
|
|
8315
|
+
if (e instanceof TypeError) {
|
|
8316
|
+
e.message += ". Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.";
|
|
8317
|
+
}
|
|
8318
|
+
throw e;
|
|
8319
|
+
}
|
|
8320
|
+
}
|
|
8321
|
+
if (dependencyMismatch) {
|
|
8322
|
+
return;
|
|
8323
|
+
}
|
|
8324
|
+
if (this.objectLength(rules)) {
|
|
8325
|
+
this.successList.push(element);
|
|
8326
|
+
}
|
|
8327
|
+
return true;
|
|
8328
|
+
},
|
|
8329
|
+
// Return the custom message for the given element and validation method
|
|
8330
|
+
// specified in the element's HTML5 data attribute
|
|
8331
|
+
// return the generic message if present and no method specific message is present
|
|
8332
|
+
customDataMessage: function(element, method) {
|
|
8333
|
+
return $2(element).data("msg" + method.charAt(0).toUpperCase() + method.substring(1).toLowerCase()) || $2(element).data("msg");
|
|
8334
|
+
},
|
|
8335
|
+
// Return the custom message for the given element name and validation method
|
|
8336
|
+
customMessage: function(name, method) {
|
|
8337
|
+
var m = this.settings.messages[name];
|
|
8338
|
+
return m && (m.constructor === String ? m : m[method]);
|
|
8339
|
+
},
|
|
8340
|
+
// Return the first defined argument, allowing empty strings
|
|
8341
|
+
findDefined: function() {
|
|
8342
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
8343
|
+
if (arguments[i] !== void 0) {
|
|
8344
|
+
return arguments[i];
|
|
8345
|
+
}
|
|
8346
|
+
}
|
|
8347
|
+
return void 0;
|
|
8348
|
+
},
|
|
8349
|
+
// The second parameter 'rule' used to be a string, and extended to an object literal
|
|
8350
|
+
// of the following form:
|
|
8351
|
+
// rule = {
|
|
8352
|
+
// method: "method name",
|
|
8353
|
+
// parameters: "the given method parameters"
|
|
8354
|
+
// }
|
|
8355
|
+
//
|
|
8356
|
+
// The old behavior still supported, kept to maintain backward compatibility with
|
|
8357
|
+
// old code, and will be removed in the next major release.
|
|
8358
|
+
defaultMessage: function(element, rule) {
|
|
8359
|
+
if (typeof rule === "string") {
|
|
8360
|
+
rule = { method: rule };
|
|
8361
|
+
}
|
|
8362
|
+
var message = this.findDefined(
|
|
8363
|
+
this.customMessage(element.name, rule.method),
|
|
8364
|
+
this.customDataMessage(element, rule.method),
|
|
8365
|
+
// 'title' is never undefined, so handle empty string as undefined
|
|
8366
|
+
!this.settings.ignoreTitle && element.title || void 0,
|
|
8367
|
+
$2.validator.messages[rule.method],
|
|
8368
|
+
"<strong>Warning: No message defined for " + element.name + "</strong>"
|
|
8369
|
+
), theregex = /\$?\{(\d+)\}/g;
|
|
8370
|
+
if (typeof message === "function") {
|
|
8371
|
+
message = message.call(this, rule.parameters, element);
|
|
8372
|
+
} else if (theregex.test(message)) {
|
|
8373
|
+
message = $2.validator.format(message.replace(theregex, "{$1}"), rule.parameters);
|
|
8374
|
+
}
|
|
8375
|
+
return message;
|
|
8376
|
+
},
|
|
8377
|
+
formatAndAdd: function(element, rule) {
|
|
8378
|
+
var message = this.defaultMessage(element, rule);
|
|
8379
|
+
this.errorList.push({
|
|
8380
|
+
message,
|
|
8381
|
+
element,
|
|
8382
|
+
method: rule.method
|
|
8383
|
+
});
|
|
8384
|
+
this.errorMap[element.name] = message;
|
|
8385
|
+
this.submitted[element.name] = message;
|
|
8386
|
+
},
|
|
8387
|
+
addWrapper: function(toToggle) {
|
|
8388
|
+
if (this.settings.wrapper) {
|
|
8389
|
+
toToggle = toToggle.add(toToggle.parent(this.settings.wrapper));
|
|
8390
|
+
}
|
|
8391
|
+
return toToggle;
|
|
8392
|
+
},
|
|
8393
|
+
defaultShowErrors: function() {
|
|
8394
|
+
var i, elements, error;
|
|
8395
|
+
for (i = 0; this.errorList[i]; i++) {
|
|
8396
|
+
error = this.errorList[i];
|
|
8397
|
+
if (this.settings.highlight) {
|
|
8398
|
+
this.settings.highlight.call(this, error.element, this.settings.errorClass, this.settings.validClass);
|
|
8399
|
+
}
|
|
8400
|
+
this.showLabel(error.element, error.message);
|
|
8401
|
+
}
|
|
8402
|
+
if (this.errorList.length) {
|
|
8403
|
+
this.toShow = this.toShow.add(this.containers);
|
|
8404
|
+
}
|
|
8405
|
+
if (this.settings.success) {
|
|
8406
|
+
for (i = 0; this.successList[i]; i++) {
|
|
8407
|
+
this.showLabel(this.successList[i]);
|
|
8408
|
+
}
|
|
8409
|
+
}
|
|
8410
|
+
if (this.settings.unhighlight) {
|
|
8411
|
+
for (i = 0, elements = this.validElements(); elements[i]; i++) {
|
|
8412
|
+
this.settings.unhighlight.call(this, elements[i], this.settings.errorClass, this.settings.validClass);
|
|
8413
|
+
}
|
|
8414
|
+
}
|
|
8415
|
+
this.toHide = this.toHide.not(this.toShow);
|
|
8416
|
+
this.hideErrors();
|
|
8417
|
+
this.addWrapper(this.toShow).show();
|
|
8418
|
+
},
|
|
8419
|
+
validElements: function() {
|
|
8420
|
+
return this.currentElements.not(this.invalidElements());
|
|
8421
|
+
},
|
|
8422
|
+
invalidElements: function() {
|
|
8423
|
+
return $2(this.errorList).map(function() {
|
|
8424
|
+
return this.element;
|
|
8425
|
+
});
|
|
8426
|
+
},
|
|
8427
|
+
showLabel: function(element, message) {
|
|
8428
|
+
var place, error = this.errorsFor(element), elementID = this.idOrName(element), describedBy = $2(element).attr("aria-describedby");
|
|
8429
|
+
if (error.length) {
|
|
8430
|
+
if (error.closest("label[for='" + this.escapeCssMeta(elementID) + "']").length === 0 && (describedBy === void 0 || describedBy.split(" ").indexOf(error.attr("id")) === -1)) {
|
|
8431
|
+
this.addErrorAriaDescribedBy(element, error, true);
|
|
8432
|
+
}
|
|
8433
|
+
error.removeClass(this.settings.validClass).addClass(this.settings.errorClass);
|
|
8434
|
+
if (this.settings && this.settings.escapeHtml) {
|
|
8435
|
+
error.text(message || "");
|
|
8436
|
+
} else {
|
|
8437
|
+
error.html(message || "");
|
|
8438
|
+
}
|
|
8439
|
+
} else {
|
|
8440
|
+
error = $2("<" + this.settings.errorElement + ">").attr("id", elementID + "-error").addClass(this.settings.errorClass);
|
|
8441
|
+
if (this.settings && this.settings.escapeHtml) {
|
|
8442
|
+
error.text(message || "");
|
|
8443
|
+
} else {
|
|
8444
|
+
error.html(message || "");
|
|
8445
|
+
}
|
|
8446
|
+
place = error;
|
|
8447
|
+
if (this.settings.wrapper) {
|
|
8448
|
+
place = error.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
|
|
8449
|
+
}
|
|
8450
|
+
if (this.labelContainer.length) {
|
|
8451
|
+
this.labelContainer.append(place);
|
|
8452
|
+
} else if (this.settings.errorPlacement) {
|
|
8453
|
+
this.settings.errorPlacement.call(this, place, $2(element));
|
|
8454
|
+
} else {
|
|
8455
|
+
place.insertAfter(element);
|
|
8456
|
+
}
|
|
8457
|
+
if (error.is("label")) {
|
|
8458
|
+
error.attr("for", elementID);
|
|
8459
|
+
} else if (error.parents("label[for='" + this.escapeCssMeta(elementID) + "']").length === 0) {
|
|
8460
|
+
this.addErrorAriaDescribedBy(element, error, true);
|
|
8461
|
+
}
|
|
8462
|
+
}
|
|
8463
|
+
if (!message && this.settings.success) {
|
|
8464
|
+
error.text("");
|
|
8465
|
+
if (typeof this.settings.success === "string") {
|
|
8466
|
+
error.addClass(this.settings.success);
|
|
8467
|
+
} else {
|
|
8468
|
+
this.settings.success(error, element);
|
|
8469
|
+
}
|
|
8470
|
+
}
|
|
8471
|
+
this.toShow = this.toShow.add(error);
|
|
8472
|
+
},
|
|
8473
|
+
errorsFor: function(element) {
|
|
8474
|
+
var name = this.escapeCssMeta(this.idOrName(element)), describer = $2(element).attr("aria-describedby"), selector = "label[for='" + name + "'], label[for='" + name + "'] *";
|
|
8475
|
+
if (describer) {
|
|
8476
|
+
selector = selector + ", #" + this.escapeCssMeta(describer).replace(/\s+/g, ", #");
|
|
8477
|
+
}
|
|
8478
|
+
selector = selector + ", #" + name + "-error";
|
|
8479
|
+
return this.errors().filter(selector);
|
|
8480
|
+
},
|
|
8481
|
+
// See https://api.jquery.com/category/selectors/, for CSS
|
|
8482
|
+
// meta-characters that should be escaped in order to be used with JQuery
|
|
8483
|
+
// as a literal part of a name/id or any selector.
|
|
8484
|
+
escapeCssMeta: function(string) {
|
|
8485
|
+
if (string === void 0) {
|
|
8486
|
+
return "";
|
|
8487
|
+
}
|
|
8488
|
+
return string.replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1");
|
|
8489
|
+
},
|
|
8490
|
+
idOrName: function(element) {
|
|
8491
|
+
return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
|
|
8492
|
+
},
|
|
8493
|
+
validationTargetFor: function(element) {
|
|
8494
|
+
if (this.checkable(element)) {
|
|
8495
|
+
element = this.findByName(element.name);
|
|
8496
|
+
}
|
|
8497
|
+
return $2(element).not(this.settings.ignore)[0];
|
|
8498
|
+
},
|
|
8499
|
+
checkable: function(element) {
|
|
8500
|
+
return /radio|checkbox/i.test(element.type);
|
|
8501
|
+
},
|
|
8502
|
+
findByName: function(name) {
|
|
8503
|
+
var formId = this.currentForm.id, selector = "[name='" + this.escapeCssMeta(name) + "']", elements = $2(this.currentForm).find(selector);
|
|
8504
|
+
if (formId) {
|
|
8505
|
+
elements = elements.add(
|
|
8506
|
+
$2(selector).filter("[form='" + this.escapeCssMeta(formId) + "']")
|
|
8507
|
+
);
|
|
8508
|
+
}
|
|
8509
|
+
return elements;
|
|
8510
|
+
},
|
|
8511
|
+
getLength: function(value, element) {
|
|
8512
|
+
switch (element.nodeName.toLowerCase()) {
|
|
8513
|
+
case "select":
|
|
8514
|
+
return $2("option:selected", element).length;
|
|
8515
|
+
case "input":
|
|
8516
|
+
if (this.checkable(element)) {
|
|
8517
|
+
return this.findByName(element.name).filter(":checked").length;
|
|
8518
|
+
}
|
|
8519
|
+
}
|
|
8520
|
+
return value.length;
|
|
8521
|
+
},
|
|
8522
|
+
depend: function(param, element) {
|
|
8523
|
+
return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true;
|
|
8524
|
+
},
|
|
8525
|
+
dependTypes: {
|
|
8526
|
+
"boolean": function(param) {
|
|
8527
|
+
return param;
|
|
8528
|
+
},
|
|
8529
|
+
"string": function(param, element) {
|
|
8530
|
+
return !!$2(param, element.form).length;
|
|
8531
|
+
},
|
|
8532
|
+
"function": function(param, element) {
|
|
8533
|
+
return param(element);
|
|
8534
|
+
}
|
|
8535
|
+
},
|
|
8536
|
+
optional: function(element) {
|
|
8537
|
+
var val = this.elementValue(element);
|
|
8538
|
+
return !$2.validator.methods.required.call(this, val, element) && "dependency-mismatch";
|
|
8539
|
+
},
|
|
8540
|
+
elementAjaxPort: function(element) {
|
|
8541
|
+
return "validate" + element.name;
|
|
8542
|
+
},
|
|
8543
|
+
startRequest: function(element) {
|
|
8544
|
+
if (!this.pending[element.name]) {
|
|
8545
|
+
this.pendingRequest++;
|
|
8546
|
+
$2(element).addClass(this.settings.pendingClass);
|
|
8547
|
+
this.pending[element.name] = true;
|
|
8548
|
+
}
|
|
8549
|
+
},
|
|
8550
|
+
stopRequest: function(element, valid) {
|
|
8551
|
+
this.pendingRequest--;
|
|
8552
|
+
if (this.pendingRequest < 0) {
|
|
8553
|
+
this.pendingRequest = 0;
|
|
8554
|
+
}
|
|
8555
|
+
delete this.pending[element.name];
|
|
8556
|
+
$2(element).removeClass(this.settings.pendingClass);
|
|
8557
|
+
if (valid && this.pendingRequest === 0 && this.formSubmitted && this.form() && this.pendingRequest === 0) {
|
|
8558
|
+
$2(this.currentForm).trigger("submit");
|
|
8559
|
+
if (this.submitButton) {
|
|
8560
|
+
$2("input:hidden[name='" + this.submitButton.name + "']", this.currentForm).remove();
|
|
8561
|
+
}
|
|
8562
|
+
this.formSubmitted = false;
|
|
8563
|
+
} else if (!valid && this.pendingRequest === 0 && this.formSubmitted) {
|
|
8564
|
+
$2(this.currentForm).triggerHandler("invalid-form", [this]);
|
|
8565
|
+
this.formSubmitted = false;
|
|
8566
|
+
}
|
|
8567
|
+
},
|
|
8568
|
+
abortRequest: function(element) {
|
|
8569
|
+
var port;
|
|
8570
|
+
if (this.pending[element.name]) {
|
|
8571
|
+
port = this.elementAjaxPort(element);
|
|
8572
|
+
$2.ajaxAbort(port);
|
|
8573
|
+
this.pendingRequest--;
|
|
8574
|
+
if (this.pendingRequest < 0) {
|
|
8575
|
+
this.pendingRequest = 0;
|
|
8576
|
+
}
|
|
8577
|
+
delete this.pending[element.name];
|
|
8578
|
+
$2(element).removeClass(this.settings.pendingClass);
|
|
8579
|
+
}
|
|
8580
|
+
},
|
|
8581
|
+
previousValue: function(element, method) {
|
|
8582
|
+
method = typeof method === "string" && method || "remote";
|
|
8583
|
+
return $2.data(element, "previousValue") || $2.data(element, "previousValue", {
|
|
8584
|
+
old: null,
|
|
8585
|
+
valid: true,
|
|
8586
|
+
message: this.defaultMessage(element, { method })
|
|
8587
|
+
});
|
|
8588
|
+
},
|
|
8589
|
+
// Cleans up all forms and elements, removes validator-specific events
|
|
8590
|
+
destroy: function() {
|
|
8591
|
+
this.resetForm();
|
|
8592
|
+
$2(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur").find(".validate-lessThan-blur").off(".validate-lessThan").removeClass("validate-lessThan-blur").find(".validate-lessThanEqual-blur").off(".validate-lessThanEqual").removeClass("validate-lessThanEqual-blur").find(".validate-greaterThanEqual-blur").off(".validate-greaterThanEqual").removeClass("validate-greaterThanEqual-blur").find(".validate-greaterThan-blur").off(".validate-greaterThan").removeClass("validate-greaterThan-blur");
|
|
8593
|
+
}
|
|
8594
|
+
},
|
|
8595
|
+
classRuleSettings: {
|
|
8596
|
+
required: { required: true },
|
|
8597
|
+
email: { email: true },
|
|
8598
|
+
url: { url: true },
|
|
8599
|
+
date: { date: true },
|
|
8600
|
+
dateISO: { dateISO: true },
|
|
8601
|
+
number: { number: true },
|
|
8602
|
+
digits: { digits: true },
|
|
8603
|
+
creditcard: { creditcard: true }
|
|
8604
|
+
},
|
|
8605
|
+
addClassRules: function(className, rules) {
|
|
8606
|
+
if (className.constructor === String) {
|
|
8607
|
+
this.classRuleSettings[className] = rules;
|
|
8608
|
+
} else {
|
|
8609
|
+
$2.extend(this.classRuleSettings, className);
|
|
8610
|
+
}
|
|
8611
|
+
},
|
|
8612
|
+
classRules: function(element) {
|
|
8613
|
+
var rules = {}, classes = $2(element).attr("class");
|
|
8614
|
+
if (classes) {
|
|
8615
|
+
$2.each(classes.split(" "), function() {
|
|
8616
|
+
if (this in $2.validator.classRuleSettings) {
|
|
8617
|
+
$2.extend(rules, $2.validator.classRuleSettings[this]);
|
|
8618
|
+
}
|
|
8619
|
+
});
|
|
8620
|
+
}
|
|
8621
|
+
return rules;
|
|
8622
|
+
},
|
|
8623
|
+
normalizeAttributeRule: function(rules, type, method, value) {
|
|
8624
|
+
if (/min|max|step/.test(method) && (type === null || /number|range|text/.test(type))) {
|
|
8625
|
+
value = Number(value);
|
|
8626
|
+
if (isNaN(value)) {
|
|
8627
|
+
value = void 0;
|
|
8628
|
+
}
|
|
8629
|
+
}
|
|
8630
|
+
if (value || value === 0) {
|
|
8631
|
+
rules[method] = value;
|
|
8632
|
+
} else if (type === method && type !== "range") {
|
|
8633
|
+
rules[type === "date" ? "dateISO" : method] = true;
|
|
8634
|
+
}
|
|
8635
|
+
},
|
|
8636
|
+
attributeRules: function(element) {
|
|
8637
|
+
var rules = {}, $element = $2(element), type = element.getAttribute("type"), method, value;
|
|
8638
|
+
for (method in $2.validator.methods) {
|
|
8639
|
+
if (method === "required") {
|
|
8640
|
+
value = element.getAttribute(method);
|
|
8641
|
+
if (value === "") {
|
|
8642
|
+
value = true;
|
|
8643
|
+
}
|
|
8644
|
+
value = !!value;
|
|
8645
|
+
} else {
|
|
8646
|
+
value = $element.attr(method);
|
|
8647
|
+
}
|
|
8648
|
+
this.normalizeAttributeRule(rules, type, method, value);
|
|
8649
|
+
}
|
|
8650
|
+
if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
|
|
8651
|
+
delete rules.maxlength;
|
|
8652
|
+
}
|
|
8653
|
+
return rules;
|
|
8654
|
+
},
|
|
8655
|
+
dataRules: function(element) {
|
|
8656
|
+
var rules = {}, $element = $2(element), type = element.getAttribute("type"), method, value;
|
|
8657
|
+
for (method in $2.validator.methods) {
|
|
8658
|
+
value = $element.data("rule" + method.charAt(0).toUpperCase() + method.substring(1).toLowerCase());
|
|
8659
|
+
if (value === "") {
|
|
8660
|
+
value = true;
|
|
8661
|
+
}
|
|
8662
|
+
this.normalizeAttributeRule(rules, type, method, value);
|
|
8663
|
+
}
|
|
8664
|
+
return rules;
|
|
8665
|
+
},
|
|
8666
|
+
staticRules: function(element) {
|
|
8667
|
+
var rules = {}, validator = $2.data(element.form, "validator");
|
|
8668
|
+
if (validator.settings.rules) {
|
|
8669
|
+
rules = $2.validator.normalizeRule(validator.settings.rules[element.name]) || {};
|
|
8670
|
+
}
|
|
8671
|
+
return rules;
|
|
8672
|
+
},
|
|
8673
|
+
normalizeRules: function(rules, element) {
|
|
8674
|
+
$2.each(rules, function(prop, val) {
|
|
8675
|
+
if (val === false) {
|
|
8676
|
+
delete rules[prop];
|
|
8677
|
+
return;
|
|
8678
|
+
}
|
|
8679
|
+
if (val.param || val.depends) {
|
|
8680
|
+
var keepRule = true;
|
|
8681
|
+
switch (typeof val.depends) {
|
|
8682
|
+
case "string":
|
|
8683
|
+
keepRule = !!$2(val.depends, element.form).length;
|
|
8684
|
+
break;
|
|
8685
|
+
case "function":
|
|
8686
|
+
keepRule = val.depends.call(element, element);
|
|
8687
|
+
break;
|
|
8688
|
+
}
|
|
8689
|
+
if (keepRule) {
|
|
8690
|
+
rules[prop] = val.param !== void 0 ? val.param : true;
|
|
8691
|
+
} else {
|
|
8692
|
+
$2.data(element.form, "validator").resetElements($2(element));
|
|
8693
|
+
delete rules[prop];
|
|
8694
|
+
}
|
|
8695
|
+
}
|
|
8696
|
+
});
|
|
8697
|
+
$2.each(rules, function(rule, parameter) {
|
|
8698
|
+
rules[rule] = typeof parameter === "function" && rule !== "normalizer" ? parameter(element) : parameter;
|
|
8699
|
+
});
|
|
8700
|
+
$2.each(["minlength", "maxlength"], function() {
|
|
8701
|
+
if (rules[this]) {
|
|
8702
|
+
rules[this] = Number(rules[this]);
|
|
8703
|
+
}
|
|
8704
|
+
});
|
|
8705
|
+
$2.each(["rangelength", "range"], function() {
|
|
8706
|
+
var parts;
|
|
8707
|
+
if (rules[this]) {
|
|
8708
|
+
if (Array.isArray(rules[this])) {
|
|
8709
|
+
rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
|
|
8710
|
+
} else if (typeof rules[this] === "string") {
|
|
8711
|
+
parts = rules[this].replace(/[\[\]]/g, "").split(/[\s,]+/);
|
|
8712
|
+
rules[this] = [Number(parts[0]), Number(parts[1])];
|
|
8713
|
+
}
|
|
8714
|
+
}
|
|
8715
|
+
});
|
|
8716
|
+
if ($2.validator.autoCreateRanges) {
|
|
8717
|
+
if (rules.min != null && rules.max != null) {
|
|
8718
|
+
rules.range = [rules.min, rules.max];
|
|
8719
|
+
delete rules.min;
|
|
8720
|
+
delete rules.max;
|
|
8721
|
+
}
|
|
8722
|
+
if (rules.minlength != null && rules.maxlength != null) {
|
|
8723
|
+
rules.rangelength = [rules.minlength, rules.maxlength];
|
|
8724
|
+
delete rules.minlength;
|
|
8725
|
+
delete rules.maxlength;
|
|
8726
|
+
}
|
|
8727
|
+
}
|
|
8728
|
+
return rules;
|
|
8729
|
+
},
|
|
8730
|
+
// Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
|
|
8731
|
+
normalizeRule: function(data) {
|
|
8732
|
+
if (typeof data === "string") {
|
|
8733
|
+
var transformed = {};
|
|
8734
|
+
$2.each(data.split(/\s/), function() {
|
|
8735
|
+
transformed[this] = true;
|
|
8736
|
+
});
|
|
8737
|
+
data = transformed;
|
|
8738
|
+
}
|
|
8739
|
+
return data;
|
|
8740
|
+
},
|
|
8741
|
+
// https://jqueryvalidation.org/jQuery.validator.addMethod/
|
|
8742
|
+
addMethod: function(name, method, message) {
|
|
8743
|
+
$2.validator.methods[name] = method;
|
|
8744
|
+
$2.validator.messages[name] = message !== void 0 ? message : $2.validator.messages[name];
|
|
8745
|
+
if (method.length < 3) {
|
|
8746
|
+
$2.validator.addClassRules(name, $2.validator.normalizeRule(name));
|
|
8747
|
+
}
|
|
8748
|
+
},
|
|
8749
|
+
// https://jqueryvalidation.org/jQuery.validator.methods/
|
|
8750
|
+
methods: {
|
|
8751
|
+
// https://jqueryvalidation.org/required-method/
|
|
8752
|
+
required: function(value, element, param) {
|
|
8753
|
+
if (!this.depend(param, element)) {
|
|
8754
|
+
return "dependency-mismatch";
|
|
8755
|
+
}
|
|
8756
|
+
if (element.nodeName.toLowerCase() === "select") {
|
|
8757
|
+
var val = $2(element).val();
|
|
8758
|
+
return val && val.length > 0;
|
|
8759
|
+
}
|
|
8760
|
+
if (this.checkable(element)) {
|
|
8761
|
+
return this.getLength(value, element) > 0;
|
|
8762
|
+
}
|
|
8763
|
+
return value !== void 0 && value !== null && value.length > 0;
|
|
8764
|
+
},
|
|
8765
|
+
// https://jqueryvalidation.org/email-method/
|
|
8766
|
+
email: function(value, element) {
|
|
8767
|
+
return this.optional(element) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(value);
|
|
8768
|
+
},
|
|
8769
|
+
// https://jqueryvalidation.org/url-method/
|
|
8770
|
+
url: function(value, element) {
|
|
8771
|
+
return this.optional(element) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?: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-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(value);
|
|
8772
|
+
},
|
|
8773
|
+
// https://jqueryvalidation.org/date-method/
|
|
8774
|
+
date: /* @__PURE__ */ (function() {
|
|
8775
|
+
var called = false;
|
|
8776
|
+
return function(value, element) {
|
|
8777
|
+
if (!called) {
|
|
8778
|
+
called = true;
|
|
8779
|
+
if (this.settings.debug && window.console) {
|
|
8780
|
+
console.warn(
|
|
8781
|
+
"The `date` method is deprecated and will be removed in version '2.0.0'.\nPlease don't use it, since it relies on the Date constructor, which\nbehaves very differently across browsers and locales. Use `dateISO`\ninstead or one of the locale specific methods in `localizations/`\nand `additional-methods.js`."
|
|
8782
|
+
);
|
|
8783
|
+
}
|
|
8784
|
+
}
|
|
8785
|
+
return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString());
|
|
8786
|
+
};
|
|
8787
|
+
})(),
|
|
8788
|
+
// https://jqueryvalidation.org/dateISO-method/
|
|
8789
|
+
dateISO: function(value, element) {
|
|
8790
|
+
return this.optional(element) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);
|
|
8791
|
+
},
|
|
8792
|
+
// https://jqueryvalidation.org/number-method/
|
|
8793
|
+
number: function(value, element) {
|
|
8794
|
+
return this.optional(element) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:-?\.\d+)?$/.test(value);
|
|
8795
|
+
},
|
|
8796
|
+
// https://jqueryvalidation.org/digits-method/
|
|
8797
|
+
digits: function(value, element) {
|
|
8798
|
+
return this.optional(element) || /^\d+$/.test(value);
|
|
8799
|
+
},
|
|
8800
|
+
// https://jqueryvalidation.org/minlength-method/
|
|
8801
|
+
minlength: function(value, element, param) {
|
|
8802
|
+
var length = Array.isArray(value) ? value.length : this.getLength(value, element);
|
|
8803
|
+
return this.optional(element) || length >= param;
|
|
8804
|
+
},
|
|
8805
|
+
// https://jqueryvalidation.org/maxlength-method/
|
|
8806
|
+
maxlength: function(value, element, param) {
|
|
8807
|
+
var length = Array.isArray(value) ? value.length : this.getLength(value, element);
|
|
8808
|
+
return this.optional(element) || length <= param;
|
|
8809
|
+
},
|
|
8810
|
+
// https://jqueryvalidation.org/rangelength-method/
|
|
8811
|
+
rangelength: function(value, element, param) {
|
|
8812
|
+
var length = Array.isArray(value) ? value.length : this.getLength(value, element);
|
|
8813
|
+
return this.optional(element) || length >= param[0] && length <= param[1];
|
|
8814
|
+
},
|
|
8815
|
+
// https://jqueryvalidation.org/min-method/
|
|
8816
|
+
min: function(value, element, param) {
|
|
8817
|
+
return this.optional(element) || value >= param;
|
|
8818
|
+
},
|
|
8819
|
+
// https://jqueryvalidation.org/max-method/
|
|
8820
|
+
max: function(value, element, param) {
|
|
8821
|
+
return this.optional(element) || value <= param;
|
|
8822
|
+
},
|
|
8823
|
+
// https://jqueryvalidation.org/range-method/
|
|
8824
|
+
range: function(value, element, param) {
|
|
8825
|
+
return this.optional(element) || value >= param[0] && value <= param[1];
|
|
8826
|
+
},
|
|
8827
|
+
// https://jqueryvalidation.org/step-method/
|
|
8828
|
+
step: function(value, element, param) {
|
|
8829
|
+
var type = $2(element).attr("type"), errorMessage = "Step attribute on input type " + type + " is not supported.", supportedTypes = ["text", "number", "range"], re = new RegExp("\\b" + type + "\\b"), notSupported = type && !re.test(supportedTypes.join()), decimalPlaces = function(num) {
|
|
8830
|
+
var match = ("" + num).match(/(?:\.(\d+))?$/);
|
|
8831
|
+
if (!match) {
|
|
8832
|
+
return 0;
|
|
8833
|
+
}
|
|
8834
|
+
return match[1] ? match[1].length : 0;
|
|
8835
|
+
}, toInt = function(num) {
|
|
8836
|
+
return Math.round(num * Math.pow(10, decimals));
|
|
8837
|
+
}, valid = true, decimals;
|
|
8838
|
+
if (notSupported) {
|
|
8839
|
+
throw new Error(errorMessage);
|
|
8840
|
+
}
|
|
8841
|
+
decimals = decimalPlaces(param);
|
|
8842
|
+
if (decimalPlaces(value) > decimals || toInt(value) % toInt(param) !== 0) {
|
|
8843
|
+
valid = false;
|
|
8844
|
+
}
|
|
8845
|
+
return this.optional(element) || valid;
|
|
8846
|
+
},
|
|
8847
|
+
// https://jqueryvalidation.org/equalTo-method/
|
|
8848
|
+
equalTo: function(value, element, param) {
|
|
8849
|
+
var target = $2(param);
|
|
8850
|
+
if (this.settings.onfocusout && target.not(".validate-equalTo-blur").length) {
|
|
8851
|
+
target.addClass("validate-equalTo-blur").on("blur.validate-equalTo", function() {
|
|
8852
|
+
$2(element).valid();
|
|
8853
|
+
});
|
|
8854
|
+
}
|
|
8855
|
+
return value === target.val();
|
|
8856
|
+
},
|
|
8857
|
+
// https://jqueryvalidation.org/remote-method/
|
|
8858
|
+
remote: function(value, element, param, method) {
|
|
8859
|
+
if (this.optional(element)) {
|
|
8860
|
+
return "dependency-mismatch";
|
|
8861
|
+
}
|
|
8862
|
+
method = typeof method === "string" && method || "remote";
|
|
8863
|
+
var previous = this.previousValue(element, method), validator, data, optionDataString;
|
|
8864
|
+
if (!this.settings.messages[element.name]) {
|
|
8865
|
+
this.settings.messages[element.name] = {};
|
|
8866
|
+
}
|
|
8867
|
+
previous.originalMessage = previous.originalMessage || this.settings.messages[element.name][method];
|
|
8868
|
+
this.settings.messages[element.name][method] = previous.message;
|
|
8869
|
+
param = typeof param === "string" && { url: param } || param;
|
|
8870
|
+
optionDataString = $2.param($2.extend({ data: value }, param.data));
|
|
8871
|
+
if (previous.valid !== null && previous.old === optionDataString) {
|
|
8872
|
+
return previous.valid;
|
|
8873
|
+
}
|
|
8874
|
+
previous.old = optionDataString;
|
|
8875
|
+
previous.valid = null;
|
|
8876
|
+
validator = this;
|
|
8877
|
+
this.startRequest(element);
|
|
8878
|
+
data = {};
|
|
8879
|
+
data[element.name] = value;
|
|
8880
|
+
$2.ajax($2.extend(true, {
|
|
8881
|
+
mode: "abort",
|
|
8882
|
+
port: this.elementAjaxPort(element),
|
|
8883
|
+
dataType: "json",
|
|
8884
|
+
data,
|
|
8885
|
+
context: validator.currentForm,
|
|
8886
|
+
success: function(response) {
|
|
8887
|
+
var valid = response === true || response === "true", errors, message, submitted;
|
|
8888
|
+
validator.settings.messages[element.name][method] = previous.originalMessage;
|
|
8889
|
+
if (valid) {
|
|
8890
|
+
submitted = validator.formSubmitted;
|
|
8891
|
+
validator.toHide = validator.errorsFor(element);
|
|
8892
|
+
validator.formSubmitted = submitted;
|
|
8893
|
+
validator.successList.push(element);
|
|
8894
|
+
validator.invalid[element.name] = false;
|
|
8895
|
+
validator.showErrors();
|
|
8896
|
+
} else {
|
|
8897
|
+
errors = {};
|
|
8898
|
+
message = response || validator.defaultMessage(element, { method, parameters: value });
|
|
8899
|
+
errors[element.name] = previous.message = message;
|
|
8900
|
+
validator.invalid[element.name] = true;
|
|
8901
|
+
validator.showErrors(errors);
|
|
8902
|
+
}
|
|
8903
|
+
previous.valid = valid;
|
|
8904
|
+
validator.stopRequest(element, valid);
|
|
8905
|
+
}
|
|
8906
|
+
}, param));
|
|
8907
|
+
return "pending";
|
|
8908
|
+
}
|
|
8909
|
+
}
|
|
8910
|
+
});
|
|
8911
|
+
var pendingRequests = {}, ajax;
|
|
8912
|
+
if ($2.ajaxPrefilter) {
|
|
8913
|
+
$2.ajaxPrefilter(function(settings, _, xhr) {
|
|
8914
|
+
var port = settings.port;
|
|
8915
|
+
if (settings.mode === "abort") {
|
|
8916
|
+
$2.ajaxAbort(port);
|
|
8917
|
+
pendingRequests[port] = xhr;
|
|
8918
|
+
}
|
|
8919
|
+
});
|
|
8920
|
+
} else {
|
|
8921
|
+
ajax = $2.ajax;
|
|
8922
|
+
$2.ajax = function(settings) {
|
|
8923
|
+
var mode = ("mode" in settings ? settings : $2.ajaxSettings).mode, port = ("port" in settings ? settings : $2.ajaxSettings).port;
|
|
8924
|
+
if (mode === "abort") {
|
|
8925
|
+
$2.ajaxAbort(port);
|
|
8926
|
+
pendingRequests[port] = ajax.apply(this, arguments);
|
|
8927
|
+
return pendingRequests[port];
|
|
8928
|
+
}
|
|
8929
|
+
return ajax.apply(this, arguments);
|
|
8930
|
+
};
|
|
8931
|
+
}
|
|
8932
|
+
$2.ajaxAbort = function(port) {
|
|
8933
|
+
if (pendingRequests[port]) {
|
|
8934
|
+
pendingRequests[port].abort();
|
|
8935
|
+
delete pendingRequests[port];
|
|
8936
|
+
}
|
|
8937
|
+
};
|
|
8938
|
+
return $2;
|
|
8939
|
+
});
|
|
8940
|
+
}
|
|
8941
|
+
});
|
|
8942
|
+
|
|
7639
8943
|
// node_modules/jquery-validation-unobtrusive/dist/jquery.validate.unobtrusive.js
|
|
7640
8944
|
var require_jquery_validate_unobtrusive = __commonJS({
|
|
7641
8945
|
"node_modules/jquery-validation-unobtrusive/dist/jquery.validate.unobtrusive.js"(exports, module) {
|
|
@@ -7643,7 +8947,7 @@
|
|
|
7643
8947
|
if (typeof define === "function" && define.amd) {
|
|
7644
8948
|
define("jquery.validate.unobtrusive", ["jquery-validation"], factory);
|
|
7645
8949
|
} else if (typeof module === "object" && module.exports) {
|
|
7646
|
-
module.exports = factory(
|
|
8950
|
+
module.exports = factory(require_jquery_validate2());
|
|
7647
8951
|
} else {
|
|
7648
8952
|
jQuery.validator.unobtrusive = factory(jQuery);
|
|
7649
8953
|
}
|
|
@@ -7941,6 +9245,16 @@ jquery-validation/dist/jquery.validate.js:
|
|
|
7941
9245
|
* Released under the MIT license
|
|
7942
9246
|
*)
|
|
7943
9247
|
|
|
9248
|
+
jquery-validation/dist/jquery.validate.js:
|
|
9249
|
+
(*!
|
|
9250
|
+
* jQuery Validation Plugin v1.22.0
|
|
9251
|
+
*
|
|
9252
|
+
* https://jqueryvalidation.org/
|
|
9253
|
+
*
|
|
9254
|
+
* Copyright (c) 2026 Jörn Zaefferer
|
|
9255
|
+
* Released under the MIT license
|
|
9256
|
+
*)
|
|
9257
|
+
|
|
7944
9258
|
jquery-validation-unobtrusive/dist/jquery.validate.unobtrusive.js:
|
|
7945
9259
|
(**
|
|
7946
9260
|
* @license
|