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.

80 lines
2.9 KiB
JavaScript

var nm1 = ["", "b", "br", "d", "dr", "f", "gr", "j", "k", "l", "m", "r", "t", "th", "v", "y"];
var nm2 = ["ai", "aa", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u"];
var nm3 = ["b", "k", "m", "n", "ns", "rg", "rl", "rm", "rn", "rst", "s", "sh", "st", "t", "ts"];
var nm4 = ["", "", "", "f", "j", "l", "m", "n", "s", "t", "v", "y"];
var nm5 = ["ia", "ee", "a", "e", "o", "a", "e", "o", "a", "e", "o", "a", "e", "o", "a", "e", "o", "i", "i"];
var nm6 = ["k", "l", "m", "n", "r", "s", "z", "ls", "ln", "ns", "nsr", "nr", "nz", "rs", "rz", "sn", "sr", "ss", "zz", "zr"];
var nm7 = ["a", "a", "a", "e", "o"];
var nm8 = ["n", "r", "y", "z"];
var nm9 = ["ea", "ai", "oa", "a", "a", "a", "e", "a", "a", "e", "a", "a", "e", "a", "a", "e"];
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() * nm3.length | 0;
while (nm3[rnd3] === nm1[rnd]) {
rnd3 = Math.random() * nm3.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3];
testSwear(nMs);
}
function nameFem() {
nTp = Math.random() * 6 | 0
rnd = Math.random() * nm4.length | 0;
if (nTp === 0) {
while (nm4[rnd] === "") {
rnd = Math.random() * nm4.length | 0;
}
rnd2 = Math.random() * 3 | 0;
nMs = nm4[rnd] + nm9[rnd2];
} else {
rnd2 = Math.random() * nm5.length | 0;
rnd3 = Math.random() * nm6.length | 0;
rnd4 = Math.random() * nm9.length | 0;
while (nm4[rnd] === nm6[rnd3]) {
rnd3 = Math.random() * nm6.length | 0;
}
if (nTp < 4) {
nMs = nm4[rnd] + nm5[rnd2] + nm6[rnd3] + nm9[rnd4];
} else {
rnd3 = Math.random() * 7 | 0;
rnd5 = Math.random() * nm7.length | 0;
rnd6 = Math.random() * nm8.length | 0;
while (nm4[rnd] === nm6[rnd3] || nm8[rnd6] === nm6[rnd3]) {
rnd3 = Math.random() * nm6.length | 0;
}
nMs = nm4[rnd] + nm5[rnd2] + nm6[rnd3] + nm7[rnd5] + nm8[rnd6] + nm9[rnd4];
}
}
testSwear(nMs);
}