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.

69 lines
2.5 KiB
JavaScript

var nm1 = ["a", "e", "i", "e", "", "", "", ""];
var nm2 = ["d", "g", "h", "k", "l", "m", "n", "q", "r", "v", "z"];
var nm3 = ["a", "a", "e", "o"];
var nm4 = ["b", "br", "d", "dr", "g", "gr", "ld", "lg", "lk", "k", "kr", "n", "nd", "nk", "nv", "nz", "v", "vr", "z"];
var nm5 = ["a", "i", "o", "a", "i", "o", "a", "i", "o", "ia", "io"];
var nm6 = ["c", "d", "g", "k", "n", "q", "", "", ""];
var nm7 = ["", "", "", "c", "f", "h", "m", "n", "q", "v", "z"];
var nm8 = ["au", "a", "o", "a", "o", "e"];
var nm9 = ["d", "h", "l", "ll", "lm", "lv", "n", "q", "r", "rl", "v", "y", "z"];
var nm10 = ["ue", "i", "o", "i", "o", "a", "e"];
var nm11 = ["h", "l", "n", "r", "sh", "y"];
var nm12 = ["a", "e", "a", "e", "i", "o", "ile", "ine"];
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() {
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;
rnd6 = Math.random() * nm6.length | 0;
while (nm2[rnd2] === nm4[rnd4] || nm4[rnd4] === nm6[rnd6]) {
rnd4 = Math.random() * nm4.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd5] + nm6[rnd6];
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;
rnd6 = Math.random() * nm12.length | 0;
while (nm7[rnd] === nm9[rnd3] || nm9[rnd3] === nm11[rnd5]) {
rnd3 = Math.random() * nm9.length | 0;
}
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm10[rnd4] + nm11[rnd5] + nm12[rnd6];
testSwear(nMs);
}