ptits trucs

This commit is contained in:
Theo Mougnibas 2024-11-29 08:26:28 +01:00
parent 49d8e620d2
commit 3137927e37
5 changed files with 39 additions and 6 deletions

View file

@ -38,6 +38,7 @@ img {
table {
width: 100%;
border-collapse: collapse;
border: 1px solid #ddd;
}

View file

@ -10,9 +10,8 @@
<body>
<script src="./js/intro.js" deref></script>
<script src="./js/element.js"></script>
<div id="divButtonScore">
<script src="./js/technologie.js"></script>
<div id="divButton_score">
</div>
<table>

View file

@ -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")

View file

@ -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)
});
})
})
}

View file

@ -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)
}