-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
83 lines (82 loc) · 2.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html lang="en">
<script type="module" src=".meowed_away_bg.js"></script>
<head>
<script src="https://unpkg.com/typewriter-effect@latest/dist/core.js"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>who-says</title>
<style>
body, html {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
font-family: monospace;
}
#loading, #ascii-bubble {
display: none;
text-align: center;
overflow-x: auto; /* Adds a horizontal scrollbar if the ASCII art overflows */
max-width: 100vw;
}
.footer {
position: fixed;
text-align: left;
bottom: 0px;
width: 100%;
padding-left: 10px;
padding-bottom: 4px;
font-family: monospace;
color: black;
}
select {
margin: 10px 0;
padding: 5px;
font-family: monospace;
}
#landing {
text-align: center;
}
</style>
</head>
<body>
<div id="landing">
<h1>Who says? </h1>
<select id="animal-select">
<option value="cat">Cat 🐈</option>
<option value="fish">Fish 🐟</option>
<option value="dog">Dog 🐕</option>
<option value="monkey">Monkey 🐒 </option>
</select><br>
<input type="text" id="message-input" placeholder="What should they say?">
<button id="submit-btn">Submit</button>
</div>
<div id="loading">
<h1>Loading...</h1>
<div id="countdown"></div>
</div>
<div id="ascii-bubble"></div>
<script type="module">
import init, { countdown_then_show_message } from './pkg/meowed_away.js';
async function run() {
await init();
const submitBtn = document.getElementById('submit-btn');
submitBtn.addEventListener('click', () => {
const message = document.getElementById('message-input').value;
const animalType = document.getElementById('animal-select').value;
document.getElementById('landing').style.display = 'none';
document.getElementById('loading').style.display = 'block';
countdown_then_show_message(message, animalType);
});
}
run();
</script>
<div class="footer">
<a href="https://github.com/coplat/catsay-wasm/blob/master/README.md" target="_blank">info</a>
</div>
</body>
</html>