143 lines
6.6 KiB
HTML
143 lines
6.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta charset="utf-8">
|
|
|
|
<!-- Bootstrap -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet"
|
|
integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
|
|
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.5/dist/umd/popper.min.js"
|
|
integrity="sha384-Xe+8cL9oJa6tN/veChSP7q+mnSPaj5Bcu9mPX5F5xIGE0DVittaqT5lorf0EI7Vk"
|
|
crossorigin="anonymous"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.min.js"
|
|
integrity="sha384-ODmDIVzN+pFdexxHEHFBQH3/9/vQ9uori45z4JjnFsRydbmQbmL5t1tQ0culUzyK"
|
|
crossorigin="anonymous"></script>
|
|
|
|
<title>Tinder Pokemon</title>
|
|
<link rel="icon" type="image/x-icon" href="assets/img/Icon.ico">
|
|
</head>
|
|
|
|
<body id="main">
|
|
<div class="d-grid gap-2 text-center">
|
|
<div class="">
|
|
<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 class="container">
|
|
<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="...">
|
|
<div class="card-body">
|
|
<h4 class="card-title" id="pokemonName">Ditto</h4>
|
|
<h4 class="card-title" id="pokemonAge">21</h4>
|
|
<p class="card-text" id="pokemonDescription">I like Ice Cream</p>
|
|
<div class="row">
|
|
<div class="btn col-4" id="nopeButton">
|
|
<div class="text-center">
|
|
<img src="assets/img/cross.png" class="rounded col-6" alt="Home">
|
|
</div>
|
|
</div>
|
|
<div class="btn col-4" id="favoriteButton">
|
|
<div class="text-center">
|
|
<img src="assets/img/star.png" class="rounded col-6" alt="Home">
|
|
</div>
|
|
</div>
|
|
<div class="btn col-4" id="likeButton">
|
|
<div class="text-center">
|
|
<img src="assets/img/105220.png" class="rounded col-6" alt="Home">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row fixed-bottom">
|
|
<div class="btn col-4 btn-light">
|
|
<a href="likes.html" style="text-decoration:none;color:black">
|
|
<h3>Liked</h3>
|
|
</a>
|
|
</div>
|
|
<div class="btn col-4 btn-light">
|
|
<a href="index.html" style="text-decoration:none;color:black">
|
|
<h3>Home</h3>
|
|
</a>
|
|
</div>
|
|
<div class="btn col-4 btn-light">
|
|
<a href="favorites.html" style="text-decoration:none;color:black">
|
|
<h3>Favorites</h3>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<i class="fa-solid fa-house"></i>
|
|
</body>
|
|
<script>
|
|
"use strict";
|
|
document.getElementById('main').onload = function () {
|
|
//We will need to load an image from the pokeAPI with his description and a random name/age
|
|
fetch("https://pokeapi.co/api/v2/pokemon/" + Math.floor(Math.random() * 905))
|
|
.then((response) => {
|
|
response.json()
|
|
.then((pokemonData) => {
|
|
fetch("https://tomatebanane.ch/api/pokename/random")
|
|
.then((response) => {
|
|
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 => {
|
|
alert("Bouhouuuu I cant convert a response to json");
|
|
});
|
|
})
|
|
.catch(response => {
|
|
alert("This could use a error handler but for now lets just say that there was an problem trying to get the infos from pokeAPI");
|
|
})
|
|
}
|
|
document.getElementById('likeButton').onclick = function () {
|
|
alert("You want to like");
|
|
};
|
|
document.getElementById('nopeButton').onclick = function () {
|
|
alert("You want to nope");
|
|
}
|
|
document.getElementById('favoriteButton').onclick = function () {
|
|
alert("You want to fav");
|
|
}
|
|
</script>
|
|
|
|
</html> |