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.

111 lines
4.0 KiB
JavaScript

var nm1 = ["d", "g", "h", "m", "n", "r", "v", "dr", "gr", "kr", "pr", "vr"];
var nm2 = ["e", "i", "e", "i", "a", "o"];
var nm3 = ["ch", "gr", "rc", "c", "g", "k", "kh", "n", "r", "t", "v", "z"];
var nm4 = ["ae", "aa", "a", "o", "u", "a", "o", "u", "e", "i"];
var nm5 = ["d", "gh", "l", "ll", "n", "t", "tt", "v"];
var nm6 = ["c", "d", "g", "k", "l", "m", "n", "t", "v", "z"];
var nm7 = ["a", "a", "a", "a", "e", "i", "o", "a", "a", "a", "a", "e", "i", "o", "y", "y", "y"];
var nm8 = ["d", "dn", "dr", "hl", "hr", "hn", "l", "lr", "lm", "ln", "ld", "ll", "m", "mm", "mn", "n", "nr", "nv", "nz", "r", "rn", "sm", "ss"];
var nm9 = ["d", "l", "ll", "n", "r", "rr", "s", "ss"];
var nm10 = ["ya", "ea", "ia", "a", "a", "a", "a", "i", "e", "a", "a", "a", "a", "i", "e"];
var nm11 = ["d", "dr", "h", "g", "gr", "k", "m", "n", "r", "str", "t", "tr", "th", "v", "z"];
var nm12 = ["a", "o", "a", "o", "a", "o", "e", "i", "u"];
var nm13 = ["d", "g", "gg", "h", "l", "ll", "m", "n", "nn", "r", "rr", "v"];
var nm14 = ["d", "g", "gt", "k", "r", "rn", "rd", "s", "st", "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();
}
}
genSur();
while (nSr === "") {
genSur();
}
nMs += " " + nSr;
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() * 3 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd3 = Math.random() * nm5.length | 0;
if (nTp === 0) {
while (nm1[rnd] === nm5[rnd3]) {
rnd3 = Math.random() * nm5.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] === nm6[rnd3]) {
rnd4 = Math.random() * nm3.length | 0;
}
if (rnd > 6) {
while (rnd4 < 4 || nm3[rnd4] === nm1[rnd]) {
rnd4 = Math.random() * nm3.length | 0;
}
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm4[rnd5] + nm6[rnd3];
}
testSwear(nMs);
}
function genFem() {
nTp = Math.random() * 5 | 0;
rnd = Math.random() * nm6.length | 0;
rnd2 = Math.random() * nm7.length | 0;
rnd3 = Math.random() * nm8.length | 0;
rnd4 = Math.random() * nm10.length | 0;
while (nm8[rnd3] === nm7[rnd]) {
rnd3 = Math.random() * nm8.length | 0;
}
if (nTp < 4) {
nMs = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm10[rnd4];
} else {
rnd5 = Math.random() * nm7.length | 0;
rnd6 = Math.random() * nm9.length | 0;
nMs = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm7[rnd5] + nm9[rnd6] + nm10[rnd4];
}
testSwear(nMs);
}
function genSur() {
nTp = Math.random() * 7 | 0;
rnd = Math.random() * nm11.length | 0;
rnd2 = Math.random() * nm12.length | 0;
rnd5 = Math.random() * nm14.length | 0;
if (nTp === 0) {
nSr = nm11[rnd] + nm12[rnd2] + nm14[rnd5];
} else {
rnd3 = Math.random() * nm13.length | 0;
rnd4 = Math.random() * nm12.length | 0;
while (nm13[rnd3] === nm11[rnd] || nm13[rnd3] === nm14[rnd5]) {
rnd3 = Math.random() * nm13.length | 0;
}
nSr = nm11[rnd] + nm12[rnd2] + nm13[rnd3] + nm12[rnd4] + nm14[rnd5];
}
testSwear(nSr);
}