@osimatic/helpers-js 1.0.8 → 1.0.9
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/.idea/helpers-js.iml +8 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/array.js +4 -6
- package/changelog.txt +25 -0
- package/google_recaptcha.js +78 -0
- package/index.js +13 -8
- package/location.js +249 -251
- package/number.js +59 -7
- package/package.json +1 -1
- package/paging.js +21 -20
- package/string.js +85 -49
- package/util.js +0 -8
- package/todos/google_recaptcha.js +0 -15
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
|
5
|
+
<orderEntry type="inheritedJdk" />
|
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
+
</component>
|
|
8
|
+
</module>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/helpers-js.iml" filepath="$PROJECT_DIR$/.idea/helpers-js.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
package/array.js
CHANGED
|
@@ -42,7 +42,7 @@ Array.prototype.filterUnique = function() {
|
|
|
42
42
|
return this.filter((v, i, a) => a.indexOf(v) === i);
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
function
|
|
45
|
+
Array.getValuesByKeyInArrayOfArrays = function(array, key) {
|
|
46
46
|
let listeValues = [];
|
|
47
47
|
for (let i in array) {
|
|
48
48
|
let subArray = array[i];
|
|
@@ -63,7 +63,7 @@ Object.filter = (obj, predicate) => {
|
|
|
63
63
|
.reduce( (res, key) => (res[key] = obj[key], res), {} );
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
function
|
|
66
|
+
Object.renameKeys = function(obj, keysMap) {
|
|
67
67
|
return Object.keys(obj).reduce(
|
|
68
68
|
(acc, key) => ({
|
|
69
69
|
...acc,
|
|
@@ -71,9 +71,9 @@ function renameKeys(obj, keysMap) {
|
|
|
71
71
|
}),
|
|
72
72
|
{}
|
|
73
73
|
);
|
|
74
|
-
}
|
|
74
|
+
};
|
|
75
75
|
|
|
76
|
-
function
|
|
76
|
+
Object.renameKeysByCallback = function(obj, callback) {
|
|
77
77
|
return Object.keys(obj).reduce(
|
|
78
78
|
(acc, key) => ({
|
|
79
79
|
...acc,
|
|
@@ -82,5 +82,3 @@ function renameKeysByCallback(obj, callback) {
|
|
|
82
82
|
{}
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
module.exports = { getValuesByKeyInArrayOfArrays, renameKeys, renameKeysByCallback };
|
package/changelog.txt
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
1.0.9 :
|
|
3
|
+
copierTexte(str) -> str.copyToClipboard()
|
|
4
|
+
truncateString(str, ...) -> str.truncateString(...)
|
|
5
|
+
|
|
6
|
+
NumberValue.isNumeric(str) -> str.isNumeric()
|
|
7
|
+
NumberValue.format(number, nbDecimal, locale) -> number.format(nbDecimal, locale)
|
|
8
|
+
NumberValue.formatCurrency(montant, currency, nbDecimal, locale) -> montant.formatCurrency(currency, nbDecimal, locale)
|
|
9
|
+
NumberValue.formatPercent(number, nbDecimal, locale) -> number.formatPercent(nbDecimal, locale)
|
|
10
|
+
NumberValue.random(min, max) -> Number.random(min, max)
|
|
11
|
+
NumberValue.padLeft2(n) -> n.padLeft2()
|
|
12
|
+
NumberValue.roundDecimal(nombre, precision) -> nombre.roundDecimal(precision)
|
|
13
|
+
|
|
14
|
+
nombre.formatAsString(locale, minimumFractionDigits) -> nombre.format(nbDecimal, locale)
|
|
15
|
+
montant.formatAsCurrency(locale, currency, nbFractionDigits) -> montant.formatCurrency(currency, nbDecimal, locale)
|
|
16
|
+
number.formatAsPercent(locale, minimumFractionDigits) -> number.formatPercent(nbDecimal, locale)
|
|
17
|
+
|
|
18
|
+
constante COUNTRIES_LIST -> Country.getCountryList()
|
|
19
|
+
activateTab(...) -> Pagination.activateTab(...)
|
|
20
|
+
|
|
21
|
+
renameKeys(...) -> Object.renameKeys(...)
|
|
22
|
+
renameKeysByCallback(...) -> Object.renameKeysByCallback(...)
|
|
23
|
+
getValuesByKeyInArrayOfArrays(...) -> Array.getValuesByKeyInArrayOfArrays(...)
|
|
24
|
+
getValuesByKeyInArrayOfArrays(array, ...) -> array.getValuesByKeyInArrayOfArrays(...)
|
|
25
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
class GoogleRecaptcha {
|
|
2
|
+
static onLoad() {
|
|
3
|
+
console.log('GoogleRecaptcha.onLoad');
|
|
4
|
+
if (typeof grecaptcha == 'undefined' || typeof grecaptcha.render != 'function') {
|
|
5
|
+
console.log('var grecaptcha undefined');
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (typeof GoogleRecaptcha.googleCaptchaRendersCallback == 'undefined') {
|
|
10
|
+
GoogleRecaptcha.googleCaptchaRendersCallback = [];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
GoogleRecaptcha.googleCaptchaRendersCallback.forEach(callback => callback());
|
|
14
|
+
GoogleRecaptcha.googleCaptchaRendersCallback = [];
|
|
15
|
+
|
|
16
|
+
/*document.querySelectorAll('.grecaptcha').forEach(element => {
|
|
17
|
+
try {
|
|
18
|
+
console.log(element.id);
|
|
19
|
+
//grecaptchaWidgets[element.id] = grecaptcha.render(element.id, googleReCaptchaDatas);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
console.log('Exception during grecaptcha.render', e);
|
|
23
|
+
}
|
|
24
|
+
});*/
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static addRenderCallback(callback) {
|
|
28
|
+
if (typeof GoogleRecaptcha.googleCaptchaRendersCallback == 'undefined') {
|
|
29
|
+
GoogleRecaptcha.googleCaptchaRendersCallback = [];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
GoogleRecaptcha.googleCaptchaRendersCallback.push(callback);
|
|
33
|
+
console.log('GoogleRecaptcha.addRenderCallback');
|
|
34
|
+
GoogleRecaptcha.onLoad();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static reset(id) {
|
|
38
|
+
if (typeof grecaptcha == 'undefined' || typeof grecaptcha.render != 'function') {
|
|
39
|
+
console.log('var grecaptcha.render undefined');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (typeof GoogleRecaptcha.grecaptchaWidgets == 'undefined') {
|
|
44
|
+
GoogleRecaptcha.grecaptchaWidgets = [];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (typeof GoogleRecaptcha.grecaptchaWidgets[id] == 'undefined') {
|
|
48
|
+
try {
|
|
49
|
+
GoogleRecaptcha.grecaptchaWidgets[id] = grecaptcha.render(id, googleReCaptchaDatas);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
console.log('Exception during grecaptcha.render', e);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
grecaptcha.reset(GoogleRecaptcha.grecaptchaWidgets[id]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = { GoogleRecaptcha };
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
var grecaptchaWidgets = [];
|
|
65
|
+
|
|
66
|
+
function grecaptchaOnload () {
|
|
67
|
+
if (typeof grecaptcha == 'undefined') {
|
|
68
|
+
console.log('var grecaptcha undefined');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
document.querySelectorAll('.grecaptcha').forEach(element => {
|
|
72
|
+
grecaptchaWidgets[element.id] = grecaptcha.render(element.id, googleReCaptchaDatas);
|
|
73
|
+
});
|
|
74
|
+
//$('.grecaptcha').each(function(idx, el) {
|
|
75
|
+
// grecaptchaWidgets[$(el).attr('id')] = grecaptcha.render($(el).attr('id'), googleReCaptchaDatas);
|
|
76
|
+
//});
|
|
77
|
+
}
|
|
78
|
+
*/
|
package/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
//A noter : les réécritures de prototypes définies dans certains fichiers n'ont pas besoin d'être exportés depuis le module en question (exemple Array / Object dans array.js).
|
|
2
2
|
//Il faut uniquement appeler require() (sans récupérer le retour) et ajouter la/les classe(s) concernée(s) dans l'export ci-dessous (l'appel de require() applique l'extension).
|
|
3
3
|
|
|
4
|
+
// rien à exporter (que des extensions d'objet natif)
|
|
5
|
+
require('./string');
|
|
6
|
+
require('./array');
|
|
7
|
+
|
|
8
|
+
// exports d'ojets non natif
|
|
4
9
|
const { HTTPRequest, Cookie, UrlAndQueryString } = require('./network');
|
|
5
10
|
const { IBAN } = require('./bank');
|
|
6
11
|
const { AudioMedia } = require('./media');
|
|
@@ -17,21 +22,21 @@ const { GoogleMap } = require('./google_maps');
|
|
|
17
22
|
const { ImportFromCsv } = require('./import_from_csv');
|
|
18
23
|
const { JwtToken, JwtSession } = require('./jwt');
|
|
19
24
|
const { ListBox } = require('./list_box');
|
|
20
|
-
const {
|
|
25
|
+
const { Country, PostalAddress, Location } = require('./location');
|
|
21
26
|
const { SocialNetwork } = require('./social_network');
|
|
22
|
-
const { getValuesByKeyInArrayOfArrays, renameKeys, renameKeysByCallback } = require('./array');
|
|
23
27
|
const { NumberValue } = require('./number');
|
|
24
|
-
const {
|
|
25
|
-
const { addBookmark, sleep, refresh } = require('./util');
|
|
28
|
+
const { sleep, refresh } = require('./util');
|
|
26
29
|
const { chr, ord, trim, empty } = require('./php.min');
|
|
27
30
|
const { Pagination, activateTab } = require('./paging');
|
|
28
31
|
const { GoogleCharts } = require('./google_charts');
|
|
32
|
+
const { GoogleRecaptcha } = require('./google_recaptcha');
|
|
29
33
|
|
|
30
34
|
module.exports = {
|
|
35
|
+
Array, Object, Number, String,
|
|
31
36
|
HTTPRequest, Cookie, UrlAndQueryString, IBAN, AudioMedia, PersonName, Email, TelephoneNumber, CountDown, DataTable,
|
|
32
37
|
DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime, InputPeriod, DetailsSubArray, Duration, File, CSV, Img,
|
|
33
|
-
FlashMessage, FormHelper, GoogleMap, ImportFromCsv, JwtToken, JwtSession, ListBox,
|
|
34
|
-
Location, SocialNetwork,
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
FlashMessage, FormHelper, GoogleMap, ImportFromCsv, JwtToken, JwtSession, ListBox, Country, PostalAddress,
|
|
39
|
+
Location, SocialNetwork, NumberValue, Pagination,
|
|
40
|
+
sleep, refresh, chr, ord, trim, empty,
|
|
41
|
+
GoogleCharts, GoogleRecaptcha
|
|
37
42
|
};
|
package/location.js
CHANGED
|
@@ -1,251 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
const COUNTRIES_LIST = {
|
|
3
|
-
AF:'Afghanistan',
|
|
4
|
-
AX:'Åland Islands',
|
|
5
|
-
AL:'Albania',
|
|
6
|
-
DZ:'Algeria',
|
|
7
|
-
AS:'American Samoa',
|
|
8
|
-
AD:'Andorra',
|
|
9
|
-
AO:'Angola',
|
|
10
|
-
AI:'Anguilla',
|
|
11
|
-
AQ:'Antarctica',
|
|
12
|
-
AG:'Antigua and Barbuda',
|
|
13
|
-
AR:'Argentina',
|
|
14
|
-
AM:'Armenia',
|
|
15
|
-
AW:'Aruba',
|
|
16
|
-
AU:'Australia',
|
|
17
|
-
AT:'Austria',
|
|
18
|
-
AZ:'Azerbaijan',
|
|
19
|
-
BS:'Bahamas',
|
|
20
|
-
BH:'Bahrain',
|
|
21
|
-
BD:'Bangladesh',
|
|
22
|
-
BB:'Barbados',
|
|
23
|
-
BY:'Belarus',
|
|
24
|
-
BE:'Belgium',
|
|
25
|
-
BZ:'Belize',
|
|
26
|
-
BJ:'Benin',
|
|
27
|
-
BM:'Bermuda',
|
|
28
|
-
BT:'Bhutan',
|
|
29
|
-
BO:'Bolivia',
|
|
30
|
-
BA:'Bosnia and Herzegovina',
|
|
31
|
-
BW:'Botswana',
|
|
32
|
-
BV:'Bouvet Island',
|
|
33
|
-
BR:'Brazil',
|
|
34
|
-
IO:'British Indian Ocean Territory',
|
|
35
|
-
BN:'Brunei Darussalam',
|
|
36
|
-
BG:'Bulgaria',
|
|
37
|
-
BF:'Burkina Faso',
|
|
38
|
-
BI:'Burundi',
|
|
39
|
-
KH:'Cambodia',
|
|
40
|
-
CM:'Cameroon',
|
|
41
|
-
CA:'Canada',
|
|
42
|
-
CV:'Cape Verde',
|
|
43
|
-
KY:'Cayman Islands',
|
|
44
|
-
CF:'Central African Republic',
|
|
45
|
-
TD:'Chad',
|
|
46
|
-
CL:'Chile',
|
|
47
|
-
CN:'China',
|
|
48
|
-
CX:'Christmas Island',
|
|
49
|
-
CC:'Cocos (Keeling) Islands',
|
|
50
|
-
CO:'Colombia',
|
|
51
|
-
KM:'Comoros',
|
|
52
|
-
CG:'Congo',
|
|
53
|
-
CD:'Congo, The Democratic Republic of The',
|
|
54
|
-
CK:'Cook Islands',
|
|
55
|
-
CR:'Costa Rica',
|
|
56
|
-
CI:'Cote d’Ivoire',
|
|
57
|
-
HR:'Croatia',
|
|
58
|
-
CU:'Cuba',
|
|
59
|
-
CY:'Cyprus',
|
|
60
|
-
CZ:'Czechia',
|
|
61
|
-
DK:'Denmark',
|
|
62
|
-
DJ:'Djibouti',
|
|
63
|
-
DM:'Dominica',
|
|
64
|
-
DO:'Dominican Republic',
|
|
65
|
-
EC:'Ecuador',
|
|
66
|
-
EG:'Egypt',
|
|
67
|
-
SV:'El Salvador',
|
|
68
|
-
GQ:'Equatorial Guinea',
|
|
69
|
-
ER:'Eritrea',
|
|
70
|
-
EE:'Estonia',
|
|
71
|
-
ET:'Ethiopia',
|
|
72
|
-
FK:'Falkland Islands (Malvinas)',
|
|
73
|
-
FO:'Faroe Islands',
|
|
74
|
-
FJ:'Fiji',
|
|
75
|
-
FI:'Finland',
|
|
76
|
-
FR:'France',
|
|
77
|
-
GF:'French Guiana',
|
|
78
|
-
PF:'French Polynesia',
|
|
79
|
-
TF:'French Southern Territories',
|
|
80
|
-
GA:'Gabon',
|
|
81
|
-
GM:'Gambia',
|
|
82
|
-
GE:'Georgia',
|
|
83
|
-
DE:'Germany',
|
|
84
|
-
GH:'Ghana',
|
|
85
|
-
GI:'Gibraltar',
|
|
86
|
-
GR:'Greece',
|
|
87
|
-
GL:'Greenland',
|
|
88
|
-
GD:'Grenada',
|
|
89
|
-
GP:'Guadeloupe',
|
|
90
|
-
GU:'Guam',
|
|
91
|
-
GT:'Guatemala',
|
|
92
|
-
GG:'Guernsey',
|
|
93
|
-
GN:'Guinea',
|
|
94
|
-
GW:'Guinea-bissau',
|
|
95
|
-
GY:'Guyana',
|
|
96
|
-
HT:'Haiti',
|
|
97
|
-
HM:'Heard Island and Mcdonald Islands',
|
|
98
|
-
VA:'Holy See (Vatican City State)',
|
|
99
|
-
HN:'Honduras',
|
|
100
|
-
HK:'Hong Kong',
|
|
101
|
-
HU:'Hungary',
|
|
102
|
-
IS:'Iceland',
|
|
103
|
-
IN:'India',
|
|
104
|
-
ID:'Indonesia',
|
|
105
|
-
IR:'Iran, Islamic Republic of',
|
|
106
|
-
IQ:'Iraq',
|
|
107
|
-
IE:'Ireland',
|
|
108
|
-
IM:'Isle of Man',
|
|
109
|
-
IL:'Israel',
|
|
110
|
-
IT:'Italy',
|
|
111
|
-
JM:'Jamaica',
|
|
112
|
-
JP:'Japan',
|
|
113
|
-
JE:'Jersey',
|
|
114
|
-
JO:'Jordan',
|
|
115
|
-
KZ:'Kazakhstan',
|
|
116
|
-
KE:'Kenya',
|
|
117
|
-
KI:'Kiribati',
|
|
118
|
-
KP:'Korea, Democratic People’s Republic of',
|
|
119
|
-
KR:'Korea, Republic of',
|
|
120
|
-
KW:'Kuwait',
|
|
121
|
-
KG:'Kyrgyzstan',
|
|
122
|
-
LA:'Lao People’s Democratic Republic',
|
|
123
|
-
LV:'Latvia',
|
|
124
|
-
LB:'Lebanon',
|
|
125
|
-
LS:'Lesotho',
|
|
126
|
-
LR:'Liberia',
|
|
127
|
-
LY:'Libyan Arab Jamahiriya',
|
|
128
|
-
LI:'Liechtenstein',
|
|
129
|
-
LT:'Lithuania',
|
|
130
|
-
LU:'Luxembourg',
|
|
131
|
-
MO:'Macao',
|
|
132
|
-
MK:'Macedonia, The Former Yugoslav Republic of',
|
|
133
|
-
MG:'Madagascar',
|
|
134
|
-
MW:'Malawi',
|
|
135
|
-
MY:'Malaysia',
|
|
136
|
-
MV:'Maldives',
|
|
137
|
-
ML:'Mali',
|
|
138
|
-
MT:'Malta',
|
|
139
|
-
MH:'Marshall Islands',
|
|
140
|
-
MQ:'Martinique',
|
|
141
|
-
MR:'Mauritania',
|
|
142
|
-
MU:'Mauritius',
|
|
143
|
-
YT:'Mayotte',
|
|
144
|
-
MX:'Mexico',
|
|
145
|
-
FM:'Micronesia, Federated States of',
|
|
146
|
-
MD:'Moldova, Republic of',
|
|
147
|
-
MC:'Monaco',
|
|
148
|
-
MN:'Mongolia',
|
|
149
|
-
ME:'Montenegro',
|
|
150
|
-
MS:'Montserrat',
|
|
151
|
-
MA:'Morocco',
|
|
152
|
-
MZ:'Mozambique',
|
|
153
|
-
MM:'Myanmar',
|
|
154
|
-
NA:'Namibia',
|
|
155
|
-
NR:'Nauru',
|
|
156
|
-
NP:'Nepal',
|
|
157
|
-
NL:'Netherlands',
|
|
158
|
-
AN:'Netherlands Antilles',
|
|
159
|
-
NC:'New Caledonia',
|
|
160
|
-
NZ:'New Zealand',
|
|
161
|
-
NI:'Nicaragua',
|
|
162
|
-
NE:'Niger',
|
|
163
|
-
NG:'Nigeria',
|
|
164
|
-
NU:'Niue',
|
|
165
|
-
NF:'Norfolk Island',
|
|
166
|
-
MP:'Northern Mariana Islands',
|
|
167
|
-
NO:'Norway',
|
|
168
|
-
OM:'Oman',
|
|
169
|
-
PK:'Pakistan',
|
|
170
|
-
PW:'Palau',
|
|
171
|
-
PS:'Palestinian Territory, Occupied',
|
|
172
|
-
PA:'Panama',
|
|
173
|
-
PG:'Papua New Guinea',
|
|
174
|
-
PY:'Paraguay',
|
|
175
|
-
PE:'Peru',
|
|
176
|
-
PH:'Philippines',
|
|
177
|
-
PN:'Pitcairn',
|
|
178
|
-
PL:'Poland',
|
|
179
|
-
PT:'Portugal',
|
|
180
|
-
PR:'Puerto Rico',
|
|
181
|
-
QA:'Qatar',
|
|
182
|
-
RE:'Reunion',
|
|
183
|
-
RO:'Romania',
|
|
184
|
-
RU:'Russian Federation',
|
|
185
|
-
RW:'Rwanda',
|
|
186
|
-
SH:'Saint Helena',
|
|
187
|
-
KN:'Saint Kitts and Nevis',
|
|
188
|
-
LC:'Saint Lucia',
|
|
189
|
-
PM:'Saint Pierre and Miquelon',
|
|
190
|
-
VC:'Saint Vincent and The Grenadines',
|
|
191
|
-
WS:'Samoa',
|
|
192
|
-
SM:'San Marino',
|
|
193
|
-
ST:'Sao Tome and Principe',
|
|
194
|
-
SA:'Saudi Arabia',
|
|
195
|
-
SN:'Senegal',
|
|
196
|
-
RS:'Serbia',
|
|
197
|
-
SC:'Seychelles',
|
|
198
|
-
SL:'Sierra Leone',
|
|
199
|
-
SG:'Singapore',
|
|
200
|
-
SK:'Slovakia',
|
|
201
|
-
SI:'Slovenia',
|
|
202
|
-
SB:'Solomon Islands',
|
|
203
|
-
SO:'Somalia',
|
|
204
|
-
ZA:'South Africa',
|
|
205
|
-
GS:'South Georgia and The South Sandwich Islands',
|
|
206
|
-
ES:'Spain',
|
|
207
|
-
LK:'Sri Lanka',
|
|
208
|
-
SD:'Sudan',
|
|
209
|
-
SR:'Suriname',
|
|
210
|
-
SJ:'Svalbard and Jan Mayen',
|
|
211
|
-
SZ:'Swaziland',
|
|
212
|
-
SE:'Sweden',
|
|
213
|
-
CH:'Switzerland',
|
|
214
|
-
SY:'Syrian Arab Republic',
|
|
215
|
-
TW:'Taiwan, Province of China',
|
|
216
|
-
TJ:'Tajikistan',
|
|
217
|
-
TZ:'Tanzania, United Republic of',
|
|
218
|
-
TH:'Thailand',
|
|
219
|
-
TL:'Timor-leste',
|
|
220
|
-
TG:'Togo',
|
|
221
|
-
TK:'Tokelau',
|
|
222
|
-
TO:'Tonga',
|
|
223
|
-
TT:'Trinidad and Tobago',
|
|
224
|
-
TN:'Tunisia',
|
|
225
|
-
TR:'Turkey',
|
|
226
|
-
TM:'Turkmenistan',
|
|
227
|
-
TC:'Turks and Caicos Islands',
|
|
228
|
-
TV:'Tuvalu',
|
|
229
|
-
UG:'Uganda',
|
|
230
|
-
UA:'Ukraine',
|
|
231
|
-
AE:'United Arab Emirates',
|
|
232
|
-
GB:'United Kingdom',
|
|
233
|
-
US:'United States',
|
|
234
|
-
UM:'United States Minor Outlying Islands',
|
|
235
|
-
UY:'Uruguay',
|
|
236
|
-
UZ:'Uzbekistan',
|
|
237
|
-
VU:'Vanuatu',
|
|
238
|
-
VE:'Venezuela',
|
|
239
|
-
VN:'Viet Nam',
|
|
240
|
-
VG:'Virgin Islands, British',
|
|
241
|
-
VI:'Virgin Islands, U.S.',
|
|
242
|
-
WF:'Wallis and Futuna',
|
|
243
|
-
EH:'Western Sahara',
|
|
244
|
-
YE:'Yemen',
|
|
245
|
-
ZM:'Zambia',
|
|
246
|
-
ZW:'Zimbabwe',
|
|
247
|
-
};
|
|
248
|
-
|
|
249
2
|
class Country {
|
|
250
3
|
static getFlagPath(countryCode) {
|
|
251
4
|
return flagsPath+countryCode.toLowerCase()+'.png';
|
|
@@ -262,13 +15,258 @@ class Country {
|
|
|
262
15
|
select.selectpicker('refresh');
|
|
263
16
|
}
|
|
264
17
|
static getCountryName(countryCode) {
|
|
265
|
-
if (
|
|
266
|
-
return
|
|
18
|
+
if (Country.getCountryList().hasOwnProperty(countryCode)) {
|
|
19
|
+
return Country.getCountryList()[countryCode];
|
|
267
20
|
}
|
|
268
21
|
return countryCode;
|
|
269
22
|
}
|
|
270
23
|
static getCountryList() {
|
|
271
|
-
return
|
|
24
|
+
return {
|
|
25
|
+
AF:'Afghanistan',
|
|
26
|
+
AX:'Åland Islands',
|
|
27
|
+
AL:'Albania',
|
|
28
|
+
DZ:'Algeria',
|
|
29
|
+
AS:'American Samoa',
|
|
30
|
+
AD:'Andorra',
|
|
31
|
+
AO:'Angola',
|
|
32
|
+
AI:'Anguilla',
|
|
33
|
+
AQ:'Antarctica',
|
|
34
|
+
AG:'Antigua and Barbuda',
|
|
35
|
+
AR:'Argentina',
|
|
36
|
+
AM:'Armenia',
|
|
37
|
+
AW:'Aruba',
|
|
38
|
+
AU:'Australia',
|
|
39
|
+
AT:'Austria',
|
|
40
|
+
AZ:'Azerbaijan',
|
|
41
|
+
BS:'Bahamas',
|
|
42
|
+
BH:'Bahrain',
|
|
43
|
+
BD:'Bangladesh',
|
|
44
|
+
BB:'Barbados',
|
|
45
|
+
BY:'Belarus',
|
|
46
|
+
BE:'Belgium',
|
|
47
|
+
BZ:'Belize',
|
|
48
|
+
BJ:'Benin',
|
|
49
|
+
BM:'Bermuda',
|
|
50
|
+
BT:'Bhutan',
|
|
51
|
+
BO:'Bolivia',
|
|
52
|
+
BA:'Bosnia and Herzegovina',
|
|
53
|
+
BW:'Botswana',
|
|
54
|
+
BV:'Bouvet Island',
|
|
55
|
+
BR:'Brazil',
|
|
56
|
+
IO:'British Indian Ocean Territory',
|
|
57
|
+
BN:'Brunei Darussalam',
|
|
58
|
+
BG:'Bulgaria',
|
|
59
|
+
BF:'Burkina Faso',
|
|
60
|
+
BI:'Burundi',
|
|
61
|
+
KH:'Cambodia',
|
|
62
|
+
CM:'Cameroon',
|
|
63
|
+
CA:'Canada',
|
|
64
|
+
CV:'Cape Verde',
|
|
65
|
+
KY:'Cayman Islands',
|
|
66
|
+
CF:'Central African Republic',
|
|
67
|
+
TD:'Chad',
|
|
68
|
+
CL:'Chile',
|
|
69
|
+
CN:'China',
|
|
70
|
+
CX:'Christmas Island',
|
|
71
|
+
CC:'Cocos (Keeling) Islands',
|
|
72
|
+
CO:'Colombia',
|
|
73
|
+
KM:'Comoros',
|
|
74
|
+
CG:'Congo',
|
|
75
|
+
CD:'Congo, The Democratic Republic of The',
|
|
76
|
+
CK:'Cook Islands',
|
|
77
|
+
CR:'Costa Rica',
|
|
78
|
+
CI:'Cote d’Ivoire',
|
|
79
|
+
HR:'Croatia',
|
|
80
|
+
CU:'Cuba',
|
|
81
|
+
CY:'Cyprus',
|
|
82
|
+
CZ:'Czechia',
|
|
83
|
+
DK:'Denmark',
|
|
84
|
+
DJ:'Djibouti',
|
|
85
|
+
DM:'Dominica',
|
|
86
|
+
DO:'Dominican Republic',
|
|
87
|
+
EC:'Ecuador',
|
|
88
|
+
EG:'Egypt',
|
|
89
|
+
SV:'El Salvador',
|
|
90
|
+
GQ:'Equatorial Guinea',
|
|
91
|
+
ER:'Eritrea',
|
|
92
|
+
EE:'Estonia',
|
|
93
|
+
ET:'Ethiopia',
|
|
94
|
+
FK:'Falkland Islands (Malvinas)',
|
|
95
|
+
FO:'Faroe Islands',
|
|
96
|
+
FJ:'Fiji',
|
|
97
|
+
FI:'Finland',
|
|
98
|
+
FR:'France',
|
|
99
|
+
GF:'French Guiana',
|
|
100
|
+
PF:'French Polynesia',
|
|
101
|
+
TF:'French Southern Territories',
|
|
102
|
+
GA:'Gabon',
|
|
103
|
+
GM:'Gambia',
|
|
104
|
+
GE:'Georgia',
|
|
105
|
+
DE:'Germany',
|
|
106
|
+
GH:'Ghana',
|
|
107
|
+
GI:'Gibraltar',
|
|
108
|
+
GR:'Greece',
|
|
109
|
+
GL:'Greenland',
|
|
110
|
+
GD:'Grenada',
|
|
111
|
+
GP:'Guadeloupe',
|
|
112
|
+
GU:'Guam',
|
|
113
|
+
GT:'Guatemala',
|
|
114
|
+
GG:'Guernsey',
|
|
115
|
+
GN:'Guinea',
|
|
116
|
+
GW:'Guinea-bissau',
|
|
117
|
+
GY:'Guyana',
|
|
118
|
+
HT:'Haiti',
|
|
119
|
+
HM:'Heard Island and Mcdonald Islands',
|
|
120
|
+
VA:'Holy See (Vatican City State)',
|
|
121
|
+
HN:'Honduras',
|
|
122
|
+
HK:'Hong Kong',
|
|
123
|
+
HU:'Hungary',
|
|
124
|
+
IS:'Iceland',
|
|
125
|
+
IN:'India',
|
|
126
|
+
ID:'Indonesia',
|
|
127
|
+
IR:'Iran, Islamic Republic of',
|
|
128
|
+
IQ:'Iraq',
|
|
129
|
+
IE:'Ireland',
|
|
130
|
+
IM:'Isle of Man',
|
|
131
|
+
IL:'Israel',
|
|
132
|
+
IT:'Italy',
|
|
133
|
+
JM:'Jamaica',
|
|
134
|
+
JP:'Japan',
|
|
135
|
+
JE:'Jersey',
|
|
136
|
+
JO:'Jordan',
|
|
137
|
+
KZ:'Kazakhstan',
|
|
138
|
+
KE:'Kenya',
|
|
139
|
+
KI:'Kiribati',
|
|
140
|
+
KP:'Korea, Democratic People’s Republic of',
|
|
141
|
+
KR:'Korea, Republic of',
|
|
142
|
+
KW:'Kuwait',
|
|
143
|
+
KG:'Kyrgyzstan',
|
|
144
|
+
LA:'Lao People’s Democratic Republic',
|
|
145
|
+
LV:'Latvia',
|
|
146
|
+
LB:'Lebanon',
|
|
147
|
+
LS:'Lesotho',
|
|
148
|
+
LR:'Liberia',
|
|
149
|
+
LY:'Libyan Arab Jamahiriya',
|
|
150
|
+
LI:'Liechtenstein',
|
|
151
|
+
LT:'Lithuania',
|
|
152
|
+
LU:'Luxembourg',
|
|
153
|
+
MO:'Macao',
|
|
154
|
+
MK:'Macedonia, The Former Yugoslav Republic of',
|
|
155
|
+
MG:'Madagascar',
|
|
156
|
+
MW:'Malawi',
|
|
157
|
+
MY:'Malaysia',
|
|
158
|
+
MV:'Maldives',
|
|
159
|
+
ML:'Mali',
|
|
160
|
+
MT:'Malta',
|
|
161
|
+
MH:'Marshall Islands',
|
|
162
|
+
MQ:'Martinique',
|
|
163
|
+
MR:'Mauritania',
|
|
164
|
+
MU:'Mauritius',
|
|
165
|
+
YT:'Mayotte',
|
|
166
|
+
MX:'Mexico',
|
|
167
|
+
FM:'Micronesia, Federated States of',
|
|
168
|
+
MD:'Moldova, Republic of',
|
|
169
|
+
MC:'Monaco',
|
|
170
|
+
MN:'Mongolia',
|
|
171
|
+
ME:'Montenegro',
|
|
172
|
+
MS:'Montserrat',
|
|
173
|
+
MA:'Morocco',
|
|
174
|
+
MZ:'Mozambique',
|
|
175
|
+
MM:'Myanmar',
|
|
176
|
+
NA:'Namibia',
|
|
177
|
+
NR:'Nauru',
|
|
178
|
+
NP:'Nepal',
|
|
179
|
+
NL:'Netherlands',
|
|
180
|
+
AN:'Netherlands Antilles',
|
|
181
|
+
NC:'New Caledonia',
|
|
182
|
+
NZ:'New Zealand',
|
|
183
|
+
NI:'Nicaragua',
|
|
184
|
+
NE:'Niger',
|
|
185
|
+
NG:'Nigeria',
|
|
186
|
+
NU:'Niue',
|
|
187
|
+
NF:'Norfolk Island',
|
|
188
|
+
MP:'Northern Mariana Islands',
|
|
189
|
+
NO:'Norway',
|
|
190
|
+
OM:'Oman',
|
|
191
|
+
PK:'Pakistan',
|
|
192
|
+
PW:'Palau',
|
|
193
|
+
PS:'Palestinian Territory, Occupied',
|
|
194
|
+
PA:'Panama',
|
|
195
|
+
PG:'Papua New Guinea',
|
|
196
|
+
PY:'Paraguay',
|
|
197
|
+
PE:'Peru',
|
|
198
|
+
PH:'Philippines',
|
|
199
|
+
PN:'Pitcairn',
|
|
200
|
+
PL:'Poland',
|
|
201
|
+
PT:'Portugal',
|
|
202
|
+
PR:'Puerto Rico',
|
|
203
|
+
QA:'Qatar',
|
|
204
|
+
RE:'Reunion',
|
|
205
|
+
RO:'Romania',
|
|
206
|
+
RU:'Russian Federation',
|
|
207
|
+
RW:'Rwanda',
|
|
208
|
+
SH:'Saint Helena',
|
|
209
|
+
KN:'Saint Kitts and Nevis',
|
|
210
|
+
LC:'Saint Lucia',
|
|
211
|
+
PM:'Saint Pierre and Miquelon',
|
|
212
|
+
VC:'Saint Vincent and The Grenadines',
|
|
213
|
+
WS:'Samoa',
|
|
214
|
+
SM:'San Marino',
|
|
215
|
+
ST:'Sao Tome and Principe',
|
|
216
|
+
SA:'Saudi Arabia',
|
|
217
|
+
SN:'Senegal',
|
|
218
|
+
RS:'Serbia',
|
|
219
|
+
SC:'Seychelles',
|
|
220
|
+
SL:'Sierra Leone',
|
|
221
|
+
SG:'Singapore',
|
|
222
|
+
SK:'Slovakia',
|
|
223
|
+
SI:'Slovenia',
|
|
224
|
+
SB:'Solomon Islands',
|
|
225
|
+
SO:'Somalia',
|
|
226
|
+
ZA:'South Africa',
|
|
227
|
+
GS:'South Georgia and The South Sandwich Islands',
|
|
228
|
+
ES:'Spain',
|
|
229
|
+
LK:'Sri Lanka',
|
|
230
|
+
SD:'Sudan',
|
|
231
|
+
SR:'Suriname',
|
|
232
|
+
SJ:'Svalbard and Jan Mayen',
|
|
233
|
+
SZ:'Swaziland',
|
|
234
|
+
SE:'Sweden',
|
|
235
|
+
CH:'Switzerland',
|
|
236
|
+
SY:'Syrian Arab Republic',
|
|
237
|
+
TW:'Taiwan, Province of China',
|
|
238
|
+
TJ:'Tajikistan',
|
|
239
|
+
TZ:'Tanzania, United Republic of',
|
|
240
|
+
TH:'Thailand',
|
|
241
|
+
TL:'Timor-leste',
|
|
242
|
+
TG:'Togo',
|
|
243
|
+
TK:'Tokelau',
|
|
244
|
+
TO:'Tonga',
|
|
245
|
+
TT:'Trinidad and Tobago',
|
|
246
|
+
TN:'Tunisia',
|
|
247
|
+
TR:'Turkey',
|
|
248
|
+
TM:'Turkmenistan',
|
|
249
|
+
TC:'Turks and Caicos Islands',
|
|
250
|
+
TV:'Tuvalu',
|
|
251
|
+
UG:'Uganda',
|
|
252
|
+
UA:'Ukraine',
|
|
253
|
+
AE:'United Arab Emirates',
|
|
254
|
+
GB:'United Kingdom',
|
|
255
|
+
US:'United States',
|
|
256
|
+
UM:'United States Minor Outlying Islands',
|
|
257
|
+
UY:'Uruguay',
|
|
258
|
+
UZ:'Uzbekistan',
|
|
259
|
+
VU:'Vanuatu',
|
|
260
|
+
VE:'Venezuela',
|
|
261
|
+
VN:'Viet Nam',
|
|
262
|
+
VG:'Virgin Islands, British',
|
|
263
|
+
VI:'Virgin Islands, U.S.',
|
|
264
|
+
WF:'Wallis and Futuna',
|
|
265
|
+
EH:'Western Sahara',
|
|
266
|
+
YE:'Yemen',
|
|
267
|
+
ZM:'Zambia',
|
|
268
|
+
ZW:'Zimbabwe',
|
|
269
|
+
};
|
|
272
270
|
}
|
|
273
271
|
}
|
|
274
272
|
|
|
@@ -385,4 +383,4 @@ class Location {
|
|
|
385
383
|
}
|
|
386
384
|
}
|
|
387
385
|
|
|
388
|
-
module.exports = {
|
|
386
|
+
module.exports = { Country, PostalAddress, Location };
|
package/number.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
|
|
2
|
+
/** @deprecated */
|
|
2
3
|
class NumberValue {
|
|
4
|
+
/** @deprecated */
|
|
3
5
|
static isNumeric(sText) {
|
|
4
6
|
var ValidChars = "0123456789.";
|
|
5
7
|
var IsNumber=true;
|
|
@@ -13,6 +15,7 @@ class NumberValue {
|
|
|
13
15
|
return IsNumber;
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
/** @deprecated */
|
|
16
19
|
static format(number, nbDecimal, locale) {
|
|
17
20
|
nbDecimal = (typeof nbDecimal != 'undefined'?nbDecimal:2);
|
|
18
21
|
return new Intl.NumberFormat(locale, {
|
|
@@ -21,6 +24,7 @@ class NumberValue {
|
|
|
21
24
|
}).format(number);
|
|
22
25
|
}
|
|
23
26
|
|
|
27
|
+
/** @deprecated */
|
|
24
28
|
static formatCurrency(montant, currency, nbDecimal, locale) {
|
|
25
29
|
nbDecimal = (typeof nbDecimal != 'undefined'?nbDecimal:2);
|
|
26
30
|
return new Intl.NumberFormat(locale, {
|
|
@@ -31,6 +35,7 @@ class NumberValue {
|
|
|
31
35
|
}).format(montant);
|
|
32
36
|
}
|
|
33
37
|
|
|
38
|
+
/** @deprecated */
|
|
34
39
|
static formatPercent(number, nbDecimal, locale) {
|
|
35
40
|
nbDecimal = (typeof nbDecimal != 'undefined'?nbDecimal:2);
|
|
36
41
|
return new Intl.NumberFormat(locale, {
|
|
@@ -40,14 +45,17 @@ class NumberValue {
|
|
|
40
45
|
}).format(number);
|
|
41
46
|
}
|
|
42
47
|
|
|
48
|
+
/** @deprecated */
|
|
43
49
|
static random(min, max) {
|
|
44
50
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
45
51
|
}
|
|
46
52
|
|
|
53
|
+
/** @deprecated */
|
|
47
54
|
static padLeft2(n) {
|
|
48
55
|
return n > 9 ? "" + n: "0" + n;
|
|
49
56
|
}
|
|
50
57
|
|
|
58
|
+
/** @deprecated */
|
|
51
59
|
static roundDecimal(nombre, precision) {
|
|
52
60
|
precision = precision || 2;
|
|
53
61
|
var tmp = Math.pow(10, precision);
|
|
@@ -55,25 +63,69 @@ class NumberValue {
|
|
|
55
63
|
}
|
|
56
64
|
}
|
|
57
65
|
|
|
66
|
+
Number.prototype.format = Number.prototype.format || function(nbDecimal, locale) {
|
|
67
|
+
nbDecimal = (typeof nbDecimal != 'undefined'?nbDecimal:2);
|
|
68
|
+
return new Intl.NumberFormat(locale, {
|
|
69
|
+
minimumFractionDigits: nbDecimal,
|
|
70
|
+
maximumFractionDigits: nbDecimal
|
|
71
|
+
}).format(this);
|
|
72
|
+
}
|
|
73
|
+
|
|
58
74
|
/**
|
|
59
75
|
* Number.prototype.format(n, x, s, c)
|
|
60
|
-
*
|
|
76
|
+
*
|
|
61
77
|
* @param integer n: length of decimal
|
|
62
78
|
* @param mixed s: sections delimiter
|
|
63
79
|
* @param mixed c: decimal delimiter
|
|
64
80
|
* @param integer x: length of sections
|
|
65
81
|
*/
|
|
66
|
-
Number.prototype.formatForDisplay = function(n, s, c, x) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
82
|
+
Number.prototype.formatForDisplay = Number.prototype.formatForDisplay || function(n, s, c, x) {
|
|
83
|
+
var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\D' : '$') + ')',
|
|
84
|
+
num = this.toFixed(Math.max(0, ~~n));
|
|
85
|
+
return (c ? num.replace('.', c) : num).replace(new RegExp(re, 'g'), '$&' + (s || ','));
|
|
70
86
|
};
|
|
71
87
|
|
|
88
|
+
Number.prototype.formatCurrency = Number.prototype.formatCurrency || function(currency, nbDecimal, locale) {
|
|
89
|
+
nbDecimal = (typeof nbDecimal != 'undefined'?nbDecimal:2);
|
|
90
|
+
return new Intl.NumberFormat(locale, {
|
|
91
|
+
style: 'currency',
|
|
92
|
+
currency: currency,
|
|
93
|
+
minimumFractionDigits: nbDecimal,
|
|
94
|
+
maximumFractionDigits: nbDecimal
|
|
95
|
+
}).format(this);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
Number.prototype.formatPercent = Number.prototype.formatPercent || function(nbDecimal, locale) {
|
|
99
|
+
nbDecimal = (typeof nbDecimal != 'undefined'?nbDecimal:2);
|
|
100
|
+
return new Intl.NumberFormat(locale, {
|
|
101
|
+
style: 'percent',
|
|
102
|
+
minimumFractionDigits: nbDecimal,
|
|
103
|
+
maximumFractionDigits: nbDecimal
|
|
104
|
+
}).format(this);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
Number.prototype.padLeft2 = Number.prototype.padLeft2 || function(n) {
|
|
108
|
+
return this > 9 ? "" + this : "0" + this;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
Number.prototype.roundDecimal = Number.prototype.roundDecimal || function(precision) {
|
|
112
|
+
precision = precision || 2;
|
|
113
|
+
var tmp = Math.pow(10, precision);
|
|
114
|
+
return Math.round(this*tmp) / tmp;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (!Number.random) {
|
|
118
|
+
Number.random = function(min, max) {
|
|
119
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** @deprecated */
|
|
72
124
|
Number.prototype.formatAsString = function(locale, minimumFractionDigits) {
|
|
73
125
|
minimumFractionDigits = (typeof minimumFractionDigits != 'undefined'?minimumFractionDigits:0);
|
|
74
126
|
return new Intl.NumberFormat(locale, {minimumFractionDigits: minimumFractionDigits}).format(this);
|
|
75
127
|
};
|
|
76
|
-
|
|
128
|
+
/** @deprecated */
|
|
77
129
|
Number.prototype.formatAsCurrency = function(locale, currency, nbFractionDigits) {
|
|
78
130
|
nbFractionDigits = (typeof nbFractionDigits != 'undefined'?nbFractionDigits:2);
|
|
79
131
|
return new Intl.NumberFormat(locale, {
|
|
@@ -83,7 +135,7 @@ Number.prototype.formatAsCurrency = function(locale, currency, nbFractionDigits)
|
|
|
83
135
|
maximumFractionDigits: nbFractionDigits
|
|
84
136
|
}).format(this);
|
|
85
137
|
};
|
|
86
|
-
|
|
138
|
+
/** @deprecated */
|
|
87
139
|
Number.prototype.formatAsPercent = function(locale, minimumFractionDigits) {
|
|
88
140
|
minimumFractionDigits = (typeof minimumFractionDigits != 'undefined'?minimumFractionDigits:0);
|
|
89
141
|
return new Intl.NumberFormat(locale, {style: 'percent', minimumFractionDigits:minimumFractionDigits}).format(this);
|
package/package.json
CHANGED
package/paging.js
CHANGED
|
@@ -96,31 +96,31 @@ class Pagination {
|
|
|
96
96
|
update();
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
});
|
|
99
|
+
static activateTab(a) {
|
|
100
|
+
//console.log(a);
|
|
101
|
+
//a.click();
|
|
102
|
+
let ulNav = a.closest('.nav');
|
|
103
|
+
let tabContent = ulNav.parent().find('.tab-content');
|
|
104
|
+
|
|
105
|
+
// déselection éventuel des onglets
|
|
106
|
+
ulNav.find('a.nav-link').each(function(idx, navLink) {
|
|
107
|
+
$(navLink).removeClass('active');
|
|
108
|
+
let id = $(navLink).attr('href');
|
|
109
|
+
if (id.substr(0, 1) === '#') {
|
|
110
|
+
tabContent.find(id).removeClass('active').removeClass('show');
|
|
111
|
+
}
|
|
112
|
+
});
|
|
115
113
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
// sélection de l'onglet correspondant au navLink passé en paramètre
|
|
115
|
+
a.addClass('active');
|
|
116
|
+
tabContent.find(a.attr('href')).addClass('active').addClass('show');
|
|
117
|
+
}
|
|
119
118
|
}
|
|
120
119
|
|
|
121
|
-
module.exports = { Pagination
|
|
120
|
+
module.exports = { Pagination };
|
|
122
121
|
|
|
123
122
|
// deprecated
|
|
123
|
+
/*
|
|
124
124
|
function paginationAsList(nbResultatsTotal, nbResultatsParPage, urlPage, nomParamPage) {
|
|
125
125
|
var currentUrl = urlPage || window.location.href;
|
|
126
126
|
var afficherLienFirstLastPage = true;
|
|
@@ -237,3 +237,4 @@ function paginationAsList(nbResultatsTotal, nbResultatsParPage, urlPage, nomPara
|
|
|
237
237
|
|
|
238
238
|
return strPagination;
|
|
239
239
|
}
|
|
240
|
+
*/
|
package/string.js
CHANGED
|
@@ -1,33 +1,18 @@
|
|
|
1
|
-
function selectionnerContenuNode(node) {
|
|
2
|
-
if (window.getSelection) {
|
|
3
|
-
var selection = window.getSelection();
|
|
4
|
-
var intervalle = document.createRange();
|
|
5
|
-
intervalle.selectNodeContents(node);
|
|
6
|
-
selection.removeAllRanges();
|
|
7
|
-
selection.addRange(intervalle);
|
|
8
|
-
}
|
|
9
|
-
else if (document.body.createTextRange) {
|
|
10
|
-
var intervalle = document.body.createTextRange();
|
|
11
|
-
intervalle.moveToElementText(node);
|
|
12
|
-
intervalle.select();
|
|
13
|
-
}
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
1
|
|
|
17
|
-
function
|
|
2
|
+
String.prototype.copyToClipboard = String.prototype.copyToClipboard || function() {
|
|
18
3
|
if (window.clipboardData && clipboardData.setData) {
|
|
19
|
-
window.clipboardData.setData('Text',
|
|
4
|
+
window.clipboardData.setData('Text', this);
|
|
20
5
|
}
|
|
21
6
|
else if (document.body.createTextRange) {
|
|
22
7
|
var textRange = document.body.createTextRange();
|
|
23
|
-
textRange.moveToElementText(
|
|
8
|
+
textRange.moveToElementText(this);
|
|
24
9
|
textRange.execCommand("Copy");
|
|
25
10
|
}
|
|
26
11
|
else {
|
|
27
12
|
try {
|
|
28
13
|
// On test si la configuration permet l'accès au presse-papier.
|
|
29
14
|
netscape.security.PrivilegeManager
|
|
30
|
-
|
|
15
|
+
.enablePrivilege("UniversalXPConnect");
|
|
31
16
|
}
|
|
32
17
|
catch (e) {
|
|
33
18
|
alert("Impossible d'accéder au presse-papier.");
|
|
@@ -35,54 +20,76 @@ function copierTexte(texte) {
|
|
|
35
20
|
// Initialisation du composant fournit par Mozilla.
|
|
36
21
|
var gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);
|
|
37
22
|
// Copie du texte dans le presse papier.
|
|
38
|
-
gClipboardHelper.copyString(
|
|
23
|
+
gClipboardHelper.copyString(this);
|
|
39
24
|
}
|
|
40
25
|
return false;
|
|
41
26
|
}
|
|
42
27
|
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
28
|
+
String.prototype.reverseString = String.prototype.reverseString || function() {
|
|
29
|
+
return this.split('').reverse().join('');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
String.prototype.truncateOnWord = String.prototype.truncateOnWord || function(limit, fromLeft) {
|
|
33
|
+
if (fromLeft) {
|
|
34
|
+
return this.reverseString(this.truncateOnWord(this.reverseString(), limit));
|
|
35
|
+
}
|
|
36
|
+
var TRIM_CHARS = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF';
|
|
37
|
+
var words = this.split(RegExp('(?=['+TRIM_CHARS+'])'));
|
|
38
|
+
var count = 0;
|
|
39
|
+
|
|
40
|
+
function filter(arr, fn) {
|
|
41
|
+
var result = [];
|
|
42
|
+
for (var i = 0, len = arr.length; i < len; i++) {
|
|
43
|
+
var el = arr[i];
|
|
44
|
+
if (i in arr && fn(el, i)) {
|
|
45
|
+
result.push(el);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return filter(words, function(word) {
|
|
52
|
+
count += word.length;
|
|
53
|
+
return count <= limit;
|
|
54
|
+
}).join('');
|
|
53
55
|
}
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
57
|
+
String.prototype.truncateString = String.prototype.truncateString || function(length, from, ellipsis, split) {
|
|
58
|
+
let str1, str2, len1, len2;
|
|
59
|
+
if (this.length <= length) {
|
|
60
|
+
return this.toString();
|
|
59
61
|
}
|
|
60
62
|
ellipsis = typeof ellipsis === 'undefined' ? '…' : ellipsis;
|
|
61
63
|
switch(from) {
|
|
62
64
|
case 'left':
|
|
63
|
-
str2 = split ? truncateOnWord(
|
|
65
|
+
str2 = split ? this.truncateOnWord(length, true) : this.slice(this.length - length);
|
|
64
66
|
return ellipsis + str2;
|
|
65
67
|
case 'middle':
|
|
66
|
-
len1 = ceil(length / 2);
|
|
67
|
-
len2 = floor(length / 2);
|
|
68
|
-
str1 = split ? truncateOnWord(
|
|
69
|
-
str2 = split ? truncateOnWord(
|
|
68
|
+
len1 = Math.ceil(length / 2);
|
|
69
|
+
len2 = Math.floor(length / 2);
|
|
70
|
+
str1 = split ? this.truncateOnWord(len1) : this.slice(0, len1);
|
|
71
|
+
str2 = split ? this.truncateOnWord(len2, true) : this.slice(this.length - len2);
|
|
70
72
|
return str1 + ellipsis + str2;
|
|
71
73
|
default:
|
|
72
|
-
str1 = split ? truncateOnWord(
|
|
74
|
+
str1 = split ? this.truncateOnWord(length) : this.slice(0, length);
|
|
73
75
|
return str1 + ellipsis;
|
|
74
76
|
}
|
|
75
|
-
}
|
|
76
|
-
function truncateOnWord(str, length, from, ellipsis) {
|
|
77
|
-
return truncateString(str, length, from, ellipsis, true);
|
|
78
|
-
}
|
|
77
|
+
};
|
|
79
78
|
|
|
80
79
|
String.prototype.htmlentities = String.prototype.htmlentities || function() {
|
|
81
80
|
return this.replace(/[\u00A0-\u9999<>\&]/gim, (i) => '&#'+i.charCodeAt(0)+';');
|
|
82
81
|
};
|
|
83
82
|
|
|
84
83
|
String.prototype.escapeHtml = String.prototype.escapeHtml || function() {
|
|
85
|
-
|
|
84
|
+
let entityMap = {
|
|
85
|
+
"&": "&",
|
|
86
|
+
"<": "<",
|
|
87
|
+
">": ">",
|
|
88
|
+
'"': '"',
|
|
89
|
+
"'": ''',
|
|
90
|
+
"/": '/'
|
|
91
|
+
};
|
|
92
|
+
return this.replace(/[&<>"'\/]/g, (s) => entityMap[s]);
|
|
86
93
|
};
|
|
87
94
|
|
|
88
95
|
String.prototype.normalizeBreaks = String.prototype.normalizeBreaks || function(breaktype) {
|
|
@@ -97,17 +104,30 @@ String.prototype.format = String.prototype.format || function() {
|
|
|
97
104
|
return this.replace(/{(\d+)}/g, (match, number) => (typeof args[number] != 'undefined' ? args[number] : match));
|
|
98
105
|
};
|
|
99
106
|
|
|
100
|
-
String.prototype.ucwords = function() {
|
|
107
|
+
String.prototype.ucwords = String.prototype.ucwords || function() {
|
|
101
108
|
return this.toLowerCase().replace(/(^([a-zA-Z\p{M}]))|([ -][a-zA-Z\p{M}])/g, ($1) => $1.toUpperCase());
|
|
102
109
|
};
|
|
103
|
-
String.prototype.capitalize = function() {
|
|
110
|
+
String.prototype.capitalize = String.prototype.capitalize || function() {
|
|
104
111
|
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
105
112
|
}
|
|
106
113
|
|
|
107
|
-
String.prototype.encodeForHtmlDataAttribute = function() {
|
|
114
|
+
String.prototype.encodeForHtmlDataAttribute = String.prototype.encodeForHtmlDataAttribute || function() {
|
|
108
115
|
return this.replace(/\"/g, "'");
|
|
109
116
|
}
|
|
110
117
|
|
|
118
|
+
String.prototype.isNumeric = String.prototype.isNumeric || function() {
|
|
119
|
+
let ValidChars = "0123456789.";
|
|
120
|
+
let IsNumber = true;
|
|
121
|
+
let Char;
|
|
122
|
+
for (let i = 0; i < this.length && IsNumber === true; i++){
|
|
123
|
+
Char = this.charAt(i);
|
|
124
|
+
if (ValidChars.indexOf(Char) === -1) {
|
|
125
|
+
IsNumber = false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return IsNumber;
|
|
129
|
+
}
|
|
130
|
+
|
|
111
131
|
// s'utilise : "ma chaine {0} de caracteres"
|
|
112
132
|
if (!String.format) {
|
|
113
133
|
String.format = function(format) {
|
|
@@ -116,4 +136,20 @@ if (!String.format) {
|
|
|
116
136
|
};
|
|
117
137
|
}
|
|
118
138
|
|
|
119
|
-
|
|
139
|
+
/*
|
|
140
|
+
function selectionnerContenuNode(node) {
|
|
141
|
+
if (window.getSelection) {
|
|
142
|
+
var selection = window.getSelection();
|
|
143
|
+
var intervalle = document.createRange();
|
|
144
|
+
intervalle.selectNodeContents(node);
|
|
145
|
+
selection.removeAllRanges();
|
|
146
|
+
selection.addRange(intervalle);
|
|
147
|
+
}
|
|
148
|
+
else if (document.body.createTextRange) {
|
|
149
|
+
var intervalle = document.body.createTextRange();
|
|
150
|
+
intervalle.moveToElementText(node);
|
|
151
|
+
intervalle.select();
|
|
152
|
+
}
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
*/
|
package/util.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
function addBookmark(anchor) {
|
|
2
|
-
if (navigator.appName != 'Microsoft Internet Explorer') {
|
|
3
|
-
window.sidebar.addPanel(anchor.get('title'), anchor.get('href'),"");
|
|
4
|
-
}
|
|
5
|
-
else {
|
|
6
|
-
window.external.AddFavorite(anchor.get('href'), anchor.get('title'));
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
1
|
|
|
10
2
|
function sleep(milliseconds) {
|
|
11
3
|
var start = new Date().getTime();
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var grecaptchaWidgets = [];
|
|
3
|
-
|
|
4
|
-
function grecaptchaOnload () {
|
|
5
|
-
if (typeof grecaptcha == 'undefined') {
|
|
6
|
-
console.log('var grecaptcha undefined');
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
document.querySelectorAll('.grecaptcha').forEach(element => {
|
|
10
|
-
grecaptchaWidgets[element.id] = grecaptcha.render(element.id, googleReCaptchaDatas);
|
|
11
|
-
});
|
|
12
|
-
//$('.grecaptcha').each(function(idx, el) {
|
|
13
|
-
// grecaptchaWidgets[$(el).attr('id')] = grecaptcha.render($(el).attr('id'), googleReCaptchaDatas);
|
|
14
|
-
//});
|
|
15
|
-
}
|