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.

103 lines
4.4 KiB
JavaScript

var nm1 = ["", "", "", "", "ch'", "d'l", "dm'", "dr'", "h'k", "k't", "k'thr", "k'tr", "k'", "kh'", "m'j", "m'r", "r'k", "r't", "s'k", "sk'", "sn'", "z'r", "b", "br", "chr", "cr", "d", "dh", "dr", "dz", "f", "g", "gr", "h", "j", "k", "kl", "kr", "l", "m", "mr", "n", "p", "pt", "r", "s", "str", "t", "v", "vr", "w", "x", "y", "z", "zr"];
var nm2 = ["a", "a", "e", "i", "o", "o", "a", "a", "e", "i", "o", "o", "u"];
var nm3 = ["'b", "'d", "k's", "g'l", "n'd", "l'm", "r't", "'z", "b", "dd", "dr", "g", "k", "ks", "l", "ll", "lm", "lx", "m", "n", "nd", "nk", "p", "pt", "r", "rr", "rt", "rk", "rks", "s", "v", "xx", "z"];
var nm4 = ["ea", "ee", "ai", "aa", "a", "a", "e", "i", "o", "o", "y", "a", "a", "e", "i", "o", "o", "y", "a", "a", "e", "i", "o", "o", "y", "a", "a", "e", "i", "o", "o"];
var nm5 = ["l", "ll", "r", "rr", "t", "tt"];
var nm6 = ["", "", "", "dd", "gg", "k", "ll", "lx", "n", "nn", "r", "rr", "rth", "s", "t", "tch", "th", "tz", "x"];
var nm7 = ["", "", "", "", "ch'r", "h'r", "k'k", "m'l", "n'", "r'k", "r'", "s'b", "x'", "z'c", "d", "fr", "j", "k", "l", "m", "p", "r", "t", "v", "z"];
var nm8 = ["aa", "a", "a", "a", "e", "e", "i", "u", "y", "a", "a", "a", "e", "e", "i", "u", "y"];
var nm9 = ["g", "j", "l", "n", "nd", "r", "rd", "rr", "rn", "s", "v", "z"];
var nm10 = ["a", "e", "i", "a", "e", "i", "o"];
var nm11 = ["k", "l", "ll", "n", "r", "rr", "v", "z"];
var nm12 = ["", "", "", "", "l", "ll", "n", "nn", "s", "ss", "th"];
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() * 5 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd5 = Math.random() * nm6.length | 0;
if (nTp === 0) {
while (nm1[rnd] === "") {
rnd = Math.random() * nm1.length | 0;
}
while (nm1[rnd] === nm6[rnd5] || nm6[rnd5] === "") {
rnd5 = Math.random() * nm6.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm6[rnd5];
} else {
rnd3 = Math.random() * nm3.length | 0;
rnd4 = Math.random() * nm4.length | 0;
if (rnd < 22) {
while (rnd3 < 8) {
rnd3 = Math.random() * nm3.length | 0;
}
}
if (nTp < 4) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm6[rnd5];
} else {
rnd6 = Math.random() * nm2.length | 0;
rnd7 = Math.random() * nm5.length | 0;
while (nm5[rnd7] === nm3[rnd3]) {
rnd7 = Math.random() * nm5.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd7] + nm2[rnd6] + nm6[rnd5];
}
}
testSwear(nMs);
}
function genFem() {
nTp = Math.random() * 5 | 0;
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() * nm12.length | 0;
while (nm9[rnd3] === nm7[rnd] || nm9[rnd3] === nm12[rnd5]) {
rnd3 = Math.random() * nm9.length | 0;
}
if (nTp < 3) {
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm10[rnd4] + nm12[rnd5];
} else {
rnd6 = Math.random() * nm10.length | 0;
rnd7 = Math.random() * nm11.length | 0;
while (nm11[rnd7] === nm9[rnd3] || nm11[rnd7] === nm12[rnd5]) {
rnd7 = Math.random() * nm11.length | 0;
}
if (nTp === 3) {
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm10[rnd4] + nm11[rnd7] + nm10[rnd6] + nm12[rnd5];
} else {
nMs = nm7[rnd] + nm8[rnd2] + nm11[rnd7] + nm10[rnd6] + nm9[rnd3] + nm10[rnd4] + nm12[rnd5];
}
}
testSwear(nMs);
}