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.

64 lines
2.4 KiB
JavaScript

var nm1 = ["", "", "b", "d", "f", "g", "gr", "j", "k", "l", "m", "r", "t", "w", "y", "z", "zh"];
var nm2 = ["a", "e", "i", "o", "u", "a", "o", "u", "a", "e", "i", "o", "u", "a", "o", "u", "a", "e", "i", "o", "u", "a", "o", "u", "a", "e", "i", "o", "u", "a", "o", "u", "oo"];
var nm3 = ["b", "g", "gb", "gl", "k", "k", "k", "kk", "kl", "m", "mm", "mb", "n", "nb", "ng", "ngk", "r", "rl", "rg"];
var nm4 = ["", "", "", "", "h", "hl", "k", "m", "n", "ng", "nk", "p", "r", "t"];
var nm5 = ["-", " "];
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 === "" || nMs === "-" | 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() * 6 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd3 = Math.random() * nm4.length | 0;
if (nTp < 2) {
while (nm1[rnd] === nm4[rnd3]) {
rnd = Math.random() * nm1.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd3];
} else if (nTp === 2) {
rnd4 = Math.random() * nm3.length | 0;
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm2[rnd2];
} else if (nTp === 3) {
rnd4 = Math.random() * nm3.length | 0;
rnd5 = Math.random() * nm2.length | 0;
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm2[rnd5];
} else {
rnd4 = Math.random() * nm2.length | 0;
rnd5 = Math.random() * nm3.length | 0;
if (nTp === 4) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd5] + nm2[rnd4] + nm4[rnd3];
} else {
rnd6 = Math.random() * nm2.length | 0;
while (nm4[rnd3] === "") {
rnd3 = Math.random() * nm4.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd5] + nm2[rnd4] + nm4[rnd3] + nm2[rnd6];
}
}
testSwear(nMs);
if (nTp < 2) {
rnd = Math.random() * nm5.length | 0;
nMs = nMs + nm5[rnd] + nMs;
}
}