@osimatic/helpers-js 1.0.710 → 1.1.1
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/CHANGELOG +12 -1
- package/contact_details.js +28 -32
- package/data_table.js +32 -30
- package/date_time.js +77 -8
- package/details_sub_array.js +2 -2
- package/draw.js +53 -0
- package/duration.js +5 -9
- package/file.js +2 -2
- package/flash_message.js +4 -8
- package/form_helper.js +188 -92
- package/google_charts.js +16 -15
- package/google_maps.js +1 -1
- package/google_recaptcha.js +1 -1
- package/http_client.js +420 -0
- package/import_from_csv.js +12 -12
- package/index.js +7 -5
- package/jwt.js +169 -46
- package/location.js +36 -13
- package/main.js +0 -0
- package/media.js +10 -12
- package/multiple_action_in_table.js +116 -18
- package/network.js +607 -597
- package/number.js +1 -1
- package/open_street_map.js +1 -1
- package/package.json +2 -2
- package/string.js +10 -10
- package/visitor.js +57 -1
package/number.js
CHANGED
|
@@ -22,7 +22,7 @@ if (!Number.format) {
|
|
|
22
22
|
* @param integer x: length of sections
|
|
23
23
|
*/
|
|
24
24
|
Number.prototype.formatForDisplay = Number.prototype.formatForDisplay || function(n, s, c, x) {
|
|
25
|
-
|
|
25
|
+
let re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\D' : '$') + ')',
|
|
26
26
|
num = this.toFixed(Math.max(0, ~~n));
|
|
27
27
|
return (c ? num.replace('.', c) : num).replace(new RegExp(re, 'g'), '$&' + (s || ','));
|
|
28
28
|
};
|
package/open_street_map.js
CHANGED
package/package.json
CHANGED
package/string.js
CHANGED
|
@@ -4,7 +4,7 @@ String.prototype.copyToClipboard = String.prototype.copyToClipboard || function(
|
|
|
4
4
|
window.clipboardData.setData('Text', this);
|
|
5
5
|
}
|
|
6
6
|
else if (document.body.createTextRange) {
|
|
7
|
-
|
|
7
|
+
let textRange = document.body.createTextRange();
|
|
8
8
|
textRange.moveToElementText(this);
|
|
9
9
|
textRange.execCommand("Copy");
|
|
10
10
|
}
|
|
@@ -18,7 +18,7 @@ String.prototype.copyToClipboard = String.prototype.copyToClipboard || function(
|
|
|
18
18
|
alert("Impossible d'accéder au presse-papier.");
|
|
19
19
|
}
|
|
20
20
|
// Initialisation du composant fournit par Mozilla.
|
|
21
|
-
|
|
21
|
+
let gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);
|
|
22
22
|
// Copie du texte dans le presse papier.
|
|
23
23
|
gClipboardHelper.copyString(this);
|
|
24
24
|
}
|
|
@@ -33,14 +33,14 @@ String.prototype.truncateOnWord = String.prototype.truncateOnWord || function(li
|
|
|
33
33
|
if (fromLeft) {
|
|
34
34
|
return this.reverseString(this.truncateOnWord(this.reverseString(), limit));
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
let 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
|
+
let words = this.split(RegExp('(?=['+TRIM_CHARS+'])'));
|
|
38
|
+
let count = 0;
|
|
39
39
|
|
|
40
40
|
function filter(arr, fn) {
|
|
41
|
-
|
|
42
|
-
for (
|
|
43
|
-
|
|
41
|
+
let result = [];
|
|
42
|
+
for (let i = 0, len = arr.length; i < len; i++) {
|
|
43
|
+
let el = arr[i];
|
|
44
44
|
if (i in arr && fn(el, i)) {
|
|
45
45
|
result.push(el);
|
|
46
46
|
}
|
|
@@ -105,7 +105,7 @@ String.prototype.escapeRegExp = String.prototype.escapeRegExp || function() {
|
|
|
105
105
|
return this.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
106
106
|
};
|
|
107
107
|
String.prototype.format = String.prototype.format || function() {
|
|
108
|
-
|
|
108
|
+
let args = arguments;
|
|
109
109
|
return this.replace(/{(\d+)}/g, (match, number) => (typeof args[number] != 'undefined' ? args[number] : match));
|
|
110
110
|
};
|
|
111
111
|
|
|
@@ -136,7 +136,7 @@ String.prototype.isNumeric = String.prototype.isNumeric || function() {
|
|
|
136
136
|
// s'utilise : "ma chaine {0} de caracteres"
|
|
137
137
|
if (!String.format) {
|
|
138
138
|
String.format = function(format) {
|
|
139
|
-
|
|
139
|
+
let args = Array.prototype.slice.call(arguments, 1);
|
|
140
140
|
return format.replace(/{(\d+)}/g, (match, number) => (typeof args[number] != 'undefined' ? args[number] : match));
|
|
141
141
|
};
|
|
142
142
|
}
|
package/visitor.js
CHANGED
|
@@ -12,6 +12,7 @@ class Browser {
|
|
|
12
12
|
return !!window.chrome && !!window.chrome.webstore;
|
|
13
13
|
}
|
|
14
14
|
static isIE() {
|
|
15
|
+
//return window.navigator.userAgent.indexOf("MSIE ") > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./);
|
|
15
16
|
return /*@cc_on!@*/false || !!document.documentMode;
|
|
16
17
|
}
|
|
17
18
|
static isEdge() {
|
|
@@ -19,4 +20,59 @@ class Browser {
|
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
class UserAgent {
|
|
24
|
+
static getOsDisplay(osName) {
|
|
25
|
+
let str = '';
|
|
26
|
+
if (osName === 'Windows') {
|
|
27
|
+
str += '<i class="fab fa-windows"></i>';
|
|
28
|
+
}
|
|
29
|
+
if (osName === 'Linux') {
|
|
30
|
+
str += '<i class="fab fa-linux"></i>';
|
|
31
|
+
}
|
|
32
|
+
if (osName === 'macOS' || osName === 'iOS') {
|
|
33
|
+
str += '<i class="fab fa-apple"></i>';
|
|
34
|
+
}
|
|
35
|
+
if (osName === 'Android') {
|
|
36
|
+
str += '<i class="fab fa-android"></i>';
|
|
37
|
+
}
|
|
38
|
+
str += ' '+osName;
|
|
39
|
+
return str.trim();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static getBrowserDisplay(browserName) {
|
|
43
|
+
let str = '';
|
|
44
|
+
if (browserName === 'Chrome') {
|
|
45
|
+
str += '<i class="fab fa-chrome"></i>';
|
|
46
|
+
}
|
|
47
|
+
if (browserName === 'Firefox') {
|
|
48
|
+
str += '<i class="fab fa-firefox"></i>';
|
|
49
|
+
}
|
|
50
|
+
if (browserName === 'Edge') {
|
|
51
|
+
str += '<i class="fab fa-edge"></i>';
|
|
52
|
+
}
|
|
53
|
+
if (browserName === 'Safari') {
|
|
54
|
+
str += '<i class="fab fa-safari"></i>';
|
|
55
|
+
}
|
|
56
|
+
if (browserName === 'Opera') {
|
|
57
|
+
str += '<i class="fab fa-opera"></i>';
|
|
58
|
+
}
|
|
59
|
+
str += ' '+browserName;
|
|
60
|
+
return str.trim();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static getDeviceDisplay(device) {
|
|
64
|
+
let str = '';
|
|
65
|
+
if (device['type'] === 'desktop') {
|
|
66
|
+
str += '<i class="fas fa-desktop"></i> Ordinateur';
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
if (device['is_mobile']) {
|
|
70
|
+
str += '<i class="fas fa-mobile-alt"></i> '+(null == device['manufacturer'] && null == device['model'] ? 'Mobile' : '');
|
|
71
|
+
}
|
|
72
|
+
str += device['manufacturer']+' '+device['model'];
|
|
73
|
+
}
|
|
74
|
+
return str.trim();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module.exports = { Browser, UserAgent };
|