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.
68 lines
2.3 KiB
JavaScript
68 lines
2.3 KiB
JavaScript
var nm1 = ["ch", "cr", "g", "gl", "gr", "k", "kr", "n", "q", "qr", "r", "rh", "t", "tr", "v", "vr", "z", "zh", "zr"];
|
|
var nm2 = ["i", "e", "a", "o", "i", "e"];
|
|
var nm3 = ["qq", "q", "r", "rs", "sh", "ss", "t", "tt", "th", "x", "z"];
|
|
var nm4 = ["b", "c", "ch", "d", "g", "k", "m", "n", "r", "t", "v", "z"];
|
|
var nm5 = ["a", "a", "e", "i", "o"];
|
|
var nm6 = ["d", "h", "k", "l", "ll", "lm", "ln", "lf", "lk", "m", "n", "ng", "ph", "r", "rl", "rm", "s", "sh", "ss", "v", "y", "z"];
|
|
var nm7 = ["i", "i", "e", "a", "o", "i"];
|
|
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() {
|
|
nTp = Math.random() * 2 | 0;
|
|
rnd = Math.random() * nm1.length | 0;
|
|
rnd2 = Math.random() * nm2.length | 0;
|
|
rnd3 = Math.random() * nm3.length | 0;
|
|
while (nm1[rnd] === nm3[rnd3]) {
|
|
rnd3 = Math.random() * nm3.length | 0;
|
|
}
|
|
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3];
|
|
if (nTp === 0) {
|
|
rnd4 = Math.random() * nm2.length | 0;
|
|
while (nm2[rnd4] === nm2[rnd2]) {
|
|
rnd4 = Math.random() * nm2.length | 0;
|
|
}
|
|
nMs = nMs + " " + nm1[rnd] + nm2[rnd4] + nm3[rnd3];
|
|
}
|
|
testSwear(nMs);
|
|
}
|
|
|
|
function nameFem() {
|
|
nTp = Math.random() * 4 | 0;
|
|
rnd = Math.random() * nm4.length | 0;
|
|
rnd2 = Math.random() * nm5.length | 0;
|
|
rnd3 = Math.random() * nm6.length | 0;
|
|
rnd4 = Math.random() * nm7.length | 0;
|
|
while (nm4[rnd] === nm6[rnd3]) {
|
|
rnd3 = Math.random() * nm6.length | 0;
|
|
}
|
|
nMs = nm4[rnd] + nm5[rnd2] + nm6[rnd3] + nm7[rnd4];
|
|
testSwear(nMs);
|
|
}
|