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.

100 lines
4.0 KiB
JavaScript

var nm1 = ["b", "br", "d", "g", "h", "k", "kr", "p", "q", "r", "y"];
var nm2 = ["ua", "ee", "a", "e", "o", "u", "a", "e", "o", "u", "a", "e", "o", "u", "a", "e", "o", "u"];
var nm3 = ["d", "g", "k", "l", "ll", "n", "r", "z", "d", "g", "k", "l", "ll", "n", "r", "z", "gd", "gt", "kl", "kt", "ld", "lt", "nd", "nth", "pp", "rp", "rl", "rt", "tl"];
var nm4 = ["io", "eo", "a", "e", "o", "a", "e", "o", "i", "a", "e", "o", "a", "e", "o", "i"];
var nm5 = ["d", "l", "k", "p", "t", "v", "z"];
var nm6 = ["", "", "", "", "l", "n", "p", "r", "s", "t"];
var nm7 = ["c", "d", "g", "k", "l", "m", "n", "r", "s", "v", "z"];
var nm8 = ["ay", "ia", "a", "e", "i", "a", "e", "i", "a", "e", "i", "a", "e", "i", "a", "e", "i"];
var nm9 = ["d", "l", "ll", "n", "nn", "r", "rr", "s", "ss", "t", "tt"];
var nm10 = ["a", "a", "a", "e", "o", "i"];
var nm11 = ["d", "p", "s", "t"];
function nameGen(type) {
$('#placeholder').css('textTransform', 'capitalize');
var tp = type;
var br = "";
var element = document.createElement("div");
element.setAttribute("id", "result");
for (i = 0; i < 10; i++) {
if (tp === 1) {
genFem();
while (nMs === "") {
genFem();
}
} else {
genMas();
while (nMs === "") {
genMas();
}
}
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 genMas() {
nTp = Math.random() * 4 | 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;
if (rnd2 < 2 && rnd4 < 2) {
rnd4 += 2;
}
if (nTp < 2) {
while (nm1[rnd] === nm3[rnd3] || nm3[rnd3] === nm6[rnd5]) {
rnd3 = Math.random() * nm3.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm6[rnd5];
} else if (nTp === 2) {
rnd6 = Math.random() * nm10.length | 0;
rnd7 = Math.random() * nm5.length | 0;
while (nm5[rnd7] === nm6[rnd5] || nm5[rnd7] === nm3[rnd3]) {
rnd7 = Math.random() * nm5.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd7] + nm10[rnd6] + nm6[rnd5];
} else {
xTp = Math.random() * 2 | 0;
rnd7 = Math.random() * nm10.length | 0;
rnd8 = Math.random() * nm10.length | 0;
rnd9 = Math.random() * nm3.length | 0;
rnd10 = Math.random() * nm3.length | 0;
rnd11 = Math.random() * nm6.length | 0;
rnd12 = Math.random() * nm6.length | 0;
if (xTp === 0) {
nMs = nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm6[rnd5] + " " + nm2[rnd2] + nm3[rnd9] + nm10[rnd7] + nm6[rnd11] + " " + nm2[rnd2] + nm3[rnd10] + nm10[rnd8] + nm6[rnd12];
} else {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm6[rnd5] + " " + nm1[rnd] + nm2[rnd2] + nm3[rnd9] + nm10[rnd7] + nm6[rnd11] + " " + nm1[rnd] + nm2[rnd2] + nm3[rnd10] + nm10[rnd8] + nm6[rnd12];
}
}
testSwear(nMs);
}
function genFem() {
nTp = Math.random() * 2 | 0;
rnd = Math.random() * nm7.length | 0;
rnd2 = Math.random() * nm8.length | 0;
rnd6 = Math.random() * nm11.length | 0;
while (nm7[rnd] === nm11[rnd6]) {
rnd6 = Math.random() * nm11.length | 0;
}
if (nTp === 0) {
nMs = nm7[rnd] + nm8[rnd2] + nm11[rnd6];
} else {
rnd3 = Math.random() * nm9.length | 0;
rnd4 = Math.random() * nm10.length | 0;
while (nm7[rnd] === nm9[rnd3] || nm9[rnd3] === nm11[rnd6]) {
rnd3 = Math.random() * nm9.length | 0;
}
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm10[rnd4] + nm11[rnd6];
}
testSwear(nMs);
}