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.

120 lines
4.5 KiB
JavaScript

var nm1 = ["br", "d", "g", "k", "kr", "p", "r", "rh", "t", "th", "v", "x", "z"];
var nm2 = ["y", "i", "a", "e", "o", "a", "e", "o", "a", "e", "o"];
var nm3 = ["b", "br", "d", "dh", "dr", "g", "gl", "gr", "hr", "hn", "m", "n", "nd", "nr", "nt", "r", "rd", "rth", "t", "th", "v", "z"];
var nm4 = ["ie", "eu", "y", "a", "i", "a", "i", "a", "i", "e", "o", "a", "i", "a", "i", "e", "o", "y"];
var nm5 = ["", "k", "l", "ll", "n", "nn", "r", "rr", "s", "ss"];
var nm7 = ["", "", "", "c", "d", "h", "k", "l", "m", "n", "r", "s", "v"];
var nm8 = ["a", "e", "i", "o", "u"];
var nm9 = ["d", "dr", "dh", "hn", "hl", "hr", "l", "ln", "lr", "lm", "ld", "m", "mn", "n", "nn", "nr", "nv", "nm", "nl", "r", "rl", "rm", "rt", "s", "ss", "sl", "sn", "xx"];
var nm10 = ["a", "e", "o"];
var nm11 = ["h", "ll", "n", "nn", "r", "rr", "v", "z"];
var nm12 = ["", "", "", "", "h", "l", "n", "s"];
var nm13 = ["d", "dr", "g", "gr", "k", "kr", "l", "n", "r", "s", "v", "z"];
var nm14 = ["aa", "ae", "ie", "ea", "ee", "a", "e", "i", "u", "a", "e", "i", "u", "a", "e", "i", "u", "a", "e", "i", "u"];
var nm15 = ["b", "h", "l", "v", "z"];
var nm16 = ["l", "ld", "ll", "ln", "lt", "m", "n", "nn", "nt", "r", "rn", "t", "th", "y", "l", "ll", "m", "n", "nn", "r", "t", "th", "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();
}
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() {
nTp = Math.random() * 6 | 0;
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;
}
if (nTp < 2) {
nMs = nm1[rnd] + nm2[rnd2] + nm5[rnd5];
} else {
rnd3 = Math.random() * nm3.length | 0;
rnd4 = Math.random() * nm4.length | 0;
while (nm5[rnd5] === nm3[rnd3] || nm3[rnd3] === nm1[rnd]) {
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;
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 < 4) {
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;
}
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm10[rnd4] + nm11[rnd7] + nm10[rnd6] + nm12[rnd5];
}
testSwear(nMs);
}
function genSur() {
nTp = Math.random() * 6 | 0;
rnd = Math.random() * nm13.length | 0;
rnd2 = Math.random() * nm14.length | 0;
rnd5 = Math.random() * nm16.length | 0;
while (nm16[rnd5] === nm13[rnd]) {
rnd5 = Math.random() * nm16.length | 0;
}
if (nTp < 4) {
nMs = nm13[rnd] + nm14[rnd2] + nm16[rnd5];
} else {
rnd3 = Math.random() * nm15.length | 0;
rnd4 = Math.random() * nm14.length | 0;
while (nm16[rnd5] === nm15[rnd3] || nm15[rnd3] === nm13[rnd]) {
rnd3 = Math.random() * nm15.length | 0;
}
if (rnd2 < 5) {
while (rnd4 < 5) {
rnd4 = Math.random() * nm14.length | 0;
}
}
nMs = nm13[rnd] + nm14[rnd2] + nm15[rnd3] + nm14[rnd4] + nm16[rnd5];
}
testSwear(nMs);
}