From a75ae3350f116fa4b346313ee4206cf8beece49e Mon Sep 17 00:00:00 2001 From: Galexion Date: Sun, 4 Jun 2023 04:49:45 -0400 Subject: [PATCH] fixed issues with user.js god i hate my life --- package-lock.json | 4 ++-- public/javascript/user.js | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index bab5f8d..c297696 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "maimaidxnet", + "name": "aquaimagegrabber", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "maimaidxnet", + "name": "aquaimagegrabber", "version": "1.0.0", "license": "ISC", "dependencies": { diff --git a/public/javascript/user.js b/public/javascript/user.js index 6394b94..cd97a93 100644 --- a/public/javascript/user.js +++ b/public/javascript/user.js @@ -91,6 +91,16 @@ async function getReleventInformation(musicData, id) { return songMatch; } +async function getReleventInformationMap(mapData, mapid) { + let mapMatch = undefined; + for(map of mapData) { + if (map.mapInfomation.colorId.id == mapid) { + mapMatch = map + } else continue + + } + return mapMatch +} // Ban Check lmao @@ -299,14 +309,15 @@ async function userAreaStatusFormatter(div) { let areaWrapper = document.createElement('div'); // create the Wrapper Div for (let i = UserAreaData.length - 1; i >= 0; i--) { const area = UserAreaData[i]; // get the area - const mapInfo = await getReleventInformation(mapMetadata, area.map_id); // get the relevent Map Information + const mapInfo = await getReleventInformationMap(mapMetadata, area.map_id); // get the relevent Map Information console.log(mapInfo) + if(!mapInfo) continue // continue if mapInfo cant be found for a map const areaGrid = document.createElement('div'); // create the Grid for the area inforrmation to go areaGrid.classList.add('areaGrid'); // add the appropriate class /* Area Title */ let areaTitle = document.createElement('div'); areaTitle.classList.add('areaTitle'); - areaTitle.innerHTML = `

${mapInfo.name.str}

` + areaTitle.innerHTML = `

${mapInfo.name}

` areaGrid.append(areaTitle) /* Kilometers */ let areaKilometers = document.createElement('div'); @@ -516,12 +527,7 @@ async function mapsMetadata() { const data = await response.json(); - const mapping = {}; - data.forEach((song) => { - mapping[song.name.id] = song; - }); - - return mapping; + return data; } catch (error) { console.error(error); }