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.

89 lines
3.5 KiB
JavaScript

var nm1 = ["c", "g", "h", "l", "m", "n", "r", "s", "v", "y", "z"];
var nm2 = ["a", "e", "i", "a", "e", "i", "o"];
var nm3 = ["f", "l", "lr", "lm", "ln", "lf", "ly", "m", "n", "nd", "ny", "nl", "ph", "r", "rl", "rn", "rs", "s", "sh", "sl", "th", "v", "z"];
var nm4 = ["a", "e", "i", "e", "a"];
var nm5 = ["f", "h", "l", "ll", "ln", "m", "n", "nn", "nd", "r", "v", "z"];
var nm6 = ["a", "i", "o"];
var nm7 = ["h", "l", "m", "n", "t", "v", "z"];
var nm8 = ["ia", "ay", "a", "e", "o", "a", "e", "o", "a", "e", "o", "i", "i"];
var nm9 = ["d", "g", "h", "l", "m", "n", "p", "r", "s", "v", "z"];
var nm10 = ["ia", "ea", "ei", "a", "o", "a", "o", "i", "a", "o", "a", "o", "i", "a", "o", "a", "o", "i", "a", "o", "a", "o", "i"];
var nm11 = ["d", "f", "g", "h", "m", "n", "r", "v", "z"];
var nm12 = ["a", "e", "o", "a", "e", "o", "i"];
var nm13 = ["c", "g", "k", "l", "m", "n", "r", "v", "z"];
var nm14 = ["e", "e", "a", "i", "o"];
var nm15 = ["h", "l", "m", "n", "r", "t", "v", "z"];
var nm16 = ["aa", "ae", "e", "o", "u", "e", "o", "u", "e", "o", "u", "i", "i", "a", "a", "a", "i"];
var nm17 = ["d", "h", "l", "n", "s", "t"];
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() * 3 | 0;
rnd = Math.random() * nm9.length | 0;
rnd2 = Math.random() * nm10.length | 0;
rnd3 = Math.random() * nm11.length | 0;
rnd4 = Math.random() * nm12.length | 0;
rnd5 = Math.random() * nm13.length | 0;
rnd6 = Math.random() * nm16.length | 0;
rnd7 = Math.random() * nm17.length | 0;
while (nm11[rnd3] === nm9[rnd] || nm11[rnd3] === nm13[rnd5]) {
rnd3 = Math.random() * nm11.length | 0;
}
if (nTp < 2) {
nMs = nm9[rnd] + nm10[rnd2] + nm11[rnd3] + nm12[rnd4] + nm13[rnd5] + nm16[rnd6] + nm17[rnd7];
} else {
rnd8 = Math.random() * nm14.length | 0;
rnd9 = Math.random() * nm15.length | 0;
nMs = nm9[rnd] + nm10[rnd2] + nm11[rnd3] + nm12[rnd4] + nm13[rnd5] + nm14[rnd8] + nm15[rnd9] + nm16[rnd6] + nm17[rnd7];
}
testSwear(nMs);
}
function nameFem() {
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() * nm5.length | 0;
rnd7 = Math.random() * nm8.length | 0;
while (nm3[rnd3] === nm1[rnd] || nm3[rnd3] === nm5[rnd5]) {
rnd3 = Math.random() * nm3.length | 0;
}
if (nTp < 2) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd5] + nm8[rnd7];
} else {
rnd6 = Math.random() * nm6.length | 0;
rnd8 = Math.random() * nm7.length | 0;
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd5] + nm6[rnd6] + nm7[rnd8] + nm8[rnd7];
}
testSwear(nMs);
}