From 9a06485a6c8d7619476b511d1f1da235872a0e40 Mon Sep 17 00:00:00 2001 From: FallBackITA27 Date: Thu, 11 Apr 2024 16:38:11 +0200 Subject: [PATCH] wb this --- mkwpp-parser/script.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/mkwpp-parser/script.js b/mkwpp-parser/script.js index 77aecb1..3d5746a 100644 --- a/mkwpp-parser/script.js +++ b/mkwpp-parser/script.js @@ -65,15 +65,7 @@ function resetOutput() { document.getElementById("output").innerHTML = ""; } -document.addEventListener("DOMContentLoaded", async function() { - fetch("https://www.mariokart64.com/mkw/profile.php").then(r=>r.text()).then(r=>{ - let profileDocument = new DOMParser().parseFromString(r); - let playerList = profileDocument.getElementsByClassName("playerslist")[0] - console.log(playerList); - }); -}); - -document.getElementById("readInput").addEventListener("click", function() { +async function parseData() { let parserData = document.getElementById("inputTextArea").value.split("\n").filter(r=>r !== ""); let currentSubmission = {skip:true}; let skipToNextSubmission = false; @@ -180,6 +172,16 @@ document.getElementById("readInput").addEventListener("click", function() { data.submissions.times.push(handleTime(data,track,nosc,flap)); } data.submissions.push(currentSubmission); +} + +document.addEventListener("DOMContentLoaded", async function() { + document.getElementById("readInput").addEventListener("click", parseData); + + // fetch("https://www.mariokart64.com/mkw/profile.php").then(r=>r.text()).then(r=>{ + // let profileDocument = new DOMParser().parseFromString(r); + // let playerList = profileDocument.getElementsByClassName("playerslist")[0] + // console.log(playerList); + // }); }); function handleTime(data, track, nosc, flap) {