From 3137927e37d8d31edcc545cd8e0913157c858d6a Mon Sep 17 00:00:00 2001 From: mougnibas Date: Fri, 29 Nov 2024 08:26:28 +0100 Subject: [PATCH] ptits trucs --- css/t4.css | 1 + index.html | 3 +-- js/element.js | 4 ++-- js/main.js | 33 +++++++++++++++++++++++++++++++++ js/technologie.js | 4 ++-- 5 files changed, 39 insertions(+), 6 deletions(-) diff --git a/css/t4.css b/css/t4.css index 3308ae0..a013335 100644 --- a/css/t4.css +++ b/css/t4.css @@ -38,6 +38,7 @@ img { table { width: 100%; border-collapse: collapse; + border: 1px solid #ddd; } diff --git a/index.html b/index.html index be04414..360f707 100755 --- a/index.html +++ b/index.html @@ -10,9 +10,8 @@ -
- +
diff --git a/js/element.js b/js/element.js index 55a867d..5da32af 100644 --- a/js/element.js +++ b/js/element.js @@ -4,7 +4,7 @@ class Element{ this.techno = techno } - charger_depuis_bdd(){ + chargerDepuisBdd(){ fetch("../bdd/arbre.json").then((data)=>{ data.json().then((data)=>{ this.props = data["technologies"][this.techno]["elements"][this.tag] @@ -16,7 +16,7 @@ class Element{ }) } - afficher_props_dans_html(){ + afficherDropsDansHtml(){ const table= document.getElementById("table_technologies_body") const tr = document.createElement("tr") diff --git a/js/main.js b/js/main.js index e69de29..d278528 100644 --- a/js/main.js +++ b/js/main.js @@ -0,0 +1,33 @@ +function remplirMagasin(){ + + + const table= document.getElementById("table_magasin_body") + + + fetch("../bdd/arbre.json").then((data)=>{ + data.json().then((data)=>{ + console.log(data) + let tech = data["technologies"] + + Object.keys(tech).forEach(key => { + el = tech[key] + const tr = document.createElement("tr") + const nom = document.createElement("td") + nom.innerText = el.nom + const boost = document.createElement("td") + boost.innerText = el.boost + const cout = document.createElement("td") + cout.innerText = el.cout + + tr.appendChild(nom) + tr.appendChild(boost) + tr.appendChild(cout) + table.appendChild(tr) + }); + }) + + }) + + + +} \ No newline at end of file diff --git a/js/technologie.js b/js/technologie.js index 32e22ad..15040b3 100644 --- a/js/technologie.js +++ b/js/technologie.js @@ -3,7 +3,7 @@ class Technologie{ this.nom = nom } - charger_depuis_bdd(){ + chargerDepuisBdd(){ fetch("../bdd/arbre.json").then((data)=>{ data.json().then((data)=>{ console.log(data) @@ -15,7 +15,7 @@ class Technologie{ }) } - appliquer_amelioration_style(){ + appliquerAmeliorationStyle(){ document.getElementById("link-css").setAttribute("href","css/"+this.props.css_id) }