ok-ready-go/web/index.html

79 lines
3.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script src="https://unpkg.com/mqtt/dist/mqtt.min.js"></script>
<script src="lib/crypto_helper.js"></script>
<script src="js/index.js"></script>
<script src="js/localState.js"></script>
<script src="js/mqtt.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css" />
<link rel="stylesheet" href="index.css" />
<audio id="sound-0" src="sound/0.mp3" preload="auto"></audio>
<audio id="sound-1" src="sound/1.mp3" preload="auto"></audio>
<audio id="sound-2" src="sound/2.mp3" preload="auto"></audio>
<audio id="sound-3" src="sound/3.mp3" preload="auto"></audio>
<audio id="sound-4" src="sound/4.mp3" preload="auto"></audio>
<audio id="sound-5" src="sound/5.mp3" preload="auto"></audio>
<audio id="sound-6" src="sound/6.mp3" preload="auto"></audio>
<audio id="sound-7" src="sound/7.mp3" preload="auto"></audio>
<audio id="sound-8" src="sound/8.mp3" preload="auto"></audio>
<audio id="sound-9" src="sound/9.mp3" preload="auto"></audio>
<audio id="sound-ok-ready-go" src="sound/ok-ready-go.mp3" preload="auto"></audio>
<audio id="sound-silence" src="sound/silence.mp3" preload="auto"></audio>
</head>
<body>
<script>
const event = new Event('wasm-loaded');
wasm_bindgen('lib/crypto_helper_bg.wasm').then(() => {
document.dispatchEvent(event);
});
</script>
<main class="container" x-data>
<div class="timer-container-div" x-show="$store.localState._state !== 5">
<div @click="$store.localState.next()" class="tap-area" x-show="$store.localState._state === 2"></div>
<div @click="$store.localState.next()" class="timer-div">
<hgroup>
<h1>OK! .. READY! ... GO!</h1>
<h2 x-text="$store.localState.stateHint"></h2>
</hgroup>
<div x-data="Timer">
<p :class="'timer' + (over ? ($store.localState._state === 3 ? ' sending':' over'):'')" x-text="time + 's'"></p>
</div>
</div>
</div>
<div x-show="$store.localState._state === 0">
<details>
<summary>Remote connection</summary>
<div x-show="!$store.mqtt.connected">
<p>To send the times to a computer, please enter a password here:</p>
<form x-data="PasswordForm()" @submit.prevent="submitForm">
<label for="passwordForm_password">Password:</label>
<input id="passwordForm_password" type="text" x-model="formData.password" placeholder="Password" />
<small>Make sure, this is exactly the same on your computer!</small>
<button type="submit">Connect</button>
</form>
</div>
<div x-show="$store.mqtt.connected">
<p>Connected</p>
<button @click="$store.localState.password = ''">Disconnect</button>
</div>
</details>
</div>
<div class="timer-container-div" x-show="$store.localState._state === 5">
<h1 class="loading" aria-busy="true">Connecting...</h1>
</div>
</main>
</body>