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.

106 lines
4.3 KiB
JavaScript

var nm1 = ["b", "br", "d", "g", "gr", "k", "m", "n", "ph", "s", "r", "rh", "v", "z"];
var nm2 = ["a", "i", "a", "i", "e", "a", "i", "a", "i", "e", "a", "i", "a", "i", "e", "au", "ou", "ae"];
var nm3 = ["d", "g", "l", "m", "n", "r", "s", "t", "v", "z", "dr", "ld", "lr", "lth", "nd", "nr", "ph", "rn", "rl", "sr", "sl", "tr"];
var nm4 = ["a", "o", "u", "a", "e", "i", "a", "o"];
var nm5 = ["d", "g", "l", "m", "n", "r", "v", "y", "z"];
var nm6 = ["a", "i", "o"];
var nm7 = ["k", "m", "n", "r", "v", "z"];
var nm8 = ["a", "o", "u", "a", "o", "i"];
var nm9 = ["d", "dr", "g", "gr", "k", "kr", "m", "n", "r", "t", "v", "vr", "z"];
var nm10 = ["a", "a", "o", "u", "e", "i", "a"];
var nm11 = ["", "", "d", "l", "m", "n", "r", "s", "t"];
var nm12 = ["c", "h", "l", "m", "n", "ph", "s", "sh", "th", "v", "y", "z"];
var nm13 = ["a", "e", "i", "a", "e", "i", "o"];
var nm14 = ["f", "h", "l", "m", "n", "r", "s", "v", "z"];
var nm15 = ["a", "e", "o", "u", "o", "a", "e", "o"];
var nm16 = ["d", "k", "l", "m", "n", "v", "y", "z"];
var nm17 = ["a", "o", "u", "a", "o", "i", "e", "a", "e", "o"];
var nm18 = ["f", "h", "m", "n", "s", "t", "v", "y", "z"];
var nm19 = ["a", "e", "i", "e"];
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++) {
if (tp === 1) {
nameFem();
while (nMs === "") {
nameFem();
}
} else {
nameMas();
while (nMs === "") {
nameMas();
}
}
br = document.createElement('br');
element.appendChild(document.createTextNode(nMs));
element.appendChild(br);
}
if (document.getElementById("result")) {
document.getElementById("placeholder").removeChild(document.getElementById("result"));
}
document.getElementById("placeholder").appendChild(element);
}
function nameMas() {
nTp = Math.random() * 6 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd3 = Math.random() * nm3.length | 0;
rnd4 = Math.random() * nm10.length | 0;
rnd5 = Math.random() * nm11.length | 0;
while (nm3[rnd3] === nm1[rnd] || nm3[rnd3] === nm11[rnd5]) {
rnd3 = Math.random() * nm3.length | 0;
}
if (nTp < 3) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm10[rnd4] + nm11[rnd5];
} else {
rnd6 = Math.random() * nm4.length | 0;
rnd7 = Math.random() * nm5.length | 0;
while (nm5[rnd7] === nm3[rnd3] || nm5[rnd7] === nm11[rnd5]) {
rnd7 = Math.random() * nm5.length | 0;
}
if (nTp === 3) {
rnd8 = Math.random() * nm6.length | 0;
rnd9 = Math.random() * nm7.length | 0;
rnd10 = Math.random() * nm8.length | 0;
rnd11 = Math.random() * nm9.length | 0;
while (nm9[rnd11] === nm7[rnd9] || nm9[rnd11] === nm11[rnd5]) {
rnd11 = Math.random() * nm9.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd6] + nm5[rnd7] + nm6[rnd8] + nm7[rnd9] + nm8[rnd10] + nm9[rnd11] + nm10[rnd4] + nm11[rnd5];
} else {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd6] + nm5[rnd7] + nm10[rnd4] + nm11[rnd5];
}
}
testSwear(nMs);
}
function nameFem() {
nTp = Math.random() * 2 | 0;
rnd = Math.random() * nm12.length | 0;
rnd2 = Math.random() * nm13.length | 0;
rnd3 = Math.random() * nm14.length | 0;
rnd4 = Math.random() * nm17.length | 0;
rnd5 = Math.random() * nm18.length | 0;
rnd6 = Math.random() * nm19.length | 0;
while (nm14[rnd3] === nm12[rnd] || nm14[rnd3] === nm18[rnd5]) {
rnd3 = Math.random() * nm14.length | 0;
}
if (nTp === 0) {
rnd7 = Math.random() * nm15.length | 0;
rnd8 = Math.random() * nm16.length | 0;
while (nm16[rnd8] === nm14[rnd3] || nm16[rnd8] === nm18[rnd5]) {
rnd8 = Math.random() * nm16.length | 0;
}
nMs = nm12[rnd] + nm13[rnd2] + nm14[rnd3] + nm15[rnd7] + nm16[rnd8] + nm17[rnd4] + nm18[rnd5] + nm19[rnd6];
} else {
nMs = nm12[rnd] + nm13[rnd2] + nm14[rnd3] + nm17[rnd4] + nm18[rnd5] + nm19[rnd6];
}
testSwear(nMs);
}