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.

86 lines
3.4 KiB
JavaScript

var nm1 = ["", "", "", "", "", "", "h", "g", "gh", "k", "kh", "m", "n", "r", "s", "v", "z"];
var nm2 = ["a", "o", "a", "o", "a", "o", "e", "u"];
var nm3 = ["d", "dr", "dg", "g", "gg", "gm", "g'm", "g'th", "gr", "ggr", "lg", "lm", "lg", "lr", "lz", "m", "mg", "mr", "ml", "mz", "m'n", "m'g", "m'l", "ng", "nr", "nl", "nz", "nd", "ndr", "ngr", "n'g", "n'm", "n'th", "rl", "rn", "rv", "rz", "rg", "zg", "zn", "zl", "zm", "zr", "z'l", "z'g", "z'm"];
var nm4 = ["a", "e", "o", "u"];
var nm5 = ["d", "l", "m", "n", "nn", "r", "v", "z"];
var nm6 = ["l", "m", "n", "r", "s", "th"];
var nm7 = ["", "", "", "", "", "", "", "", "", "c", "f", "h", "l", "n", "r", "s", "th", "y"];
var nm8 = ["a", "e", "i", "o", "a", "e", "i", "a", "e", "i", "o", "a", "e", "i", "eo", "au", "ea", "ia", "io"];
var nm9 = ["h", "l", "m", "n", "r", "s", "v", "y", "z"];
var nm10 = ["a", "e", "i", "o", "a", "e", "i", "o", "a", "e", "i", "o", "a", "e", "i", "o", "a", "e", "i", "o", "ea", "ie", "ia"];
var nm11 = ["", "", "", "", "", "", "h", "l", "n", "r", "s"];
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() {
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() * nm5.length | 0;
rnd6 = Math.random() * nm4.length | 0;
rnd7 = Math.random() * nm6.length | 0;
nTp = Math.random() * 2 | 0;
while (nm3[rnd3] === nm1[rnd]) {
rnd3 = Math.random() * nm3.length | 0;
}
while (nm5[rnd5] === nm6[rnd7]) {
rnd7 = Math.random() * nm6.length | 0;
}
if (nTp === 0) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd5] + nm4[rnd6] + nm6[rnd7];
} else {
nMs = nm1[rnd] + nm2[rnd2] + nm5[rnd5] + nm4[rnd6] + nm3[rnd3] + nm4[rnd4] + nm6[rnd7];
}
testSwear(nMs);
}
function nameFem() {
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] === nm11[rnd5]) {
rnd3 = Math.random() * nm9.length | 0;
}
nTp = Math.random() * 2 | 0;
if (nTp === 0) {
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm10[rnd4] + nm11[rnd5];
} else {
rnd6 = Math.random() * nm9.length | 0;
rnd7 = Math.random() * nm10.length | 0;
while (nm9[rnd6] === nm11[rnd5] || nm9[rnd6] == nm9[rnd3]) {
rnd6 = Math.random() * nm9.length | 0;
}
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm10[rnd4] + nm9[rnd6] + nm10[rnd7] + nm11[rnd5];
}
testSwear(nMs);
}