parsley-rails 1.1.18.0 → 1.2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parsley-rails/version.rb +1 -1
- data/vendor/assets/javascripts/parsley.extend.js +113 -76
- data/vendor/assets/javascripts/parsley.i18n.cs.js +7 -7
- data/vendor/assets/javascripts/parsley.i18n.cy.js +1 -2
- data/vendor/assets/javascripts/parsley.i18n.it.js +1 -1
- data/vendor/assets/javascripts/parsley.i18n.no.js +8 -8
- data/vendor/assets/javascripts/parsley.i18n.ru.js +2 -2
- data/vendor/assets/javascripts/parsley.i18n.vn.js +1 -2
- data/vendor/assets/javascripts/parsley.js +480 -304
- data/vendor/assets/javascripts/parsley.l10n.es.js +157 -132
- metadata +2 -2
@@ -3,148 +3,173 @@ window.ParsleyConfig = window.ParsleyConfig || {};
|
|
3
3
|
(function ($) {
|
4
4
|
window.ParsleyConfig = $.extend( true, {}, window.ParsleyConfig, {
|
5
5
|
validators: {
|
6
|
-
es_dni: function (
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
6
|
+
es_dni: function () {
|
7
|
+
return {
|
8
|
+
validate: function ( val, elem, self ) {
|
9
|
+
var letter, letters, number;
|
10
|
+
|
11
|
+
letters = 'TRWAGMYFPDXBNJZSQVHLCKET';
|
12
|
+
val = val.replace("-", "");
|
13
|
+
val = val.toUpperCase();
|
14
|
+
number = val.substring(0, val.length - 1);
|
15
|
+
letter = val[val.length - 1];
|
16
|
+
|
17
|
+
if (!/\d+/.test(number)) {
|
18
|
+
return false;
|
19
|
+
}
|
20
|
+
if (!letters.indexOf(letter) < 0) {
|
21
|
+
return false;
|
22
|
+
}
|
23
|
+
return letter == letters[parseInt(number, 10) % 23];
|
24
|
+
}
|
25
|
+
, priority: 32
|
20
26
|
}
|
21
|
-
return letter == letters[parseInt(number, 10) % 23];
|
22
27
|
}
|
23
|
-
, es_postalcode: function(
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
, es_postalcode: function () {
|
29
|
+
return {
|
30
|
+
validate: function(val, elem, self) {
|
31
|
+
var provinceCode;
|
32
|
+
|
33
|
+
if (!/^\d{5}$/.test(val)) {
|
34
|
+
return false;
|
35
|
+
}
|
36
|
+
provinceCode = parseInt(val.substring(0,2), 10);
|
37
|
+
if (provinceCode > 52 || provinceCode < 1) {
|
38
|
+
return false;
|
39
|
+
}
|
40
|
+
return true;
|
41
|
+
}
|
42
|
+
, priority: 32
|
32
43
|
}
|
33
|
-
return true;
|
34
44
|
}
|
35
|
-
, es_ssn: function(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
, es_ssn: function () {
|
46
|
+
return {
|
47
|
+
validate: function(val, elem, self) {
|
48
|
+
var a, b, c, code, d;
|
49
|
+
|
50
|
+
val = val.replace(/[ \/-]/g, "");
|
51
|
+
if (!/^\d{12}$/.test(val)) {
|
52
|
+
return false;
|
53
|
+
}
|
54
|
+
|
55
|
+
a = val.substring(0, 2);
|
56
|
+
b = val.substring(2, 10);
|
57
|
+
code = val.substring(10, 12);
|
58
|
+
|
59
|
+
if (parseInt(b, 10) < 10000000) {
|
60
|
+
d = parseInt(b, 10) + (parseInt(a, 10) * 10000000);
|
61
|
+
} else {
|
62
|
+
d = a + b.replace(/0*$/, "");
|
63
|
+
}
|
64
|
+
c = parseInt(d) % 97;
|
65
|
+
return c === parseInt(code);
|
66
|
+
}
|
67
|
+
, priority: 32
|
51
68
|
}
|
52
|
-
c = parseInt(d) % 97;
|
53
|
-
return c === parseInt(code);
|
54
69
|
}
|
55
|
-
, es_ccc: function(
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
70
|
+
, es_ccc: function () {
|
71
|
+
return {
|
72
|
+
validate: function(val, elem, self) {
|
73
|
+
var account, controlCode, entity, firstCode, firstCodeMod,
|
74
|
+
firstCodeResult, office, secondCode, secondCodeMod,
|
75
|
+
secondCodeResult, weight, x;
|
76
|
+
|
77
|
+
val = val.replace(/[ -]/g, "");
|
78
|
+
if (!/\d{20}$/.test(val)) {
|
79
|
+
return false;
|
80
|
+
}
|
81
|
+
|
82
|
+
weight = [1, 2, 4, 8, 5, 10, 9, 7, 3, 6];
|
83
|
+
entity = val.substring(0, 4);
|
84
|
+
office = val.substring(4, 8);
|
85
|
+
controlCode = val.substring(8, 10);
|
86
|
+
account = val.substr(10, 20);
|
87
|
+
firstCode = "00" + entity + office;
|
88
|
+
secondCode = account;
|
89
|
+
firstCodeResult = 0;
|
90
|
+
for (x = 0; x < 10; x++) {
|
91
|
+
firstCodeResult += parseInt(firstCode[x], 10) * weight[x];
|
92
|
+
}
|
93
|
+
firstCodeMod = firstCodeResult % 11;
|
94
|
+
firstCodeResult = 11 - firstCodeMod;
|
95
|
+
if (firstCodeResult === 10) {
|
96
|
+
firstCodeResult = 1;
|
97
|
+
}
|
98
|
+
if (firstCodeResult === 11) {
|
99
|
+
firstCodeResult = 0;
|
100
|
+
}
|
101
|
+
secondCodeResult = 0;
|
102
|
+
for (x = 0; x < 10; x++) {
|
103
|
+
secondCodeResult += parseInt(secondCode[x], 10) * weight[x];
|
104
|
+
}
|
105
|
+
secondCodeMod = secondCodeResult % 11;
|
106
|
+
secondCodeResult = 11 - secondCodeMod;
|
107
|
+
if (secondCodeResult === 10) {
|
108
|
+
secondCodeResult = 1;
|
109
|
+
}
|
110
|
+
if (secondCodeResult === 11) {
|
111
|
+
secondCodeResult = 0;
|
112
|
+
}
|
113
|
+
if (firstCodeResult === parseInt(controlCode[0]) && secondCodeResult === parseInt(controlCode[1])) {
|
114
|
+
return true;
|
115
|
+
}
|
116
|
+
return false;
|
117
|
+
}
|
118
|
+
, priority: 32
|
98
119
|
}
|
99
|
-
return false;
|
100
120
|
}
|
101
|
-
, es_cif: function(
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
121
|
+
, es_cif: function () {
|
122
|
+
return {
|
123
|
+
validate: function(val, elem, self) {
|
124
|
+
var oddSum, evenSum, totalSum, controlCode, controlDigit, reminder,
|
125
|
+
letter, number, oddNumbers, provinceCode, x, _i, _len;
|
126
|
+
|
127
|
+
val = val.replace(/-/g, "").toUpperCase();
|
128
|
+
|
129
|
+
if (!/^[ABCDEFGHJKLMNPRQSUVW]\d{7}[\d[ABCDEFGHIJ]$/.test(val)) {
|
130
|
+
return false;
|
131
|
+
}
|
132
|
+
|
133
|
+
letter = val.substring(0, 1);
|
134
|
+
provinceCode = val.substring(1, 3);
|
135
|
+
number = val.substring(3, 8);
|
136
|
+
controlCode = val.substring(8, 9);
|
137
|
+
|
138
|
+
if (/[CKLMNPQRSW]/.test(letter) && /\d/.test(controlCode)) {
|
139
|
+
return false;
|
140
|
+
}
|
141
|
+
if (/[ABDEFGHJUV]/.test(letter) && /[A-Z]/.test(controlCode)) {
|
142
|
+
return false;
|
143
|
+
}
|
144
|
+
|
145
|
+
oddSum = parseInt(provinceCode[1], 10) + parseInt(number[1], 10) + parseInt(number[3], 10);
|
146
|
+
|
147
|
+
evenSum = 0;
|
148
|
+
oddNumbers = [
|
149
|
+
parseInt(provinceCode[0], 10),
|
150
|
+
parseInt(number[0], 10),
|
151
|
+
parseInt(number[2], 10),
|
152
|
+
parseInt(number[4], 10)
|
153
|
+
];
|
154
|
+
for (_i = 0, _len = oddNumbers.length; _i < _len; _i++) {
|
155
|
+
number = oddNumbers[_i];
|
156
|
+
x = number * 2;
|
157
|
+
if (x >= 10) {
|
158
|
+
x = (x % 10) + 1;
|
159
|
+
}
|
160
|
+
evenSum += x;
|
161
|
+
}
|
162
|
+
totalSum = oddSum + evenSum;
|
163
|
+
reminder = totalSum % 10;
|
164
|
+
if (reminder !== 0) { controlDigit = 10 - reminder; } else { controlDigit = 0; }
|
165
|
+
|
166
|
+
if (controlCode !== controlDigit.toString() && 'JABCDEFGHI'[controlDigit] !== controlCode) {
|
167
|
+
return false;
|
168
|
+
}
|
169
|
+
return true;
|
137
170
|
}
|
138
|
-
|
139
|
-
}
|
140
|
-
totalSum = oddSum + evenSum;
|
141
|
-
reminder = totalSum % 10;
|
142
|
-
if (reminder !== 0) { controlDigit = 10 - reminder; } else { controlDigit = 0; }
|
143
|
-
|
144
|
-
if (controlCode !== controlDigit.toString() && 'JABCDEFGHI'[controlDigit] !== controlCode) {
|
145
|
-
return false;
|
171
|
+
, priority: 32
|
146
172
|
}
|
147
|
-
return true;
|
148
173
|
}
|
149
174
|
}
|
150
175
|
, messages: {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parsley-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jiri Pospisil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Parsley.js bundled for Rails Asset Pipeline
|
14
14
|
email:
|