You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.4 KiB
JavaScript

var br = "";
function nameGen() {
var nm1 = ["Bear", "Wolf", "Boar", "Croc", "Rat", "Tiger", "Wild", "Beast", "Feral", "Savage", "Eagle", "Hawk", "Falcon", "Raptor", "Owl", "Bat", "Shark", "Fang", "Claw", "Eye", "Feather", "Plume", "Fin", "Fur", "Pelt", "Talon"];
var nm2 = ["maw", "jaw", "skin", "tamer", "marked", "blood", "might", "force", "vigor", "strength", "fury", "scream", "rage", "sworn", "strike", "stride", "sorrow", "song", "shield", "shadow", "crest", "heart", "chaser", "breaker", "bane", "blight", "cure", "trial", "heart", "crown", "soul", "mind", "spirit", "will", "bound", "fate", "mark", "sight"];
$('#placeholder').css('textTransform', 'capitalize');
var element = document.createElement("div");
element.setAttribute("id", "result");
for (i = 0; i < 10; i++) {
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
if (rnd > 9) {
while (rnd2 < 3) {
rnd2 = Math.random() * nm2.length | 0;
}
}
nMs = nm1[rnd] + nm2[rnd2];
nm1.splice(rnd, 1);
nm2.splice(rnd2, 1);
br = document.createElement('br');
element.appendChild(document.createTextNode(nMs));
element.appendChild(br);
}
if (document.getElementById("result")) {
document.getElementById("placeholder").removeChild(document.getElementById("result"));
}
document.getElementById("placeholder").appendChild(element);
}