ozai-webui/templates/join.html

62 lines
2.0 KiB
HTML

<!-- HTML -->
<!DOCTYPE html>
<html>
<head>
<title>Ozai:Join</title>
<link rel="icon" type="image/png" href="/azul-flake.png">
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
padding: 10px;
background: url({{ url_for('static', filename='azul.webp') }}) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
</head>
<body>
<!-- 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">
</form>
<button onclick="window.history.back();">Back</button>
<!-- script to get from localstorage and prefill join game -->
<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>
{% 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>
<noscript>
<p>manual redirect</p>
<a href="/join_game/+{{ game_id }}">Go to player selection</a>
</noscript>
{% endif %}
<noscript>
<p>JavaScript is not enabled. Some convenience migth not work.</p>
</noscript>
</body>
</html>