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
3.9 KiB
JavaScript

var nm1 = ["", "", "", "c", "f", "h", "l", "m", "n", "r", "y", "z"];
var nm2 = ["a", "e", "o", "a", "e", "o", "i"];
var nm3 = ["dd", "dr", "gn", "gr", "gv", "ll", "ld", "ln", "lr", "lt", "lth", "lv", "mm", "nn", "nv", "nd", "rr", "rn", "rd", "rl", "rth", "vr", "vn", "zd", "zth"];
var nm4 = ["i", "u", "i", "u", "o", "a"];
var nm5 = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "d", "l", "n", "s", "th"];
var nm6 = ["c", "ch", "d", "f", "g", "l", "m", "n", "r", "s", "v", "z"];
var nm7 = ["a", "e", "i", "a", "e", "i", "o"];
var nm8 = ["dr", "gn", "ld", "lf", "lm", "ln", "lph", "lv", "lvr", "m", "mn", "mz", "n", "nd", "ndr", "nr", "nv", "nvr", "rdr", "rn", "rl", "rv"];
var nm9 = ["a", "i", "u", "a", "i", "u", "e"];
var nm10 = ["h", "l", "n", "r", "y", "v"];
var nm11 = ["ea", "ia", "ie", "a", "u", "a", "u", "e", "o", "a", "u", "a", "u", "a", "u", "e", "o", "a", "u"];
var nm12 = ["ds", "ln", "lm", "ls", "ndh", "nt", "ns", "sh", "th"];
var nm13 = ["", "", "", "", "b", "d", "g", "l", "m", "n", "t", "v", "z"];
var nm14 = ["a", "e", "i", "u"];
var nm15 = ["d", "g", "l", "ll", "m", "n", "nn", "r", "rr", "ss", "v", "z"];
var nm16 = ["a", "i", "o"];
var nm17 = ["d", "dd", "gn", "m", "md", "n", "nd", "nt", "r", "rr", "rl", "rn", "v", "z"];
var nm18 = ["a", "a", "a", "o", "u"];
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();
}
names = nMs;
if (tp === 1) {
genFem();
while (nMs === "") {
genFem();
}
} else {
genMas();
while (nMs === "") {
genMas();
}
}
names = nMs + " " + names;
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() {
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;
while (nm1[rnd] === nm5[rnd5]) {
rnd = Math.random() * nm1.length | 0;
}
while (nm1[rnd] === nm3[rnd3] || nm3[rnd3] === nm5[rnd5]) {
rnd3 = Math.random() * nm3.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd5];
testSwear(nMs);
}
function genFem() {
nTp = Math.random() * 6 | 0;
rnd2 = Math.random() * nm7.length | 0;
if (nTp === 0) {
rnd = Math.random() * nm12.length | 0;
nMs = nm7[rnd2] + nm12[rnd];
} else {
rnd = Math.random() * nm6.length | 0;
rnd3 = Math.random() * nm8.length | 0;
rnd4 = Math.random() * nm9.length | 0;
if (nTp < 3) {
rnd5 = Math.random() * nm10.length | 0;
rnd6 = Math.random() * nm11.length | 0;
nMs = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm9[rnd4] + nm10[rnd5] + nm11[rnd6];
} else {
nMs = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm9[rnd4];
}
}
testSwear(nMs);
}
function genSur() {
rnd = Math.random() * nm13.length | 0;
rnd2 = Math.random() * nm14.length | 0;
rnd3 = Math.random() * nm15.length | 0;
rnd4 = Math.random() * nm16.length | 0;
rnd5 = Math.random() * nm17.length | 0;
rnd6 = Math.random() * nm18.length | 0;
while (nm13[rnd] === nm15[rnd3] || nm15[rnd3] === nm17[rnd5]) {
rnd3 = Math.random() * nm15.length | 0;
}
nMs = nm13[rnd] + nm14[rnd2] + nm15[rnd3] + nm16[rnd4] + nm17[rnd5] + nm18[rnd6];
}