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.

94 lines
3.6 KiB
JavaScript

var nm1 = ["", "", "b", "d", "g", "h", "k", "l", "m", "n", "nh", "r", "sh", "t", "v", "vr", "z"];
var nm2 = ["aa", "au", "ao", "y", "a", "e", "i", "u", "y", "a", "e", "i", "u", "y", "a", "e", "i", "u"];
var nm3 = ["d", "dr", "h", "hr", "hl", "k", "kh", "l", "lr", "m", "mr", "n", "nh", "r", "rl", "rd", "rm", "s", "st", "t", "vn", "vm"];
var nm4 = ["a", "e", "i", "o"];
var nm5 = ["d", "l", "m", "n", "r", "s", "v", "z"];
var nm6 = ["", "c", "k", "n", "r", "s", "th", "c", "k", "n", "r", "s", "th"];
var nm7 = ["", "", "d", "h", "l", "m", "n", "r", "s", "t", "v", "z"];
var nm8 = ["a", "e", "o", "a", "e", "o", "i"];
var nm9 = ["h", "l", "ll", "m", "n", "nn", "r", "rr", "s", "ss", "sh", "t", "th", "v", "z"];
var nm10 = ["ae", "a", "e", "i", "u", "a", "e", "i", "u", "a", "e", "i", "u"];
var nm11 = ["b", "d", "h", "l", "m", "n", "r", "t", "v"];
var nm12 = ["", "", "", "", "h", "l", "n", "r", "v"];
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();
}
}
names = nMs;
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() * 6 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd3 = Math.random() * nm3.length | 0;
rnd4 = Math.random() * nm4.length | 0;
rnd5 = Math.random() * nm6.length | 0;
while (nm1[rnd] === nm6[rnd5]) {
rnd5 = Math.random() * nm6.length | 0;
}
if (nTp < 3) {
while (nm3[rnd3] === nm6[rnd5] || nm3[rnd3] === nm1[rnd]) {
rnd3 = Math.random() * nm3.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm6[rnd5];
} else {
rnd6 = Math.random() * nm5.length | 0;
rnd7 = Math.random() * nm2.length | 0;
while (nm6[rnd5] === nm5[rnd6] || nm5[rnd6] === nm3[rnd3]) {
rnd6 = Math.random() * nm5.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd7] + nm5[rnd6] + nm4[rnd4] + nm6[rnd5];
}
testSwear(nMs);
}
function nameFem() {
nTp = Math.random() * 6 | 0;
rnd = Math.random() * nm7.length | 0;
rnd2 = Math.random() * nm8.length | 0;
rnd3 = Math.random() * nm9.length | 0;
rnd4 = Math.random() * nm10.length | 0;
rnd5 = Math.random() * nm12.length | 0;
while (nm7[rnd] === nm12[rnd5]) {
rnd5 = Math.random() * nm12.length | 0;
}
if (nTp < 3) {
while (nm9[rnd3] === nm12[rnd5] || nm9[rnd3] === nm7[rnd]) {
rnd3 = Math.random() * nm9.length | 0;
}
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm10[rnd4] + nm12[rnd5];
} else {
rnd6 = Math.random() * nm11.length | 0;
rnd7 = Math.random() * nm8.length | 0;
while (nm12[rnd5] === nm11[rnd6] || nm11[rnd6] === nm9[rnd3]) {
rnd6 = Math.random() * nm11.length | 0;
}
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm8[rnd7] + nm11[rnd6] + nm10[rnd4] + nm12[rnd5];
}
testSwear(nMs);
}