From 6c4c0671c895598b4b1a71cea828ee1cac5274b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Garnier?= Date: Sun, 15 Jan 2023 23:29:27 +0100 Subject: [PATCH] test --- View/src/JS/dashboard.js | 176 +++++++++++++++++++-------------------- 1 file changed, 87 insertions(+), 89 deletions(-) diff --git a/View/src/JS/dashboard.js b/View/src/JS/dashboard.js index c6916340..1c636aec 100644 --- a/View/src/JS/dashboard.js +++ b/View/src/JS/dashboard.js @@ -1,99 +1,97 @@ function dashboard () { - var xhr = new XMLHttpRequest(); - xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayersEmail', true); - xhr.responseType = 'text'; - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - var playersEmail = xhr.onload = function () { - return JSON.parse(xhr.responseText); - }; - xhr.send(null); - var xhr = new XMLHttpRequest(); - xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayersPseudo', true); - xhr.responseType = 'text'; - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - var playersPseudo = xhr.onload = function () { - return JSON.parse(xhr.responseText); - } + // var xhr = new XMLHttpRequest(); + // xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayersEmail', true); + // xhr.responseType = 'text'; + // xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + // var playersEmail = xhr.onload = function () { + // return JSON.parse(xhr.responseText); + // }; + // xhr.send(null); + // var xhr = new XMLHttpRequest(); + // xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayersPseudo', true); + // xhr.responseType = 'text'; + // xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + // var playersPseudo = xhr.onload = function () { + // return JSON.parse(xhr.responseText); + // } data = []; - if (playersEmail[0] != null) { - v1 = {} - v1.type="line"; - v1.xValueFormatString=playersPseudo[0]; - v1.dataPoints=[]; - var xhr = new XMLHttpRequest(); - xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. playersEmail[0], true); - xhr.responseType = 'text'; - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - var score = xhr.onload = function () { - return JSON.parse(xhr.responseText); - }; - xhr.send(null); - for (i = 0; i < score.length; i++) { - v1.dataPoints.push({x:i+1,y:score[i]}); - } - data.push(v1); - } - // v.dataPoints.push({x:0,y:0}); - // v.dataPoints.push({x:0.5,y:300}); + // if (playersEmail[0] != null) { + // v1 = {} + // v1.type="line"; + // v1.xValueFormatString=playersPseudo[0]; + // v1.dataPoints=[]; + // var xhr = new XMLHttpRequest(); + // xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. playersEmail[0], true); + // xhr.responseType = 'text'; + // xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + // var score = xhr.onload = function () { + // return JSON.parse(xhr.responseText); + // }; + // xhr.send(null); + // for (i = 0; i < score.length; i++) { + // v1.dataPoints.push({x:i+1,y:score[i]}); + // } + // data.push(v1); + // } - if (playersEmail[1] != null) { - v2 = {} - v2.type="line"; - v2.xValueFormatString=playersPseudo[1]; - v2.dataPoints=[]; - var xhr = new XMLHttpRequest(); - xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. playersEmail[1], true); - xhr.responseType = 'text'; - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - var score = xhr.onload = function () { - return JSON.parse(xhr.responseText); - }; - xhr.send(null); - for (i = 0; i < score.length; i++) { - v2.dataPoints.push({x:i+1,y:score[i]}); - } - data.push(v2); - } + // if (playersEmail[1] != null) { + // v2 = {} + // v2.type="line"; + // v2.xValueFormatString=playersPseudo[1]; + // v2.dataPoints=[]; + // var xhr = new XMLHttpRequest(); + // xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. playersEmail[1], true); + // xhr.responseType = 'text'; + // xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + // var score = xhr.onload = function () { + // return JSON.parse(xhr.responseText); + // }; + // xhr.send(null); + // for (i = 0; i < score.length; i++) { + // v2.dataPoints.push({x:i+1,y:score[i]}); + // } + // data.push(v2); + // } - if (playersEmail[2] != null) { - v3 = {} - v3.type="line"; - v3.xValueFormatString=playersPseudo[2]; - v3.dataPoints=[]; - var xhr = new XMLHttpRequest(); - xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. playersEmail[2], true); - xhr.responseType = 'text'; - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - var score = xhr.onload = function () { - return JSON.parse(xhr.responseText); - }; - xhr.send(null); - for (i = 0; i < score.length; i++) { - v3.dataPoints.push({x:i+1,y:score[i]}); - } - data.push(v3); - } + // if (playersEmail[2] != null) { + // v3 = {} + // v3.type="line"; + // v3.xValueFormatString=playersPseudo[2]; + // v3.dataPoints=[]; + // var xhr = new XMLHttpRequest(); + // xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. playersEmail[2], true); + // xhr.responseType = 'text'; + // xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + // var score = xhr.onload = function () { + // return JSON.parse(xhr.responseText); + // }; + // xhr.send(null); + // for (i = 0; i < score.length; i++) { + // v3.dataPoints.push({x:i+1,y:score[i]}); + // } + // data.push(v3); + // } - if (playersEmail[3] != null) { - v4 = {} - v4.type="line"; - v4.xValueFormatString=playersPseudo[3]; - v4.dataPoints=[]; - var xhr = new XMLHttpRequest(); - xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. playersEmail[3], true); - xhr.responseType = 'text'; - xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - var score = xhr.onload = function () { - return JSON.parse(xhr.responseText); - }; - xhr.send(null); - for (i = 0; i < score.length; i++) { - v4.dataPoints.push({x:i+1,y:score[i]}); - } - data.push(v4); - } + // if (playersEmail[3] != null) { + // v4 = {} + // v4.type="line"; + // v4.xValueFormatString=playersPseudo[3]; + // v4.dataPoints=[]; + // var xhr = new XMLHttpRequest(); + // xhr.open('POST', 'http://82.165.180.114/Scripted/index.php?action=getPlayerScore&joueur='. playersEmail[3], true); + // xhr.responseType = 'text'; + // xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + // var score = xhr.onload = function () { + // return JSON.parse(xhr.responseText); + // }; + // xhr.send(null); + // for (i = 0; i < score.length; i++) { + // v4.dataPoints.push({x:i+1,y:score[i]}); + // } + // data.push(v4); + // } v4 = {} v4.type="line"; v4.xValueFormatString='playersPseudo';