「✨」 feat: Added static website
This commit is contained in:
15
srcs/docker/bonus/static-site/kanelovh/index.html
Normal file
15
srcs/docker/bonus/static-site/kanelovh/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Kanel Supremacy</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="image-container">
|
||||
<img id="kanel" src="#">
|
||||
</div>
|
||||
<script type="text/javascript" src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
24
srcs/docker/bonus/static-site/kanelovh/script.js
Normal file
24
srcs/docker/bonus/static-site/kanelovh/script.js
Normal file
@ -0,0 +1,24 @@
|
||||
function init()
|
||||
{
|
||||
var img = document.querySelector("#kanel");
|
||||
const random = Math.floor(Math.random() * 70) + 1;
|
||||
img.src = 'https://kanel.ovh/img/'+random+'.jpg';
|
||||
const { naturalWidth, naturalHeight } = img;
|
||||
const isLandscape = naturalWidth / naturalHeight > 1;
|
||||
|
||||
if (isLandscape) {
|
||||
img.style.width = window.innerWidth+'px';
|
||||
img.style.height = 'auto';
|
||||
} else {
|
||||
img.style.height = window.innerHeight+'px';
|
||||
img.style.width = 'auto';
|
||||
}
|
||||
|
||||
if (img.src == 'https://kanel.ovh/img/70.jpg')
|
||||
{
|
||||
img.style.height = 'auto';
|
||||
img.style.width = '100%';
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
28
srcs/docker/bonus/static-site/kanelovh/style.css
Normal file
28
srcs/docker/bonus/static-site/kanelovh/style.css
Normal file
@ -0,0 +1,28 @@
|
||||
body, html
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #f0f0f0;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.image-container
|
||||
{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.img
|
||||
{
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
Reference in New Issue
Block a user