diff --git a/neomojimixer.js b/neomojimixer.js index 4fa5b39..2d94c0b 100644 --- a/neomojimixer.js +++ b/neomojimixer.js @@ -45,17 +45,17 @@ const stats = document.getElementById("stats"); // Loading the JSON and getting all the available parts async function getData() { - + fetch('./parts.json') - .then(function(response) { - return response.json(); - }) - .then(function(data) { - loadParts(data); - }) - .catch(function(error) { - console.log('An error occurred:', error); - }); + .then(function(response) { + return response.json(); + }) + .then(function(data) { + loadParts(data); + }) + .catch(function(error) { + console.log('An error occurred:', error); + }); } function loadParts(parts) { @@ -64,19 +64,19 @@ function loadParts(parts) { parts.type.body.forEach(fillArrayBody); parts.type.mouth.forEach(fillArrayMouth); parts.type.arms.forEach(fillArrayArms); - + //find the indexes of each part of the corresponding color and write those into the color arrays fillArraysArms(); - + //Randomize initial view randomize(); - + //Show little statistic var sum = body.length + eyes.length + mouth.length + arms.length; var variety = body.length * eyes.length * mouth.length * arms_orange.length; - + stats.innerHTML = "There are " + sum + " Elements available,
with " + new Intl.NumberFormat("de-DE").format(variety) + " possible combinations."; - + //Activate the buttons after everything is loaded in document.getElementById("body_left").disabled = false; document.getElementById("body_right").disabled = false; @@ -91,54 +91,54 @@ function loadParts(parts) { } -function fillArrayEyes(item){ +function fillArrayEyes(item) { let name = item.name; let url = item.url; eyes.push ([name, url]); //Two dimensional array, Second dimension holds name on index 0 and url at index 1 } -function fillArrayBody(item){ +function fillArrayBody(item) { let name = item.name; let url = item.url; let color = item.color; body.push ([name, url, color]); //Two dimensional array, Second dimension holds name on index 0 and url at index 1 } -function fillArrayMouth(item){ +function fillArrayMouth(item) { let name = item.name; let url = item.url; mouth.push ([name, url]); //Two dimensional array, Second dimension holds name on index 0 and url at index 1 } -function fillArrayArms(item){ +function fillArrayArms(item) { let name = item.name; let url = item.url; let color = item.color; arms.push ([name, url, color]); //Two dimensional array, Second dimension holds name on index 0 and url at index 1 } -function fillArraysArms(){ +function fillArraysArms() { for (let i=0; i