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.

118 lines
4.4 KiB
JavaScript

var nm1 = ["b", "br", "d", "g", "gr", "k", "kr", "l", "m", "n", "pr", "r", "s", "z"];
var nm2 = ["ee", "ay", "a", "e", "i", "u", "a", "e", "i", "u", "a", "e", "i", "u", "a", "a"];
var nm3 = ["c", "d", "dd", "g", "k", "rr", "v", "z", "dr", "gd", "gr", "kl", "kn", "lr", "lm", "rc", "rd", "rm", "rt", "zd"];
var nm4 = ["a", "i", "o", "a", "i", "o", "e", "u"];
var nm5 = ["d", "g", "l", "v", "z"];
var nm6 = ["c", "h", "kt", "l", "n", "m", "r", "rth", "th"];
var nm7 = ["", "", "", "d", "g", "j", "m", "p", "r", "s", "v", "z"];
var nm8 = ["ay", "ey", "a", "e", "i", "a", "e", "i", "a", "e", "i", "a", "e", "i", "o", "a", "e", "i", "y"];
var nm9 = ["d", "dn", "hl", "hn", "l", "ll", "lm", "lr", "ln", "lv", "mr", "mn", "nc", "nd", "nv", "r", "rl", "rn", "rl", "rv", "t", "th", "v"];
var nm10 = ["ya", "ye", "ia", "ei", "a", "e", "a", "e", "a", "e", "a", "e", "a", "e", "a", "e", "i", "o"];
var nm11 = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "h", "l", "n", "s"];
var nm12 = ["", "", "", "c", "d", "g", "l", "m", "r", "v", "z"];
var nm13 = ["a", "e", "o", "u", "a"];
var nm14 = ["d", "dr", "g", "gr", "gl", "kr", "l", "ll", "ld", "ln", "m", "mr", "nt", "rd", "ns", "sr", "sd", "st", "v", "vr"];
var nm15 = ["ee", "ie", "oo", "i", "e", "a", "i", "e", "a"];
var nm16 = ["l", "n", "nn", "nzz", "r", "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();
}
}
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() * 7 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd3 = Math.random() * nm6.length | 0;
if (nTp < 3) {
while (nm1[rnd] === nm6[rnd3]) {
rnd3 = Math.random() * nm6.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm6[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 (nTp < 6) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm4[rnd5] + nm6[rnd3];
} else {
rnd6 = Math.random() * nm5.length | 0;
rnd7 = Math.random() * nm4.length | 0;
if (rnd2 < 2) {
rnd2 += 2;
}
rnd4 = Math.random() * 8 | 0;
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm4[rnd5] + nm5[rnd6] + nm4[rnd7] + nm6[rnd3];
}
}
testSwear(nMs);
}
function genFem() {
rnd = Math.random() * nm7.length | 0;
rnd2 = Math.random() * nm8.length | 0;
rnd3 = Math.random() * nm9.length | 0;
rnd4 = Math.random() * nm10.length | 0;
rnd5 = Math.random() * nm11.length | 0;
while (nm9[rnd3] === nm7[rnd] || nm9[rnd3] === nm12[rnd5]) {
rnd3 = Math.random() * nm9.length | 0;
}
if (rnd2 < 2) {
if (rnd4 < 4) {
rnd4 += 4;
}
}
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm10[rnd4] + nm11[rnd5];
testSwear(nMs);
}
function genSur() {
nTp = Math.random() * 7 | 0;
rnd = Math.random() * nm12.length | 0;
rnd5 = Math.random() * nm16.length | 0;
if (nTp === 0) {
rndU = Math.random() * 3 | 0;
nSr = nm12[rnd] + nm15[rndU] + nm16[rnd5];
} else {
rnd2 = Math.random() * nm13.length | 0;
rnd3 = Math.random() * nm14.length | 0;
rnd4 = Math.random() * nm15.length | 0;
while (nm14[rnd3] === nm12[rnd] || nm14[rnd3] === nm16[rnd5]) {
rnd3 = Math.random() * nm14.length | 0;
}
nSr = nm12[rnd] + nm13[rnd2] + nm14[rnd3] + nm15[rnd4] + nm16[rnd5];
}
testSwear(nSr);
}