Files
TinderPokemon/index.html
T
2022-09-13 11:03:10 +02:00

100 lines
4.3 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">
<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">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
let pokeApiResponse;
fetch("https://pokeapi.co/api/v2/pokemon/"+Math.floor(Math.random() * 905))
.then((response) => {
pokeApiResponse = response.json()
.then((data)=>{
//console.log(data);
document.getElementById("pokemonName").innerHTML = data.name;
document.getElementById("pokemonImage").src = data.sprites.front_shiny;
})
.catch(data => {
alert("Bouhouuuu I cant convert a response to text");
});
})
.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>