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.

73 lines
2.8 KiB
JavaScript

var nm1 = ["", "c", "d", "g", "l", "m", "n", "r", "t", "tr", "v", "vr"];
var nm2 = ["a", "o", "a", "o", "a", "e", "i"];
var nm3 = ["d", "dr", "f", "fr", "g", "gg", "gn", "l", "ll", "ld", "lf", "lm", "m", "mm", "mn", "n", "nd", "nn", "nt", "nl", "r", "rr", "rl", "rd", "s", "ss", "sl", "sn", "t", "yl", "yn", "yr"];
var nm4 = ["l", "m", "n", "ng", "r", "s"];
var nm5 = ["", "c", "f", "h", "l", "m", "n", "s", "y"];
var nm6 = ["a", "i", "o", "a", "i", "o", "e"];
var nm7 = ["f", "h", "l", "ll", "m", "mm", "n", "nn", "r", "rr", "s", "ss", "v", "z"];
var nm8 = ["h", "l", "m", "n", "r", "s", "v", "z", "h", "l", "m", "n", "r", "s", "v", "z", "h", "l", "ll", "lr", "lm", "m", "mn", "mm", "n", "nn", "nr", "nv", "ns", "nz", "r", "rs", "rv", "s", "v", "z"];
var nm9 = ["a", "e", "u", "a", "e", "u", "i", "o"];
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++) {
if (tp === 1) {
nameFem();
while (nMs === "") {
nameFem();
}
} else {
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() {
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd3 = Math.random() * nm4.length | 0;
rnd4 = Math.random() * nm2.length | 0;
rnd5 = Math.random() * nm3.length | 0;
while (nm3[rnd5] === nm1[rnd] || nm3[rnd5] === nm4[rnd3]) {
rnd5 = Math.random() * nm3.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd5] + nm2[rnd4] + nm4[rnd3];
testSwear(nMs);
}
function nameFem() {
nTp = Math.random() * 2 | 0;
rnd = Math.random() * nm5.length | 0;
rnd2 = Math.random() * nm6.length | 0;
rnd3 = Math.random() * nm7.length | 0;
rnd4 = Math.random() * nm6.length | 0;
if (nTp === 0) {
while (nm7[rnd3] === nm5[rnd] || nm5[rnd] === "") {
rnd = Math.random() * nm5.length | 0;
}
nMs = nm5[rnd] + nm6[rnd2] + nm7[rnd3] + nm6[rnd4];
} else {
rnd5 = Math.random() * nm8.length | 0;
rnd6 = Math.random() * nm9.length | 0;
while (nm8[rnd5] === nm5[rnd] || nm8[rnd5] === nm7[rnd3]) {
rnd5 = Math.random() * nm8.length | 0;
}
nMs = nm5[rnd] + nm6[rnd2] + nm7[rnd3] + nm6[rnd4] + nm8[rnd5] + nm9[rnd6];
}
testSwear(nMs);
}