-
Notifications
You must be signed in to change notification settings - Fork 2
/
jquery.validate.maoli.js
57 lines (35 loc) · 1.36 KB
/
jquery.validate.maoli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// ==ClosureCompiler==
// @output_file_name jquery.validate.maoli.min.js
// @compilation_level SIMPLE_OPTIMIZATIONS
// ==/ClosureCompiler==
/*jslint
this
*/
(function (window) {
"use strict";
var maoli = window.Maoli,
$ = window.jQuery,
validator = null,
addCepMethod = function () {
validator.addMethod("cep_validator", function (value, element) {
var punctuation = $(element).data("val-cep-punctuation") || "loose";
return maoli.Cep.validate(value, punctuation);
});
validator.unobtrusive.adapters.addBool('cep', 'cep_validator');
};
if (maoli === "undefined" || $ === "undefined" || $.validator === "undefined") {
return;
}
validator = $.validator;
addCepMethod();
validator.addMethod("cnpj_validator", function (value, element) {
var punctuation = $(element).data("val-cnpj-punctuation") || "loose";
return maoli.Cnpj.validate(value, punctuation);
});
validator.addMethod("cpf_validator", function (value, element) {
var punctuation = $(element).data("val-cpf-punctuation") || "loose";
return maoli.Cpf.validate(value, punctuation);
});
validator.unobtrusive.adapters.addBool('cnpj', 'cnpj_validator');
validator.unobtrusive.adapters.addBool('cpf', 'cpf_validator');
}(this));