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.

93 lines
3.5 KiB
JavaScript

var nm1 = ["", "", "b", "d", "h", "hr", "k", "r", "v", "w", "z"];
var nm2 = ["y", "a", "o", "u", "a", "o", "u", "a", "o", "u"];
var nm3 = ["l", "ll", "l", "ll", "lm", "ln", "lr", "m", "m", "mbr", "n", "n", "ndr", "nr", "r", "r", "rl", "rr"];
var nm4 = ["a", "a", "o", "u"];
var nm5 = ["d", "g", "l", "m", "n", "r"];
var nm6 = ["io", "iu", "ia", "y", "y", "a", "o", "u", "a", "o", "u", "a", "o", "u", "a", "o", "u", "a", "o", "u", "a", "o", "u", "a", "o", "u", "a", "o", "u"];
var nm7 = ["", "", "", "g", "l", "m", "mb", "nt", "s", "t"];
var nm15 = ["b", "br", "d", "dr", "h", "l", "m", "n", "t", "tr", "v", "z"];
var nm16 = ["ee", "eo", "a", "e", "a", "e", "a", "e", "a", "e", "a", "e", "i", "o", "u"];
var nm17 = ["b", "bl", "br", "d", "dr", "m", "mb", "n", "nt", "sk", "rb", "rm", "rn", "t", "tr", "v", "w", "z"];
var nm18 = ["a", "o", "a", "o", "a", "o", "e"];
var nm21 = ["", "", "l", "m", "n", "r", "rr", "s"];
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();
}
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() * 7 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd3 = Math.random() * nm7.length | 0;
if (nTp < 4) {
while (nm1[rnd] === "") {
rnd = Math.random() * nm1.length | 0;
}
while (nm1[rnd] === nm7[rnd3] || nm7[rnd3] === "") {
rnd3 = Math.random() * nm7.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm7[rnd3];
} else {
rnd4 = Math.random() * nm3.length | 0;
rnd5 = Math.random() * nm4.length | 0;
while (nm3[rnd4] === nm1[rnd] || nm3[rnd4] === nm7[rnd3]) {
rnd4 = Math.random() * nm3.length | 0;
}
if (nTp < 6) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm4[rnd5] + nm7[rnd3];
} else {
rnd6 = Math.random() * nm5.length | 0;
rnd7 = Math.random() * nm6.length | 0;
while (nm3[rnd4] === nm5[rnd6] || nm5[rnd6] === nm7[rnd3]) {
rnd6 = Math.random() * nm5.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm4[rnd5] + nm5[rnd6] + nm6[rnd7] + nm7[rnd3];
}
}
testSwear(nMs);
}
function nameSur() {
nTp = Math.random() * 6 | 0;
rnd = Math.random() * nm15.length | 0;
rnd2 = Math.random() * nm16.length | 0;
rnd3 = Math.random() * nm21.length | 0;
if (nTp === 0) {
while (nm15[rnd] === "" || nm15[rnd] === nm21[rnd3]) {
rnd = Math.random() * nm15.length | 0;
}
nSr = nm15[rnd] + nm16[rnd2] + nm21[rnd3];
} else {
rnd4 = Math.random() * nm17.length | 0;
rnd5 = Math.random() * nm18.length | 0;
while (nm17[rnd4] === nm15[rnd] || nm17[rnd4] === nm21[rnd3]) {
rnd4 = Math.random() * nm17.length | 0;
}
nSr = nm15[rnd] + nm16[rnd2] + nm17[rnd4] + nm18[rnd5] + nm21[rnd3];
}
testSwear(nSr);
}