diff --git a/frontend/img/bug.jpg b/frontend/img/types/bug.jpg similarity index 100% rename from frontend/img/bug.jpg rename to frontend/img/types/bug.jpg diff --git a/frontend/img/dark.jpg b/frontend/img/types/dark.jpg similarity index 100% rename from frontend/img/dark.jpg rename to frontend/img/types/dark.jpg diff --git a/frontend/img/dragon.jpg b/frontend/img/types/dragon.jpg similarity index 100% rename from frontend/img/dragon.jpg rename to frontend/img/types/dragon.jpg diff --git a/frontend/img/electric.jpg b/frontend/img/types/electric.jpg similarity index 100% rename from frontend/img/electric.jpg rename to frontend/img/types/electric.jpg diff --git a/frontend/img/fairy.jpg b/frontend/img/types/fairy.jpg similarity index 100% rename from frontend/img/fairy.jpg rename to frontend/img/types/fairy.jpg diff --git a/frontend/img/fighting.jpg b/frontend/img/types/fighting.jpg similarity index 100% rename from frontend/img/fighting.jpg rename to frontend/img/types/fighting.jpg diff --git a/frontend/img/fire.jpg b/frontend/img/types/fire.jpg similarity index 100% rename from frontend/img/fire.jpg rename to frontend/img/types/fire.jpg diff --git a/frontend/img/flying.jpg b/frontend/img/types/flying.jpg similarity index 100% rename from frontend/img/flying.jpg rename to frontend/img/types/flying.jpg diff --git a/frontend/img/ghost.jpg b/frontend/img/types/ghost.jpg similarity index 100% rename from frontend/img/ghost.jpg rename to frontend/img/types/ghost.jpg diff --git a/frontend/img/grass.jpg b/frontend/img/types/grass.jpg similarity index 100% rename from frontend/img/grass.jpg rename to frontend/img/types/grass.jpg diff --git a/frontend/img/ground.jpg b/frontend/img/types/ground.jpg similarity index 100% rename from frontend/img/ground.jpg rename to frontend/img/types/ground.jpg diff --git a/frontend/img/ice.jpg b/frontend/img/types/ice.jpg similarity index 100% rename from frontend/img/ice.jpg rename to frontend/img/types/ice.jpg diff --git a/frontend/img/normal.jpg b/frontend/img/types/normal.jpg similarity index 100% rename from frontend/img/normal.jpg rename to frontend/img/types/normal.jpg diff --git a/frontend/img/physical.png b/frontend/img/types/physical.png similarity index 100% rename from frontend/img/physical.png rename to frontend/img/types/physical.png diff --git a/frontend/img/poison.jpg b/frontend/img/types/poison.jpg similarity index 100% rename from frontend/img/poison.jpg rename to frontend/img/types/poison.jpg diff --git a/frontend/img/psychic.jpg b/frontend/img/types/psychic.jpg similarity index 100% rename from frontend/img/psychic.jpg rename to frontend/img/types/psychic.jpg diff --git a/frontend/img/rock.jpg b/frontend/img/types/rock.jpg similarity index 100% rename from frontend/img/rock.jpg rename to frontend/img/types/rock.jpg diff --git a/frontend/img/special.png b/frontend/img/types/special.png similarity index 100% rename from frontend/img/special.png rename to frontend/img/types/special.png diff --git a/frontend/img/status.png b/frontend/img/types/status.png similarity index 100% rename from frontend/img/status.png rename to frontend/img/types/status.png diff --git a/frontend/img/steel.jpg b/frontend/img/types/steel.jpg similarity index 100% rename from frontend/img/steel.jpg rename to frontend/img/types/steel.jpg diff --git a/frontend/img/water.jpg b/frontend/img/types/water.jpg similarity index 100% rename from frontend/img/water.jpg rename to frontend/img/types/water.jpg diff --git a/frontend/js/index.js b/frontend/js/index.js index f7dae08206d8a0552618c9f77e8395547708e91a..f84835b5adb4a327623554f3c68f129de6d52125 100644 --- a/frontend/js/index.js +++ b/frontend/js/index.js @@ -124,13 +124,13 @@ stats.then(stat => { if(stat.types.length > 1){ - types[2*i].src = "img/" + stat.types[0].type.name + ".jpg"; - types[(2*i)+1].src = "img/" + stat.types[1].type.name + ".jpg"; + types[2*i].src = "img/types/" + stat.types[0].type.name + ".jpg"; + types[(2*i)+1].src = "img/types/" + stat.types[1].type.name + ".jpg"; } else{ - types[2*i].src = "img/" + stat.types[0].type.name + ".jpg"; + types[2*i].src = "img/types/" + stat.types[0].type.name + ".jpg"; types[(2*i)+1].style.display = "none"; } }) diff --git a/frontend/js/product.js b/frontend/js/product.js index cf279feb7fe41af24921f01a4dadf323f1453ee4..3cffb9f0a57ec5f1d45d0c7b756b8d5349712f1a 100644 --- a/frontend/js/product.js +++ b/frontend/js/product.js @@ -35,6 +35,28 @@ } + + function choiceAbility(ability,choice,abilities){ + ability.ondblclick = function(){ + + if(choice.childNodes.length < 4){ + + selectedAbility(ability,choice,abilities); + choice.appendChild(ability); + } + } + } + + + function selectedAbility(ability,choice,abilities){ + ability.ondblclick = function(){ + + choiceAbility(ability,choice,abilities); + abilities.appendChild(ability); + + } + } + function getMoves(stat,description,abilities,selection,choice){ @@ -53,8 +75,8 @@ dmgclass.className = "dmgclass"; get(data.moves[i].move.url).then(move => { - type.src = "img/" + move.type.name +".jpg"; - dmgclass.src = "img/" + move.damage_class.name + ".png"; + type.src = "img/types/" + move.type.name +".jpg"; + dmgclass.src = "img/types/" + move.damage_class.name + ".png"; ability.onclick = function(){ @@ -72,17 +94,7 @@ ability.appendChild(txt); - ability.ondblclick = function(){ - - if(choice.childNodes.length < 4){ - - ability.ondblclick = function(){ - abilities.appendChild(ability); - - } - choice.appendChild(ability); - } - } + choiceAbility(ability,choice,abilities); abilities.appendChild(ability); } });