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.

96 lines
3.7 KiB
JavaScript

var nm1 = ["", "", "b", "d", "f", "g", "h", "j", "k", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "z", "b", "br", "d", "dr", "f", "g", "h", "j", "k", "k", "kl", "kn", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "z"];
var nm2 = ["a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "y"];
var nm3 = ["", "", "", "b", "g", "k", "l", "ll", "l", "ll", "m", "n", "nn", "g", "h", "k", "l", "ll", "m", "n", "nn", "q", "r", "rn", "s", "v", "x", "z"];
var nm4 = ["", "b", "d", "g", "j", "k", "l", "m", "n", "r", "t", "v", "z"];
var nm5 = ["", "", "d", "g", "k", "l", "ll", "l", "ll", "m", "n", "nth", "r", "s", "sk", "th", "x", "z"];
var nm6 = ["", "", "", "d", "f", "j", "k", "l", "m", "n", "r", "s", "sh", "t", "th", "v", "w", "z"];
var nm7 = ["u", "y", "ao", "oa", "a", "e", "i", "o", "a", "e", "i", "o", "a", "e", "i", "o", "a", "e", "i", "o"];
var nm8 = ["d", "l", "ll", "m", "n", "nn", "r", "v", "z", "dn", "dr", "hl", "hn", "ld", "lr", "ls", "lr", "lg", "nd", "rst", "sh", "sl", "str", "th"];
var nm9 = ["l", "n", "r", "s"];
var nm10 = ["a", "i", "a", "i", "a", "i", "a", "a", "a", "a", "a", "ia", "ya"];
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++) {
genMas();
while (nMs === "") {
genMas();
}
if (tp === 1) {
genFem();
while (nMs === "") {
genFem();
}
names = nMs + " " + namesB;
}
br = document.createElement('br');
element.appendChild(document.createTextNode(names));
element.appendChild(br);
}
if (document.getElementById("result")) {
document.getElementById("placeholder").removeChild(document.getElementById("result"));
}
document.getElementById("placeholder").appendChild(element);
}
function genMas() {
nTp = Math.random() * 6 | 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() * nm2.length | 0;
rnd6 = Math.random() * nm5.length | 0;
while (nm1[rnd] === nm3[rnd3] || nm1[rnd] === nm4[rnd4]) {
rnd = Math.random() * nm1.length | 0;
}
while (nm4[rnd4] === nm5[rnd6]) {
rnd6 = Math.random() * nm5.length | 0;
}
if (nTp === 0) {
if (nm3[rnd3] != "" && nm4[rnd4] != "") {
rnd3 = 0;
}
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm2[rnd5] + nm5[rnd6];
names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + "-" + nm4[rnd4] + nm2[rnd5] + nm5[rnd6];
namesB = names;
if (nTp === 0) {
names = nMs;
namesB = nMs;
}
testSwear(nMs);
}
function genFem() {
nTp = Math.random() * 6 | 0;
rnd = Math.random() * nm6.length | 0;
rnd2 = Math.random() * nm7.length | 0;
rnd4 = Math.random() * nm9.length | 0;
if (nTp === 0) {
while (nm6[rnd] === "") {
rnd = Math.random() * nm6.length | 0;
}
nMs = nm6[rnd] + nm7[rnd2] + nm9[rnd4];
} else {
rnd3 = Math.random() * nm8.length | 0;
rnd5 = Math.random() * nm10.length | 0;
if (nTp < 4) {
nMs = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm10[rnd5];
} else {
rnd6 = Math.random() * nm7.length | 0;
if (rnd2 < 4) {
while (rnd6 < 4) {
rnd6 = Math.random() * nm7.length | 0;
}
}
nMs = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm7[rnd6] + nm9[rnd4] + nm10[rnd5];
}
}
testSwear(nMs);
}