Browse Source

Trying to make it flex

main
Julio Biason 2 years ago
parent
commit
41f6bb0a8d
  1. 49
      index.html

49
index.html

@ -1,12 +1,31 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset=utf-8> <meta charset=utf-8>
<title>HUE HUE Name Generator</title> <title>HUE HUE Name Generator</title>
<style type="text/css">
#content {
display: flex;
justify-content: space-around;
flex-direction: row;
}
#content>.block {
flex: auto;
}
</style>
</head> </head>
<body> <body>
<div>
<button id="generator">
Mais!
</button>
</div>
<div id="content"></div> <div id="content"></div>
</body> </body>
</html> </html>
<script> <script>
@ -17,6 +36,7 @@
["Androide", 0], ["Androide", 0],
["Andróide", 1], ["Andróide", 1],
["Apóstolo", 0], ["Apóstolo", 0],
["Baseado", 0],
["Betoneira", 1], ["Betoneira", 1],
["Bruxa", 1], ["Bruxa", 1],
["Bruxo", 0], ["Bruxo", 0],
@ -44,6 +64,8 @@
["Socialite", 1], ["Socialite", 1],
["Síndica", 1], ["Síndica", 1],
["Síndico", 0], ["Síndico", 0],
["Soldado", 0],
["Soldada", 1],
["Viking", 0], ["Viking", 0],
["Viking", 1], ["Viking", 1],
]; ];
@ -75,6 +97,11 @@
["Da Rua", "Da Rua"], ["Da Rua", "Da Rua"],
["Da Semana", "Da Semana"], ["Da Semana", "Da Semana"],
["Da Terra", "Da Terra"], ["Da Terra", "Da Terra"],
["Da Zona Leste", "Da Zone Leste"],
["Da Zona Oeste", "Da Zona Oeste"],
["Da Zona Sul", "Da Zona Sul"],
["Da Zona", "Da Zona"],
["Da Zone Norte", "Da Zona Norte"],
["Das Estrelas", "Das Estrelas"], ["Das Estrelas", "Das Estrelas"],
["De Carne", "De Carne"], ["De Carne", "De Carne"],
["De Dados", "De Dados"], ["De Dados", "De Dados"],
@ -90,6 +117,7 @@
["Do Pão", "Do Pão"], ["Do Pão", "Do Pão"],
["Do Rio", "Do Rio"], ["Do Rio", "Do Rio"],
["Do Sul", "Do Sul"], ["Do Sul", "Do Sul"],
["Dos Dados", "Dos Dados"],
["Fluminense", "Fluminense"], ["Fluminense", "Fluminense"],
["Furacão", "Furacão"], ["Furacão", "Furacão"],
["Gaúcho", "Gaúcha"], ["Gaúcho", "Gaúcha"],
@ -97,7 +125,7 @@
["Júnior", "Júnior"], ["Júnior", "Júnior"],
["Maranhense", "Maranhese"], ["Maranhense", "Maranhese"],
["Mineiro", "Mineira"], ["Mineiro", "Mineira"],
["Nordestino", "Nordestino"], ["Nordestino", "Nordestina"],
["Novato", "Novata"], ["Novato", "Novata"],
["Paraense", "Paraense"], ["Paraense", "Paraense"],
["Paraibano", "Paraibana"], ["Paraibano", "Paraibana"],
@ -120,16 +148,31 @@
function generate() { function generate() {
const initial = first[getRandomInt(first.length)]; const initial = first[getRandomInt(first.length)];
const final = last[getRandomInt(last.length)]; const final = last[getRandomInt(last.length)];
const name = initial[0] + " " + final[initial[1]];
return initial[0] + " " + final[initial[1]]; if (name.length > 19) {
return generate();
}
return name;
} }
function show() { function show() {
let base = document.createElement("div");
base.className = "block";
for (let i = 0; i < 5; i++) {
let name = document.createElement("p"); let name = document.createElement("p");
name.innerHTML = generate(); name.innerHTML = generate();
document.getElementById("content").append(name); base.append(name);
} }
document.getElementById("content").append(base);
}
const btn = document.getElementById("generator");
btn.addEventListener("click", () => show());
show(); show();
})(); })();
</script> </script>
Loading…
Cancel
Save