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.

132 lines
5.3 KiB
JavaScript

var nm1 = ["", "", "", "b", "d", "h", "j", "k", "m", "n", "p", "r"];
var nm2 = ["ai", "y", "a", "e", "o", "a", "e", "o", "a", "e", "o", "a", "e", "o"];
var nm3 = ["b", "br", "d", "l", "m", "n", "nr", "nz", "nzr", "phr", "r", "rk", "zh", "zhr", "zr", "zz"];
var nm4 = ["ai", "ia", "aa", "a", "a", "e", "e", "i", "o", "u", "u"];
var nm5 = ["", "d", "f", "k", "m", "n", "s"];
var nm6 = ["", "", "", "b", "d", "f", "h", "l", "m", "n", "ph", "v", "y", "z"];
var nm7 = ["a", "a", "e", "i", "i", "o"];
var nm8 = ["d", "dd", "dr", "gr", "k", "kr", "m", "mn", "nd", "nr", "r", "s", "sh", "y", "z", "zh"];
var nm9 = ["aa", "ee", "ie", "ei", "a", "e", "i", "a", "e", "i", "a", "e", "i", "a", "e", "i", "o", "a", "e", "i", "o"];
var nm10 = ["d", "d", "hd", "hn", "hnd", "l", "ll", "n", "l", "ll", "n", "nd", "nn", "s", "ss", "nn", "s", "ss"];
var nm11 = ["a", "e", "a", "e", "i", "o"];
var nm12 = ["", "", "", "", "", "", "", "", "r", "rh", "s", "ss", "sh", "t", "th", "z"];
var nm13 = ["", "", "b", "br", "d", "dh", "dr", "f", "fh", "g", "k", "kh", "kr", "pr", "r", "s", "t", "tr", "v", "z"];
var nm14 = ["ai", "ua", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "y"];
var nm15 = ["dg", "l", "ld", "ll", "m", "mm", "nd", "nk", "nr", "nz", "r", "rd", "rz", "s", "sh", "sht", "ss", "t", "th", "tr", "tt", "z", "zd", "zr"];
var nm16 = ["a", "e", "i", "u", "a", "e", "i", "u"];
var nm17 = ["d", "g", "l", "ll", "n", "r", "rr", "y", "z"];
var nm18 = ["", "", "", "d", "g", "k", "ng", "r", "t"];
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++) {
nameSur();
while (nSr === "") {
nameSur();
}
if (tp === 1) {
nameFem();
while (nMs === "") {
nameFem();
}
} else {
nameMas();
while (nMs === "") {
nameMas();
}
}
names = nMs + " " + nSr;
br = document.createElement('br');
element.appendChild(document.createTextNode(names));
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() * nm2.length | 0;
rnd3 = Math.random() * nm5.length | 0;
if (nTp === 0) {
while (nm5[rnd3] === "" && rnd2 !== 0) {
rnd3 = Math.random() * nm5.length | 0;
}
while (nm1[rnd] === nm5[rnd3] || nm1[rnd] === "") {
rnd = Math.random() * nm1.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm5[rnd3];
} else {
rnd4 = Math.random() * nm3.length | 0;
rnd5 = Math.random() * nm4.length | 0;
while (nm3[rnd4] === nm1[rnd] || nm3[rnd4] === nm5[rnd3]) {
rnd4 = Math.random() * nm3.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm4[rnd5] + nm5[rnd3];
}
testSwear(nMs);
}
function nameFem() {
nTp = Math.random() * 3 | 0;
rnd = Math.random() * nm6.length | 0;
rnd2 = Math.random() * nm7.length | 0;
rnd3 = Math.random() * nm8.length | 0;
rnd4 = Math.random() * nm9.length | 0;
rnd5 = Math.random() * nm12.length | 0;
while (nm8[rnd3] === nm6[rnd] || nm8[rnd3] === nm12[rnd5]) {
rnd3 = Math.random() * nm8.length | 0;
}
if (nTp < 2) {
nMs = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm9[rnd4] + nm12[rnd5];
} else {
rnd6 = Math.random() * nm10.length | 0;
rnd7 = Math.random() * nm11.length | 0;
while (nm8[rnd3] === nm10[rnd6] || nm10[rnd6] === nm12[rnd5]) {
rnd6 = Math.random() * nm10.length | 0;
}
nMs = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm9[rnd4] + nm10[rnd6] + nm11[rnd7] + nm12[rnd5];
}
testSwear(nMs);
}
function nameSur() {
nTp = Math.random() * 4 | 0;
rnd = Math.random() * nm13.length | 0;
rnd2 = Math.random() * nm14.length | 0;
rnd3 = Math.random() * nm18.length | 0;
if (nTp === 0) {
while (nm18[rnd3] === "" && rnd2 > 1) {
rnd3 = Math.random() * nm18.length | 0;
}
while (nm13[rnd] === nm18[rnd3] || nm13[rnd] === "") {
rnd = Math.random() * nm13.length | 0;
}
nSr = nm13[rnd] + nm14[rnd2] + nm18[rnd3];
} else {
rnd4 = Math.random() * nm15.length | 0;
rnd5 = Math.random() * nm16.length | 0;
while (nm15[rnd4] === nm13[rnd] || nm15[rnd4] === nm18[rnd3]) {
rnd4 = Math.random() * nm15.length | 0;
}
if (nTp < 3) {
nSr = nm13[rnd] + nm14[rnd2] + nm15[rnd4] + nm16[rnd5] + nm18[rnd3];
} else {
rnd6 = Math.random() * nm17.length | 0;
rnd7 = Math.random() * nm16.length | 0;
while (nm15[rnd4] === nm17[rnd6] || nm17[rnd6] === nm18[rnd3]) {
rnd6 = Math.random() * nm17.length | 0;
}
nSr = nm13[rnd] + nm14[rnd2] + nm15[rnd4] + nm16[rnd5] + nm17[rnd6] + nm16[rnd7] + nm18[rnd3];
}
}
testSwear(nSr);
}