ozai-webui/templates/join.html

88 lines
2.4 KiB
HTML
Raw Normal View History

2024-02-14 21:52:29 +01:00
<!-- HTML -->
<!DOCTYPE html>
<html>
<head>
<title>Ozai:Join</title>
<link rel="icon" type="image/png" href="/azul-flake.png">
2024-02-15 12:58:18 +01:00
<style>
body {
display: flex;
2024-03-21 23:32:44 +01:00
flex-direction: column;
justify-content: center;
align-items: center;
2024-03-21 23:32:44 +01:00
background-color: black;
color: white;
color-scheme: dark;
}
form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 5vh;
width: 80%;
max-width: 500px;
}
button, input[type="submit"] {
background-color: #0000FF;
cursor: pointer;
box-shadow: 0px 0.1em 0.5em rgba(255, 255, 255, 0.333);
margin-top: 2em;
}
button, input[type="submit"], input[type="text"] {
margin-top: 5vh;
padding: 1em;
margin-top: 1em;
color: #fff;
border: none;
border-radius: 1em;
width: 100%;
}
@media (max-width: 768px) {
input[type="text"], input[type="submit"], button {
font-size: 1.5em;
}
}
2024-02-15 12:58:18 +01:00
</style>
2024-02-14 21:52:29 +01:00
</head>
<body>
2024-03-21 23:32:44 +01:00
<img src="azul-flake.png" alt="">
2024-02-14 21:52:29 +01:00
<!-- a field to add a game id -->
<form id="joinGameForm" method="POST" action="/join" onsubmit="submitForm(event)">
<input type="text" name="game_id" placeholder="Game ID" required value="{{ game_id }}">
<input type="submit" value="Join Game">
2024-03-21 23:32:44 +01:00
<button onclick="window.history.back();">Back</button>
2024-02-14 21:52:29 +01:00
</form>
2024-03-21 23:32:44 +01:00
</body>
2024-02-14 21:52:29 +01:00
<script>
function submitForm(e) {
e.preventDefault();
var game_id = document.querySelector('input[name="game_id"]').value;
sessionStorage.setItem('game_id', game_id);
document.getElementById('joinGameForm').submit();
}
var game_id = sessionStorage.getItem('game_id');
if (game_id) {
document.querySelector('input[name="game_id"]').value = game_id;
}
</script>
2024-02-15 12:58:18 +01:00
2024-02-14 21:52:29 +01:00
{% if game_id %}
<script>
var game_id = '{{ game_id }}';
sessionStorage.setItem('game_id', game_id);
//redirect to join game
window.location.href = '/join_game/' + game_id;
</script>
{% endif %}
</html>