PageSourceSearch

https://assets.blacktag.com.br/js/custom.validate.js

js blacktag.com.br collected 2026-10-02 05:58:30 UTC 2,991 bytes, 87 lines download raw bytes

1jQuery.validator.addMethod("cpf", function(value, element) {
2    value = jQuery.trim(value);
3    value = value.replace('.', '');
4    value = value.replace('.', '');
5    cpf = value.replace('-', '');
6    while (cpf.length < 11) cpf = "0" + cpf;
7    var expReg = /^0+$|^1+$|^2+$|^3+$|^4+$|^5+$|^6+$|^7+$|^8+$|^9+$/;
8    var a = [];
9    var b = new Number;
10    var c = 11;
11    for (i = 0; i < 11; i++) {
12        a[i] = cpf.charAt(i);
13        if (i < 9) b += (a[i] * --c);
14    }
15    if ((x = b % 11) < 2) {
16        a[9] = 0
17    } else {
18        a[9] = 11 - x
19    }
20    b = 0;
21    c = 11;
22    for (y = 0; y < 10; y++) b += (a[y] * c--);
23    if ((x = b % 11) < 2) {
24        a[10] = 0;
25    } else {
26        a[10] = 11 - x;
27    }
28    if ((cpf.charAt(9) != a[9]) || (cpf.charAt(10) != a[10]) || cpf.match(expReg)) return this.optional(element) || false;
29    return this.optional(element) || true;
30}, "Informe um CPF válido.");
31
32jQuery.validator.addMethod("cep", function(e, t) {
33    return this.optional(t) || /^\d{5}-\d{3}?$/.test(e)
34}, "Informe um CEP válido.");
35
36jQuery.validator.addMethod("numeroCartao", function(e, t) {
37    var regex;
38    if ($.trim(e).length > 20) {
39        regex = /^\d{4} \d{4} \d{4} \d{4} \d{1,4}?$/;
40    } else {
41        regex = /^\d{4} \d{4} \d{4} \d{2,5}?$/;
42    }
43    return this.optional(t) || regex.test($.trim(e));
44}, "Informe um número de cartão válido.");
45
46jQuery.validator.addMethod("numberMes", function(value, element) {
47    return (value >= 1 && value <= 12);
48}, "Informe um mês.");
49
50jQuery.validator.addMethod("validadeAnoCartao", function(value, element) {
51    var d = new Date();
52    var n = d.getFullYear();
53    return (value >= n);
54}, "Verifique validade do cartão.");
55
56jQuery.validator.addMethod("telefone", function(value) {
57    return (/^\([0-9]{2}\) ([0-9]{4,5})-([0-9]{4})$/.test(value));
58}, 'Preencha um telefone válido.');
59
60jQuery.validator.addMethod("fullName", function(value) {
61    var s = value.split(" ");
62    return (s.length > 1 && s[0].length >= 1 && s[1].length >= 1) ? true : false;
63}, 'Preencha o nome completo.');
64
65jQuery.validator.addMethod("dateBR", function(value, element) {
66    var check = false;
67    var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
68    if (re.test(value)) {
69        var adata = value.split('/');
70        var gg = parseInt(adata[0], 10);
71        var mm = parseInt(adata[1], 10);
72        var aaaa = parseInt(adata[2], 10);
73        var xdata = new Date(aaaa, mm - 1, gg);
74        if ((xdata.getFullYear() == aaaa) && (xdata.getMonth() == mm - 1) && (xdata.getDate() == gg)) check = true;
75        else
76            check = false;
77    } else
78        check = false;
79    return this.optional(element) || check;
80}, "Insira uma data válida");
81
82jQuery.validator.addMethod("amountGreaterThan", function(value, element, params) {
83    var amount = parseFloat(value.replace('.', '').replace(',', '.'));
84    return amount > parseFloat(params);
85}, function(params, element) {
86    return 'Digite um valor maior que R$ ' + params;
87});

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.