-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtoast.html
44 lines (44 loc) · 2.32 KB
/
toast.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
<!DOCTYPE html>
<html>
<head>
<title>test page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<style>
body {
max-width: 1000px;
margin: 20px auto;
padding: 0 20px;
font-family: sans-serif;
}
input, button, select, textarea {
font: inherit;
}
p {
white-space: pre-wrap;
}
span.red {
color: red;
}
</style>
</head>
<body>
<h1>Toast Countries Natural Disasters Generator</h1>
<p id="bleh"></p>
<script>
var p=document.querySelector("#bleh"),
countries="China; Belgium; New Mexico, Spur Republic; Arizona, Spur Republic; Texas, Spur Republic; Colorado, Spur Republic; California, Spur Republic; Utah, Spur Republic; Nevada, Spur Republic; Los Taipeis, Mexico; Taiwan City-state, Mexico; Uno, Mexico; Dos, Mexico; Tres, Mexico; Cuatro, Mexico; Seis, Mexico; Siete, Mexico; Maine, New England; Massachusetts, New England; Vermont, New England; New York, New England; New Hampsire, New England; New Jersey, New England; Rhode Island, New England; Pennsylvania, New England; District of Colombia, New England; Delaware, New England; Maryland, New England; Connecticut, New England; Russia, North Korea; Korea, North Korea; North Korea, North Korea; Seanabad, India; Alexadesh, India; Stevenahji, India; Henrighaht, India; Miclipsamad, India; Madagascar; Steveñcia, Brazil; Hénri Elpansa, Brazil; Enseañe, Brazil; Alekiaquí, Brazil; Antarctica".split('; '),
typhoons="China; Los Taipeis, Mexico; Taiwan City-state, Mexico; Russia, North Korea; Korea, North Korea; North Korea, North Korea".split('; '),
disasters="earthquake, blizzard, flood, heat wave, sandstorm, drought, tornado, wildfire, tsunami, hail storm, plague, thunderstorm".split(', '),
s='';
for (var c of countries) {
if (Math.floor(Math.random()*10)===0) {
if (Math.floor(Math.random()*disasters.length)===0) {
s+=`<strong>${c}</strong> is being hit by a <span class="red">${~typhoons.indexOf(c)?'typhoon':'hurricane'}</span>.<br>`;
} else s+=`<strong>${c}</strong> is being hit by a <span class="red">${disasters[Math.floor(Math.random()*disasters.length)]}</span>.\n`;
} else s+=`There are no natural disasters in <strong>${c}</strong> today. Yay!<br>`;
}
p.innerHTML=s;
</script>
</body>
</html>