You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
3.3 KiB
HTML

6 months ago
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
html,
body {
margin: 0 0;
font-family: sans-serif;
padding: 0 0;
width: 100%;
height: 100%;
}
* {
box-sizing: border-box;
}
body {
padding: 2rem;
}
h1,
h2,
h3 {
margin: 0 0;
}
main {
max-width: min(900px, calc(100vw - 4rem));
margin: 2rem auto;
}
button,
input[type="submit"] {
margin: 1rem auto;
background-color: black;
outline: none;
color: white;
padding: .5rem 1rem;
border-radius: 2px;
border: none;
z-index: 2;
cursor: pointer;
transition: .2s linear;
border: 2px solid black;
width: 100%;
font-weight: bolder;
}
button:hover,
input[type="submit"]:hover {
background-color: white;
border: 2px solid black;
color: black;
}
form {
display: flex;
flex-direction: column;
border: 2px dashed black;
margin: 2rem auto;
padding: 2rem;
gap: 1rem;
position: relative;
}
form[loading="true"] * {
opacity: 0;
}
@keyframes spinning {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
form[loading="true"]:before {
content: "";
position: absolute;
width: 2rem;
height: 2rem;
border-top: 2px solid black;
border-left: 2px solid black;
border-radius: 100%;
z-index: 2;
top: calc(50% - 1rem);
left: calc(50% - 1rem);
transform: translate3d(-50%, -50%, 0);
animation: .5s linear infinite spinning;
}
.error {
color: red;
}
</style>
</head>
<body>
<main class="container">
<h1>Official ministry of infra-ordinary</h1>
<h2>Ordinary sightings form</h2>
<p>Have you seen anything infra-ordinary? Upload your media here!</p>
{% if error %}
<h1 class="error">Oops.. Something went wrong: {{ error }}!</h1>
{% endif %}
{% if submitted %}
<p>Thank you for your contribution!</p>
<a href="/">back</a>
{% else %}
<form method="POST" action="upload" enctype="multipart/form-data">
<input type="file" name="file" accept="image/*,video/*,audio/*" required>
<input type="submit">
</form>
{% endif %}
</main>
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", function () {
var form = document.querySelector("form");
if (!form) return false
form.addEventListener("submit", function () {
console.log("submit")
form.setAttribute("loading", "true");
})
})
</script>
</body>
</html>