forked from Maxluli/TinderPokemon
added final touches (for now) to the main page
This commit is contained in:
73
index.html
73
index.html
@@ -23,15 +23,30 @@
|
|||||||
|
|
||||||
<body id="main">
|
<body id="main">
|
||||||
<div class="d-grid gap-2 text-center">
|
<div class="d-grid gap-2 text-center">
|
||||||
<div class=""><h1>Tinder for weird furries</h1></div>
|
<div class="">
|
||||||
<div class=""><h2>Home</h2></div>
|
<h1>Tinder for weird furries</h1>
|
||||||
|
</div>
|
||||||
|
<div class="">
|
||||||
|
<h2>Home</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<div class="card p-2 text-center">
|
||||||
|
<div class="card-body">
|
||||||
|
Ceci est une publicité</br>
|
||||||
|
<!-- Elle devrait me rapporter enormément d'argent</br>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="card p-2">
|
<div class="card p-2">
|
||||||
<img id="pokemonImage" style="image-rendering: pixelated;" src="https://www.pokewiki.de/images/thumb/d/dd/Sugimori_132.png/250px-Sugimori_132.png" class="card-img-top" style="" alt="...">
|
<img id="pokemonImage" style="image-rendering: pixelated;"
|
||||||
|
src="https://www.pokewiki.de/images/thumb/d/dd/Sugimori_132.png/250px-Sugimori_132.png"
|
||||||
|
class="card-img-top" style="" alt="...">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="card-title" id="pokemonName">Ditto</h4><h4 class="card-title" id="pokemonAge">21</h4>
|
<h4 class="card-title" id="pokemonName">Ditto</h4>
|
||||||
<p class="card-text">I like Ice Cream</p>
|
<h4 class="card-title" id="pokemonAge">21</h4>
|
||||||
|
<p class="card-text" id="pokemonDescription">I like Ice Cream</p>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="btn col-4" id="nopeButton">
|
<div class="btn col-4" id="nopeButton">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
@@ -54,13 +69,19 @@
|
|||||||
|
|
||||||
<div class="row fixed-bottom">
|
<div class="row fixed-bottom">
|
||||||
<div class="btn col-4 btn-light">
|
<div class="btn col-4 btn-light">
|
||||||
<a href="likes.html" style="text-decoration:none;color:black"><h3>Liked</h3></a>
|
<a href="likes.html" style="text-decoration:none;color:black">
|
||||||
|
<h3>Liked</h3>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn col-4 btn-light">
|
<div class="btn col-4 btn-light">
|
||||||
<a href="index.html" style="text-decoration:none;color:black"><h3>Home</h3></a>
|
<a href="index.html" style="text-decoration:none;color:black">
|
||||||
|
<h3>Home</h3>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn col-4 btn-light">
|
<div class="btn col-4 btn-light">
|
||||||
<a href="favorites.html" style="text-decoration:none;color:black"><h3>Favorites</h3></a>
|
<a href="favorites.html" style="text-decoration:none;color:black">
|
||||||
|
<h3>Favorites</h3>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -70,17 +91,38 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
document.getElementById('main').onload = function () {
|
document.getElementById('main').onload = function () {
|
||||||
//We will need to load an image from the pokeAPI with his description and a random name/age
|
//We will need to load an image from the pokeAPI with his description and a random name/age
|
||||||
let pokeApiResponse;
|
|
||||||
fetch("https://pokeapi.co/api/v2/pokemon/" + Math.floor(Math.random() * 905))
|
fetch("https://pokeapi.co/api/v2/pokemon/" + Math.floor(Math.random() * 905))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
pokeApiResponse = response.json()
|
response.json()
|
||||||
.then((data)=>{
|
.then((pokemonData) => {
|
||||||
//console.log(data);
|
fetch("https://tomatebanane.ch/api/pokename/random")
|
||||||
document.getElementById("pokemonName").innerHTML = data.name;
|
.then((response) => {
|
||||||
document.getElementById("pokemonImage").src = data.sprites.front_shiny;
|
response.json()
|
||||||
|
.then((randomName) => {
|
||||||
|
fetch("https://pokeapi.co/api/v2/pokemon-species/" + pokemonData.id)
|
||||||
|
.then((response) => {
|
||||||
|
response.json()
|
||||||
|
.then((pokemonInfo) => {
|
||||||
|
console.log(pokemonData.id);
|
||||||
|
document.getElementById("pokemonName").innerHTML = randomName[0].name;
|
||||||
|
document.getElementById("pokemonImage").src = pokemonData.sprites.front_shiny;
|
||||||
|
document.getElementById("pokemonAge").innerHTML = Math.floor(Math.random() * (65 - 18)) + 18;
|
||||||
|
console.log(pokemonInfo.flavor_text_entries[0]);
|
||||||
|
document.getElementById("pokemonDescription").innerHTML = pokemonInfo.flavor_text_entries[0].flavor_text;
|
||||||
|
})
|
||||||
|
}).catch((response) => {
|
||||||
|
alert("Bouhouuuuu could not get any further infos on that dumbass");
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch((response => {
|
||||||
|
alert("Bouhouuu i cant convert a response into json");
|
||||||
|
}))
|
||||||
|
}).catch((response) => {
|
||||||
|
alert("Could not get the magnificien datas from Zanardi's API");
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.catch(data => {
|
.catch(data => {
|
||||||
alert("Bouhouuuu I cant convert a response to text");
|
alert("Bouhouuuu I cant convert a response to json");
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(response => {
|
.catch(response => {
|
||||||
@@ -97,4 +139,5 @@
|
|||||||
alert("You want to fav");
|
alert("You want to fav");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user