charades/index.html

52 lines
1.2 KiB
HTML

<html>
<header>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
<style>
body {
max-width: 1024px;
margin: auto;
font-size: 24pt;
padding: 50px;
}
input {
font-size: 24;
}
</style>
<script>
var words = {{ .Words }}
console.log(words.length)
function newWords() {
var idxes = new Set()
while(idxes.size < 5) {
var idx = Math.floor(Math.random() * words.length)
idxes.add(idx)
}
var somewords = []
for(idx of idxes) {
somewords.push(words[idx])
}
somewords.sort()
var html = ""
for(word of somewords) {
html += "<li>"
html += word
html += "</li>"
}
var ele = document.getElementById("words")
ele.innerHTML = html
}
</script>
</header>
<body onload="newWords(); return false">
Words:
<ul id="words">
</ul>
<input type="button" onclick="newWords(); return false;" value="New Words"></input>
</body>
<footer>
</footer>
</html>