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.

100 lines
3.7 KiB
JavaScript

var nm1 = ["", "", "b", "d", "j", "h", "m", "n", "r", "th", "v", "z"];
var nm2 = ["a", "e", "o", "a", "e", "o", "u"];
var nm3 = ["d", "dd", "g", "gl", "j", "kl", "l", "ld", "lr", "lv", "ll", "m", "mr", "n", "nn", "nd", "nl", "nv", "nz", "r", "rr", "rl", "rd", "rc", "rv", "v", "vr", "vl", "z", "zl", "zr"];
var nm4 = ["uu", "aa", "a", "e", "i", "u", "a", "e", "i", "u", "o", "a", "e", "i", "u", "o"];
var nm5 = ["n", "l", "r", "v", "z"];
var nm6 = ["", "", "", "", "c", "d", "k", "m", "n", "s", "x"];
var nm7 = ["", "", "", "", "f", "h", "l", "m", "n", "s", "t", "th", "v", "y", "z"];
var nm8 = ["ei", "ae", "aa", "a", "e", "i", "a", "e", "i", "a", "e", "i", "a", "e", "i", "o"];
var nm9 = ["d", "dh", "g", "gn", "l", "lk", "ld", "ln", "lth", "r", "rl", "rk", "ry", "t", "tr", "tl", "th", "thr"];
var nm10 = ["ea", "ee", "ie", "ei", "a", "i", "a", "i", "e", "a", "i", "a", "i", "e", "o"];
var nm11 = ["", "", "", "", "", "h"];
var nm12 = ["f", "h", "j", "m", "n", "r", "t", "v", "y", "z"];
var nm13 = ["a", "e", "a", "e", "i", "o", "u"];
var nm14 = ["d", "dh", "hn", "hl", "ht", "l", "ll", "m", "mn", "n", "nn", "y", "s", "sh", "ss", "t", "tt", "th"];
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++) {
nameSur();
while (nSr === "") {
nameSur();
}
if (tp === 1) {
nameFem();
while (nMs === "") {
nameFem();
}
} else {
nameMas();
while (nMs === "") {
nameMas();
}
}
names = nMs + " " + nSr;
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 nameMas() {
nTp = Math.random() * 3 | 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() * nm6.length | 0;
while (nm1[rnd] === nm3[rnd3] || nm3[rnd3] === nm6[rnd5]) {
rnd3 = Math.random() * nm3.length | 0;
}
if (nTp < 2) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm6[rnd5];
} else {
rnd6 = Math.random() * nm5.length | 0;
rnd7 = Math.random() * nm2.length | 0;
while (nm3[rnd4] === nm5[rnd6] || nm5[rnd6] === nm6[rnd5]) {
rnd6 = Math.random() * nm5.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd6] + nm2[rnd7] + nm6[rnd5];
}
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 (nm7[rnd] === nm9[rnd3] || nm9[rnd3] === nm11[rnd5]) {
rnd3 = Math.random() * nm9.length | 0;
}
if (rnd2 < 3) {
while (rnd4 < 4) {
rnd4 = Math.random() * nm10.length | 0;
}
}
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm10[rnd4] + nm11[rnd5];
testSwear(nMs);
}
function nameSur() {
rnd = Math.random() * nm12.length | 0;
rnd2 = Math.random() * nm13.length | 0;
rnd3 = Math.random() * nm14.length | 0;
while (nm12[rnd] === nm14[rnd3]) {
rnd3 = Math.random() * nm14.length | 0;
}
nSr = nm12[rnd] + nm13[rnd2] + nm14[rnd3];
testSwear(nSr);
}