From 64a871f40f5c917670a462b31e260312be16aa99 Mon Sep 17 00:00:00 2001 From: Camilo G Date: Tue, 7 Jun 2022 19:37:57 +0200 Subject: [PATCH] Upgrade --- index.html | 3 ++- main.js | 49 +++++++++++++++++++++++++++++-------------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/index.html b/index.html index 0539d63..5ff1da8 100644 --- a/index.html +++ b/index.html @@ -45,6 +45,7 @@
+
@@ -101,6 +102,6 @@ form[i].innerHTML += "Y"; - + \ No newline at end of file diff --git a/main.js b/main.js index 2f6f939..42b2ab7 100644 --- a/main.js +++ b/main.js @@ -1,29 +1,38 @@ /////// Make the website ////// -function voices(voices) { - return ` - ${voices.map((voice) => `

${voice}

`).join("")} - ` -} +fetch("glossary.json").then(response => response.json()).then(data => glossary = data).then(()=>{ + + function voices(voices) { + return ` + ${voices.map((voice) => `

${voice}

`).join("")} + ` + } + + function links(links) { + return ` + ${links.map((links) => `

⤴︎

`).join("")} + ` + } + + function wordTemplate(word) { + return ` +
+

${word.title}

+ ${voices(word.voices)} + ${links(word.links)} +
+ ` + } + + document.getElementById("words").innerHTML = `${glossary.map(wordTemplate).join("")}` + + console.log(glossary) + +}); ///// END OF FETCH!!!!!! -function links(links) { - return ` - ${links.map((links) => `

⤴︎

`).join("")} - ` -} -function wordTemplate(word) { - return ` -
-

${word.title}

- ${voices(word.voices)} - ${links(word.links)} -
- ` -} -document.getElementById("words").innerHTML = `${glossary.map(wordTemplate).join("")}`