Compare commits
No commits in common. "ea464e791a0ab821c6f92a2eb876d4154177aaac" and "2b72155ee2cccd70e97345a048842bd4d05feb67" have entirely different histories.
ea464e791a
...
2b72155ee2
3 changed files with 5 additions and 52 deletions
10
index.html
10
index.html
|
@ -9,15 +9,5 @@
|
||||||
<p>Click</p>
|
<p>Click</p>
|
||||||
<script src="./js/intro.js" deref></script>
|
<script src="./js/intro.js" deref></script>
|
||||||
<script src="./js/element.js"></script>
|
<script src="./js/element.js"></script>
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<th>nom</th>
|
|
||||||
<th>boost</th>
|
|
||||||
</thead>
|
|
||||||
<tbody id="table_technologies_body">
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,34 +1,15 @@
|
||||||
class Element{
|
class element{
|
||||||
constructor(techno,tag) {
|
constructor(techno,tag) {
|
||||||
this.tag = tag
|
this.tag = tag
|
||||||
this.techno = techno
|
this.techno = techno
|
||||||
}
|
}
|
||||||
|
|
||||||
charger_depuis_bdd(){
|
charger_depuis_bdd(){
|
||||||
fetch("../bdd/arbre.json").then((data)=>{
|
fetch("../bdd/arbre.json").then((data,r)=>{
|
||||||
data.json().then((data)=>{
|
let props = data["technologies"][this.techno][this.tag]
|
||||||
this.props = data["technologies"][this.techno]["elements"][this.tag]
|
this.cout = props.cout
|
||||||
this.cout = this.props.cout
|
this.boost = props.boost
|
||||||
this.nom = this.props.nom
|
|
||||||
this.boost = this.props.boost
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
afficher_props_dans_html(){
|
|
||||||
const table= document.getElementById("table_technologies_body")
|
|
||||||
|
|
||||||
const tr = document.createElement("tr")
|
|
||||||
const nom = document.createElement("td")
|
|
||||||
nom.innerText = this.nom
|
|
||||||
const boost = document.createElement("td")
|
|
||||||
boost.innerText = this.boost
|
|
||||||
|
|
||||||
tr.appendChild(nom)
|
|
||||||
tr.appendChild(boost)
|
|
||||||
table.appendChild(tr)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,18 +0,0 @@
|
||||||
class Technologie{
|
|
||||||
constructor(nom) {
|
|
||||||
this.nom = nom
|
|
||||||
}
|
|
||||||
|
|
||||||
charger_depuis_bdd(){
|
|
||||||
fetch("../bdd/arbre.json").then((data)=>{
|
|
||||||
data.json().then((data)=>{
|
|
||||||
console.log(data)
|
|
||||||
this.props = data[this.nom]
|
|
||||||
this.cout = this.props.cout
|
|
||||||
this.boost = this.props.boost
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in a new issue