@osimatic/helpers-js 1.0.6 → 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/{todos/google_charts.js → google_charts.js} +11 -8
- package/google_recaptcha.js +78 -0
- package/index.js +14 -7
- package/location.js +249 -251
- package/network.js +2 -0
- package/number.js +59 -7
- package/package.json +1 -1
- package/paging.js +21 -20
- package/string.js +85 -50
- package/util.js +0 -8
- package/todos/google_charts_mytime.js +0 -295
- package/todos/google_recaptcha.js +0 -15
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,34 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
function
|
|
3
|
-
if (window.getSelection) {
|
|
4
|
-
var selection = window.getSelection();
|
|
5
|
-
var intervalle = document.createRange();
|
|
6
|
-
intervalle.selectNodeContents(node);
|
|
7
|
-
selection.removeAllRanges();
|
|
8
|
-
selection.addRange(intervalle);
|
|
9
|
-
}
|
|
10
|
-
else if (document.body.createTextRange) {
|
|
11
|
-
var intervalle = document.body.createTextRange();
|
|
12
|
-
intervalle.moveToElementText(node);
|
|
13
|
-
intervalle.select();
|
|
14
|
-
}
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function copierTexte(texte) {
|
|
2
|
+
String.prototype.copyToClipboard = String.prototype.copyToClipboard || function() {
|
|
19
3
|
if (window.clipboardData && clipboardData.setData) {
|
|
20
|
-
window.clipboardData.setData('Text',
|
|
4
|
+
window.clipboardData.setData('Text', this);
|
|
21
5
|
}
|
|
22
6
|
else if (document.body.createTextRange) {
|
|
23
7
|
var textRange = document.body.createTextRange();
|
|
24
|
-
textRange.moveToElementText(
|
|
8
|
+
textRange.moveToElementText(this);
|
|
25
9
|
textRange.execCommand("Copy");
|
|
26
10
|
}
|
|
27
11
|
else {
|
|
28
12
|
try {
|
|
29
13
|
// On test si la configuration permet l'accès au presse-papier.
|
|
30
14
|
netscape.security.PrivilegeManager
|
|
31
|
-
|
|
15
|
+
.enablePrivilege("UniversalXPConnect");
|
|
32
16
|
}
|
|
33
17
|
catch (e) {
|
|
34
18
|
alert("Impossible d'accéder au presse-papier.");
|
|
@@ -36,54 +20,76 @@ function copierTexte(texte) {
|
|
|
36
20
|
// Initialisation du composant fournit par Mozilla.
|
|
37
21
|
var gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);
|
|
38
22
|
// Copie du texte dans le presse papier.
|
|
39
|
-
gClipboardHelper.copyString(
|
|
23
|
+
gClipboardHelper.copyString(this);
|
|
40
24
|
}
|
|
41
25
|
return false;
|
|
42
26
|
}
|
|
43
27
|
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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('');
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (
|
|
59
|
-
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();
|
|
60
61
|
}
|
|
61
62
|
ellipsis = typeof ellipsis === 'undefined' ? '…' : ellipsis;
|
|
62
63
|
switch(from) {
|
|
63
64
|
case 'left':
|
|
64
|
-
str2 = split ? truncateOnWord(
|
|
65
|
+
str2 = split ? this.truncateOnWord(length, true) : this.slice(this.length - length);
|
|
65
66
|
return ellipsis + str2;
|
|
66
67
|
case 'middle':
|
|
67
|
-
len1 = ceil(length / 2);
|
|
68
|
-
len2 = floor(length / 2);
|
|
69
|
-
str1 = split ? truncateOnWord(
|
|
70
|
-
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);
|
|
71
72
|
return str1 + ellipsis + str2;
|
|
72
73
|
default:
|
|
73
|
-
str1 = split ? truncateOnWord(
|
|
74
|
+
str1 = split ? this.truncateOnWord(length) : this.slice(0, length);
|
|
74
75
|
return str1 + ellipsis;
|
|
75
76
|
}
|
|
76
|
-
}
|
|
77
|
-
function truncateOnWord(str, length, from, ellipsis) {
|
|
78
|
-
return truncateString(str, length, from, ellipsis, true);
|
|
79
|
-
}
|
|
77
|
+
};
|
|
80
78
|
|
|
81
79
|
String.prototype.htmlentities = String.prototype.htmlentities || function() {
|
|
82
80
|
return this.replace(/[\u00A0-\u9999<>\&]/gim, (i) => '&#'+i.charCodeAt(0)+';');
|
|
83
81
|
};
|
|
84
82
|
|
|
85
83
|
String.prototype.escapeHtml = String.prototype.escapeHtml || function() {
|
|
86
|
-
|
|
84
|
+
let entityMap = {
|
|
85
|
+
"&": "&",
|
|
86
|
+
"<": "<",
|
|
87
|
+
">": ">",
|
|
88
|
+
'"': '"',
|
|
89
|
+
"'": ''',
|
|
90
|
+
"/": '/'
|
|
91
|
+
};
|
|
92
|
+
return this.replace(/[&<>"'\/]/g, (s) => entityMap[s]);
|
|
87
93
|
};
|
|
88
94
|
|
|
89
95
|
String.prototype.normalizeBreaks = String.prototype.normalizeBreaks || function(breaktype) {
|
|
@@ -98,17 +104,30 @@ String.prototype.format = String.prototype.format || function() {
|
|
|
98
104
|
return this.replace(/{(\d+)}/g, (match, number) => (typeof args[number] != 'undefined' ? args[number] : match));
|
|
99
105
|
};
|
|
100
106
|
|
|
101
|
-
String.prototype.ucwords = function() {
|
|
107
|
+
String.prototype.ucwords = String.prototype.ucwords || function() {
|
|
102
108
|
return this.toLowerCase().replace(/(^([a-zA-Z\p{M}]))|([ -][a-zA-Z\p{M}])/g, ($1) => $1.toUpperCase());
|
|
103
109
|
};
|
|
104
|
-
String.prototype.capitalize = function() {
|
|
110
|
+
String.prototype.capitalize = String.prototype.capitalize || function() {
|
|
105
111
|
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
106
112
|
}
|
|
107
113
|
|
|
108
|
-
String.prototype.encodeForHtmlDataAttribute = function() {
|
|
114
|
+
String.prototype.encodeForHtmlDataAttribute = String.prototype.encodeForHtmlDataAttribute || function() {
|
|
109
115
|
return this.replace(/\"/g, "'");
|
|
110
116
|
}
|
|
111
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
|
+
|
|
112
131
|
// s'utilise : "ma chaine {0} de caracteres"
|
|
113
132
|
if (!String.format) {
|
|
114
133
|
String.format = function(format) {
|
|
@@ -117,4 +136,20 @@ if (!String.format) {
|
|
|
117
136
|
};
|
|
118
137
|
}
|
|
119
138
|
|
|
120
|
-
|
|
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,295 +0,0 @@
|
|
|
1
|
-
// /!\
|
|
2
|
-
// /!\ Jérôme : à mon avis celui-ci n'est pas à jour et il ne faut plus l'utiliser (provient du projet mytime/admin_osi/audioconf.),
|
|
3
|
-
// /!\ ou alors il faut le retirer des helpers et créer une classe spécifique dans chaque projet (si comportements différents)
|
|
4
|
-
// /!\
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// google.load("visualization", "1", {packages:["corechart"]});
|
|
9
|
-
google.charts.load('current', {'packages':['bar','line','corechart']});
|
|
10
|
-
// google.charts.load('current', {packages:['corechart']});
|
|
11
|
-
|
|
12
|
-
google.charts.setOnLoadCallback(drawAllCharts);
|
|
13
|
-
|
|
14
|
-
function drawAllCharts() {
|
|
15
|
-
if (typeof(listCharts) != 'undefined' && listCharts.length > 0) {
|
|
16
|
-
loadListCharts(listCharts);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function loadListCharts(listCharts) {
|
|
21
|
-
$.each(listCharts, function(idx, chartData) {
|
|
22
|
-
// console.log('drawChart'+chartData.id);
|
|
23
|
-
drawChart(chartData.type_graph, chartData.id, chartData.title, chartData.libelle_abs, chartData.tab_data_abs, chartData.liste_libelle_ord, chartData.liste_tab_data_ord, chartData.list_color, chartData.format_ord, chartData.height, chartData.width);
|
|
24
|
-
|
|
25
|
-
/*
|
|
26
|
-
if (typeof(initWidth) == 'undefined' || initWidth) {
|
|
27
|
-
var width = 0;
|
|
28
|
-
$.each(listGraphStats, function(idx, tabGraph) {
|
|
29
|
-
if ($('#'+tabGraph.id).length) {
|
|
30
|
-
if ($('#'+tabGraph.id).width() > 0) {
|
|
31
|
-
width = $('#'+tabGraph.id).width();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
$.each(listGraphStats, function(idx, tabGraph) {
|
|
38
|
-
drawChart(tabGraph.type_graph, tabGraph.id, tabGraph.title, tabGraph.libelle_abs, tabGraph.tab_data_abs, tabGraph.liste_libelle_ord, tabGraph.liste_tab_data_ord, tabGraph.list_color, tabGraph.format_ord, tabGraph.height, width);
|
|
39
|
-
});
|
|
40
|
-
*/
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function drawChart(typeGraph, idDiv, titre, libelleAbs, tabDataAbsParam, listeLibelleOrd, listeTabDataOrd, tabColor, formatData, height, width) {
|
|
45
|
-
if ($('#'+idDiv).length == 0) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
var afficherLibelleOrd = false;
|
|
50
|
-
|
|
51
|
-
isStacked = false;
|
|
52
|
-
if (typeGraph == 'stacked_bar_chart') {
|
|
53
|
-
typeGraph = 'bar_chart';
|
|
54
|
-
isStacked = true;
|
|
55
|
-
}
|
|
56
|
-
if (typeGraph == 'stacked_column_chart') {
|
|
57
|
-
typeGraph = 'column_chart';
|
|
58
|
-
isStacked = true;
|
|
59
|
-
}
|
|
60
|
-
if (typeGraph == 'stacked_combo_chart') {
|
|
61
|
-
typeGraph = 'combo_chart';
|
|
62
|
-
isStacked = true;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
isDualChart = false;
|
|
66
|
-
if (typeGraph == 'dual_column_chart') {
|
|
67
|
-
typeGraph = 'column_chart';
|
|
68
|
-
isDualChart = true;
|
|
69
|
-
}
|
|
70
|
-
if (typeGraph == 'dual_bar_chart') {
|
|
71
|
-
typeGraph = 'bar_chart';
|
|
72
|
-
isDualChart = true;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Déclaration du tableau de données
|
|
76
|
-
var data = new google.visualization.DataTable();
|
|
77
|
-
data.addColumn('string', libelleAbs);
|
|
78
|
-
$.each(listeLibelleOrd, function(idx, libelleOrd) {
|
|
79
|
-
data.addColumn('number', libelleOrd);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// Remplissage des données
|
|
83
|
-
var nbCells = 0;
|
|
84
|
-
var numRow = 0;
|
|
85
|
-
$.each(tabDataAbsParam, function(idx, dataAbs) {
|
|
86
|
-
// dataOrd = tabDataOrd[idx];
|
|
87
|
-
// data.addRow([dataAbs, dataOrd]);
|
|
88
|
-
data.addRows(1);
|
|
89
|
-
|
|
90
|
-
data.setCell(numRow, 0, dataAbs);
|
|
91
|
-
|
|
92
|
-
var numCell = 1;
|
|
93
|
-
$.each(listeTabDataOrd, function(idx2, tabDataOrd) {
|
|
94
|
-
data.setCell(numRow, numCell, tabDataOrd[idx]);
|
|
95
|
-
numCell++;
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
nbCells = numCell;
|
|
99
|
-
numRow++;
|
|
100
|
-
});
|
|
101
|
-
nbCells -= 2;
|
|
102
|
-
|
|
103
|
-
// console.log(data);
|
|
104
|
-
// console.log('drawGraph : '+idDiv+' ; type : '+typeGraph);
|
|
105
|
-
|
|
106
|
-
// Options générales
|
|
107
|
-
var options = {
|
|
108
|
-
colors: tabColor,
|
|
109
|
-
fontName: 'Trebuchet MS',
|
|
110
|
-
fontSize: 12,
|
|
111
|
-
hAxis: {maxAlternation: 1},
|
|
112
|
-
vAxis: {minValue: 0, textPosition: 'out'},
|
|
113
|
-
//gridlines: {color: '#333', count: 1}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
if (formatData != null) {
|
|
117
|
-
options.vAxis.format = formatData;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Options sur le titre du graphique
|
|
121
|
-
options.title = titre;
|
|
122
|
-
if (typeGraph == 'pie_chart') {
|
|
123
|
-
// options.titlePosition = 'none';
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
options.titlePosition = 'none';
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Options sur la taille du graphique
|
|
130
|
-
if (typeGraph == 'bar_chart') {
|
|
131
|
-
options.chartArea = {left:120, top:30};
|
|
132
|
-
options.chartArea.height = (height-60);
|
|
133
|
-
options.chartArea.width = "85%";
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
options.chartArea = {left:"auto", top:"auto"};
|
|
137
|
-
if (height != null) {
|
|
138
|
-
options.chartArea.height = height+"%";
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
options.chartArea.height = "80%";
|
|
142
|
-
}
|
|
143
|
-
options.chartArea.width = "85%";
|
|
144
|
-
}
|
|
145
|
-
// options.chartArea = {};
|
|
146
|
-
// options.chartArea.height = "100%";
|
|
147
|
-
// options.chartArea.width = "100%";
|
|
148
|
-
|
|
149
|
-
options.width = width;
|
|
150
|
-
|
|
151
|
-
// Options sur la légende
|
|
152
|
-
options.legend = {};
|
|
153
|
-
if (typeGraph == 'pie_chart') {
|
|
154
|
-
options.legend.position = 'right';
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
options.legend.position = 'top';
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Options sur l'affichage des labels en absisse / ordonnée
|
|
161
|
-
if (typeGraph == 'bar_chart') {
|
|
162
|
-
// options.hAxis.title = libelleOrd;
|
|
163
|
-
options.vAxis.title = libelleAbs;
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
options.hAxis.title = libelleAbs;
|
|
167
|
-
// options.vAxis.title = libelleOrd;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Options sur les graphiques "dual bar chart / dual column chart"
|
|
171
|
-
if (isDualChart) {
|
|
172
|
-
options.series = {};
|
|
173
|
-
options.axes = {};
|
|
174
|
-
if (typeGraph == 'column_chart') {
|
|
175
|
-
options.axes.y = {};
|
|
176
|
-
options.vAxes = {};
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
options.axes.x = {};
|
|
180
|
-
options.hAxes = {};
|
|
181
|
-
}
|
|
182
|
-
$.each(listeLibelleOrd, function(idx, libelleOrd) {
|
|
183
|
-
// console.log(idx);
|
|
184
|
-
if (idx <= 1) {
|
|
185
|
-
// key = 'series_'+idx;
|
|
186
|
-
key = idx;
|
|
187
|
-
// options.series[idx] = {axis: key, targetAxisIndex: key};
|
|
188
|
-
options.series[idx] = {axis: key, targetAxisIndex: idx};
|
|
189
|
-
if (typeGraph == 'column_chart') {
|
|
190
|
-
options.axes.y[key] = {label: libelleOrd};
|
|
191
|
-
if (idx == 1) {
|
|
192
|
-
options.axes.y[key].side = 'right';
|
|
193
|
-
}
|
|
194
|
-
if (formatData != null) {
|
|
195
|
-
options.vAxes[key] = {format: formatData};
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
options.axes.x[key] = {label: libelleOrd};
|
|
200
|
-
if (idx == 1) {
|
|
201
|
-
options.axes.x[key].side = 'top';
|
|
202
|
-
}
|
|
203
|
-
if (formatData != null) {
|
|
204
|
-
options.hAxes[key] = {format: formatData};
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
// console.log(options.series);
|
|
210
|
-
// console.log(options.vAxes);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Options sur les graphiques "combo chart"
|
|
214
|
-
if (typeGraph == 'combo_chart') {
|
|
215
|
-
options.seriesType = "bars";
|
|
216
|
-
options.series = {};
|
|
217
|
-
options.series[nbCells] = {type: "line"};
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// Options sur le style des lignes pour les "line chart"
|
|
221
|
-
if (typeGraph == 'line_chart') {
|
|
222
|
-
options.series = [{lineWidth: 3}, {lineWidth: 1.5}];
|
|
223
|
-
options.curveType = 'function';
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// Options sur le style pour les "pie chart"
|
|
227
|
-
if (typeGraph == 'pie_chart') {
|
|
228
|
-
options.is3D = false;
|
|
229
|
-
options.pieResidueSliceLabel = 'Autre';
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if (typeGraph == 'bar_chart') {
|
|
233
|
-
options.bars = 'horizontal';
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (isStacked) {
|
|
237
|
-
options.isStacked = true;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// console.log(options);
|
|
241
|
-
|
|
242
|
-
// Création du graphique
|
|
243
|
-
var errorChart = false;
|
|
244
|
-
if (typeGraph == 'column_chart') {
|
|
245
|
-
// var chart = new google.visualization.ColumnChart(document.getElementById(idDiv));
|
|
246
|
-
var chart = new google.charts.Bar(document.getElementById(idDiv));
|
|
247
|
-
}
|
|
248
|
-
else if (typeGraph == 'bar_chart') {
|
|
249
|
-
// var chart = new google.visualization.BarChart(document.getElementById(idDiv));
|
|
250
|
-
var chart = new google.charts.Bar(document.getElementById(idDiv));
|
|
251
|
-
}
|
|
252
|
-
else if (typeGraph == 'line_chart') {
|
|
253
|
-
// var chart = new google.visualization.LineChart(document.getElementById(idDiv));
|
|
254
|
-
var chart = new google.charts.Line(document.getElementById(idDiv));
|
|
255
|
-
}
|
|
256
|
-
else if (typeGraph == 'combo_chart') {
|
|
257
|
-
var chart = new google.visualization.ComboChart(document.getElementById(idDiv));
|
|
258
|
-
}
|
|
259
|
-
else if (typeGraph == 'pie_chart') {
|
|
260
|
-
var chart = new google.visualization.PieChart(document.getElementById(idDiv));
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
errorChart = true;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
$('#'+idDiv).removeClass('ajaxLoader');
|
|
267
|
-
$('#'+idDiv).removeClass('graphique_load');
|
|
268
|
-
|
|
269
|
-
if (errorChart) {
|
|
270
|
-
console.log('erreur graphique');
|
|
271
|
-
$('#'+idDiv).addClass('graphique_error');
|
|
272
|
-
document.getElementById(idDiv).innerHTML = 'Une erreur s\'est produite lors du chargement du graphique.';
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
$('#'+idDiv).addClass('graphique');
|
|
276
|
-
document.getElementById(idDiv).innerHTML = '';
|
|
277
|
-
|
|
278
|
-
// $('#'+idDiv).
|
|
279
|
-
// document.getElementById(idDiv).style.display = 'block';
|
|
280
|
-
var hasClassActive = $('#'+idDiv).hasClass('active');
|
|
281
|
-
if (!hasClassActive) {
|
|
282
|
-
$('#'+idDiv).addClass('active');
|
|
283
|
-
}
|
|
284
|
-
google.visualization.events.addListener(chart, 'ready', function () {
|
|
285
|
-
// document.getElementById(idDiv).style.display = 'none';
|
|
286
|
-
// $('#'+idDiv).hide();
|
|
287
|
-
if (!hasClassActive) {
|
|
288
|
-
$('#'+idDiv).removeClass('active');
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
// console.log($("ul li.ui-state-active").index()
|
|
292
|
-
|
|
293
|
-
chart.draw(data, options);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
@@ -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
|
-
}
|