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.

43 lines
1.9 KiB
JavaScript

var nm1 = ["Ash", "Blaiz", "Blaz", "Blyz", "Boil", "Boyle", "Brun", "Burn", "Cend", "Cendr", "Cind", "Cindr", "Clair", "Coal", "Ember", "Embr", "Fenix", "Fern", "Fernis", "Fervis", "Fervor", "Fir", "Flair", "Flar", "Flash", "Fueg", "Fum", "Furn", "Furnis", "Fyer", "Glow", "Ign", "Igneos", "Igneous", "Ignis", "Ignit", "Incend", "Incendiar", "Incendr", "Infern", "Kind", "Kindel", "Kindr", "Lav", "Magm", "Nov", "Novis", "Pyer", "Pyr", "Pyroc", "Ragn", "Scald", "Scaldor", "Scaldr", "Scor", "Scorch", "Sear", "Sigmis", "Sizz", "Sizzel", "Smok", "Smolder", "Smoldr", "Soot", "Spark", "Temper", "Tempr", "Tinder", "Tindr", "Volcan"];
var nm2 = ["a", "e", "i", "o", "u", "a", "e", "i", "o"];
var nm3 = ["f", "h", "k", "l", "ll", "m", "n", "r", "rr", "s", "y", "z"];
var nm4 = ["", "a", "e", "i"];
var br = "";
function nameGen(type) {
var tp = type;
$('#placeholder').css('textTransform', 'capitalize');
var element = document.createElement("div");
element.setAttribute("id", "result");
for (i = 0; i < 10; i++) {
nameMas();
while (nMs === "") {
nameMas();
}
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);
}
function nameMas() {
nTp = Math.random() * 4 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm4.length | 0;
if (nTp === 0) {
while (nm4[rnd2] === "") {
rnd2 = Math.random() * nm4.length | 0;
}
nMs = nm1[rnd] + nm4[rnd2];
} else {
rnd3 = Math.random() * nm2.length | 0;
rnd4 = Math.random() * nm3.length | 0;
nMs = nm1[rnd] + nm2[rnd3] + nm3[rnd4] + nm4[rnd2];
}
testSwear(nMs);
}