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.

101 lines
3.9 KiB
JavaScript

var nm1 = ["", "", "", "", "", "", "", "b", "br", "c", "ch", "d", "dr", "dw", "f", "g", "gl", "h", "j", "k", "kl", "kn", "l", "m", "n", "p", "ph", "pr", "r", "s", "sr", "st", "t", "th", "tr", "v", "w", "y", "z"];
var nm2 = ["ae", "a", "a", "e", "e", "i", "o", "o", "u", "a", "a", "e", "e", "i", "o", "o", "u"];
var nm3 = ["bl", "b", "d", "g", "ll", "lz", "ms", "n", "ndr", "r", "rj", "st", "t", "v"];
var nm4 = ["a", "a", "a", "e", "i", "o", "o", "o", "u"];
var nm5 = ["", "", "", "d", "ff", "g", "gg", "hl", "hn", "ht", "k", "kk", "l", "ll", "ls", "m", "mm", "n", "nn", "pt", "r", "rd", "rn", "rr", "s", "sh", "ss", "t", "th", "tt", "y", "z"];
var nm6 = ["", "", "", "", "", "", "", "", "", "", "", "c", "ch", "d", "f", "h", "j", "k", "l", "m", "n", "ph", "r", "s", "sh", "t", "th", "ts", "v", "vr", "z"];
var nm7 = ["a", "a", "e", "e", "i", "o", "o", "u", "y", "y"];
var nm8 = ["ch", "h", "l", "ll", "lt", "n", "nd", "ng", "nt", "r", "rl", "rr", "s", "sh"];
var nm9 = ["", "", "", "", "", "", "", "", "l", "f", "ff", "hl", "hn", "m", "n", "nn", "ns", "r", "s", "ss", "sh", "t", "th", "v", "y"];
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++) {
genSur();
while (nMs === "") {
genSur();
}
namesL = nMs;
if (tp === 1) {
genFem();
while (nMs === "") {
genFem();
}
} else {
genMas();
while (nMs === "") {
genMas();
}
}
names += "-" + namesL;
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 genSur() {
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd5 = Math.random() * nm5.length | 0;
while (nm5[rnd5] === nm1[rnd]) {
rnd5 = Math.random() * nm5.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm5[rnd5];
testSwear(nMs);
}
function genMas() {
nTp = Math.random() * 4 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd5 = Math.random() * nm5.length | 0;
if (nTp < 3) {
while (nm5[rnd5] === nm1[rnd]) {
rnd5 = Math.random() * nm5.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm5[rnd5] + nMs;
names = nm1[rnd] + nm2[rnd2] + nm5[rnd5];
} else {
rnd3 = Math.random() * nm3.length | 0;
rnd4 = Math.random() * nm4.length | 0;
while (nm3[rnd3] === nm1[rnd] || nm3[rnd3] === nm5[rnd5]) {
rnd3 = Math.random() * nm3.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd5] + nMs;
names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd5];
}
testSwear(nMs);
}
function genFem() {
nTp = Math.random() * 4 | 0;
rnd = Math.random() * nm6.length | 0;
rnd2 = Math.random() * nm7.length | 0;
rnd5 = Math.random() * nm9.length | 0;
if (nTp < 3) {
while (nm9[rnd5] === nm6[rnd]) {
rnd5 = Math.random() * nm9.length | 0;
}
nMs = nm6[rnd] + nm7[rnd2] + nm9[rnd5] + nMs;
names = nm6[rnd] + nm7[rnd2] + nm9[rnd5];
} else {
rnd3 = Math.random() * nm8.length | 0;
rnd4 = Math.random() * nm7.length | 0;
while (nm8[rnd3] === nm6[rnd] || nm8[rnd3] === nm9[rnd5]) {
rnd3 = Math.random() * nm8.length | 0;
}
nMs = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm7[rnd4] + nm9[rnd5] + nMs;
names = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm7[rnd4] + nm9[rnd5];
}
testSwear(nMs);
}