Add Pokémon types

This commit is contained in:
Théo Marchal 2022-03-02 14:20:50 +01:00
parent 0e356f0caf
commit 19aa6b70b3
3 changed files with 1100 additions and 1062 deletions

View File

@ -80,9 +80,9 @@ $(document).ready(function() {
return '<span class="form LA"></span>'
else if (pkmn["origin"] == "9G")
return '<span class="form SV"></span>'
else if (pkmn["type"] == "mega")
else if (pkmn["form"] == "mega")
return '<span class="form mega"></span>';
else if (pkmn["type"] == "giga")
else if (pkmn["form"] == "giga")
return '<span class="form giga"></span>';
return '';
}
@ -93,9 +93,19 @@ $(document).ready(function() {
return num;
}
function getFormattedTypes(num) {
str = '<span class="types"><span class="'+num["type"][0]+'">'+num["type"][0]+'</span>';
if (num["type"][1])
str += '<span class="'+num["type"][1]+'">'+num["type"][1]+'</span>';
str += '</span>';
return str;
}
for (i in pokemon_generation_list) {
$('article #container #game #flashdex').append(
'<div class="pokedex id_'+pklist.mn[pokemon_generation_list[i]]["num"]+'">'
+ getFormattedTypes(pklist.mn[pokemon_generation_list[i]])
+ getFormText(pklist.mn[pokemon_generation_list[i]]) // either gigantamax or mega-evolution
+ '<img src="pokemon/'+ imageType((pklist.mn[pokemon_generation_list[i]]["num"])) +'.png"/>'
+ '<span class="name">' + '<strong>' + '#' + getFormattedNumber(pklist.mn[[pokemon_generation_list[i]]]["num"]) + '</strong> '

File diff suppressed because it is too large Load Diff

View File

@ -353,7 +353,7 @@ article #container.diploma #score {
}
#container #game #flashdex .pokedex {
width: 250px; height: 285px;
width: 250px;
border: 1px solid white;
padding: 10px;
margin: 10px;
@ -368,16 +368,10 @@ article #container.diploma #score {
height: 250px;
display: block;
margin: auto;
margin: 12px 0px;
}
#game #flashdex .pokedex span.name {
text-align: center;
font-size: 1em;
display: block;
margin: auto; margin-top: 15px;
}
span.form {
#game #flashdex .pokedex span.form {
display: block;
float: right;
width: 25px; height: 25px;
@ -386,14 +380,52 @@ span.form {
right: 10px;
}
span.form.mega { background-image: url('img/icon_mega.png'); }
span.form.giga {
#game #flashdex .pokedex span.form.mega { background-image: url('img/icon_mega.png'); }
#game #flashdex .pokedex span.form.giga {
background-image: url('img/icon_giga.png'); background-color: white;
background-position: center; background-size:20px;
border-radius: 50%; border: 1px solid white;
}
#game #flashdex .pokedex span.types {
display: flex;
float: left;
margin-bottom: 12px;
}
#game #flashdex .pokedex span.types:after {
clear: both;
}
#game #flashdex .pokedex span.types span {
margin: 0px;
margin-right: 5px;
padding: 5px;
border-radius: 2px;
font-family: Sans-Serif;
font-weight: bold;
color: #fff;
font-size: 0.8rem;
}
#game #flashdex .pokedex span.types .Grass { background: #78C850; }
#game #flashdex .pokedex span.types .Poison { background: #A040A0; }
#game #flashdex .pokedex span.types .Fire { background: #F08030; }
#game #flashdex .pokedex span.types .Dragon { background: #7038F8; }
#game #flashdex .pokedex span.types .Flying { background: #A890F0; }
#game #flashdex .pokedex span.types .Water { background: #6890F0; }
#game #flashdex .pokedex span.types .Bug { background: #A8B820; }
#game #flashdex .pokedex span.types .Normal { background: #A8A878; }
#game #flashdex .pokedex span.types .Dark { background: #705848; }
#game #flashdex .pokedex span.types .Electric { background: #F8D030; }
#game #flashdex .pokedex span.types .Ground { background: #E0C068; }
#game #flashdex .pokedex span.types .Psychic { background: #F85888; }
#game #flashdex .pokedex span.types .Ice { background: #98D8D8; }
#game #flashdex .pokedex span.types .Steel { background: #B8B8D0; }
#game #flashdex .pokedex span.types .Fairy { background: #EE99AC; }
#game #flashdex .pokedex span.types .Fighting { background: #C03028; }
#game #flashdex .pokedex span.types .Rock { background: #B8A038; }
#game #flashdex .pokedex span.types .Ghost { background: #705898; }
/*** MOBILE ***/
@ -527,8 +559,7 @@ span.form.giga {
/* flashdex */
#container #game #flashdex .pokedex { width: 230px; height: 260px; }
#game #flashdex .pokedex img { height: 225px; }
#container #game #flashdex .pokedex { width: 230px; }
#game #flashdex_config p { text-align: left; }