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.

88 lines
3.3 KiB
JavaScript

var nm1 = ["", "d", "h", "r", "s", "t", "v", "z"];
var nm2 = ["ee", "a", "a", "e", "i", "i", "a", "a", "e", "i", "i", "a", "a", "e", "i", "i", "a", "a", "e", "i", "i", "a", "a", "e", "i", "i"];
var nm3 = ["k", "pl", "r", "v", "vl", "vr", "z"];
var nm4 = ["ee", "a", "a", "e", "i", "a", "a", "e", "i", "a", "a", "e", "i", "a", "a", "e", "i", "a", "a", "e", "i", "a", "a", "e", "i"];
var nm5 = ["", "l", "m", "n", "r", "s"];
var nm15 = ["", "h", "m", "h", "m", "h", "m", "mr", "n", "n", "n", "nr", "nm", "v", "v", "v", "vl", "vr", "z", "z", "z", "zl", "zr"];
var nm16 = ["a", "a", "e", "i"];
var nm17 = ["h", "l", "m", "n", "r", "s", "v", "z"];
var nm18 = ["ee", "ie", "a", "a", "i", "e", "a", "a", "i", "e", "a", "a", "i", "e", "a", "a", "i", "e", "a", "a", "i", "e", "a", "a", "i", "e", "a", "a", "i", "e"];
var nm19 = ["", "h", "l", "m", "n", "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();
}
nameFem();
while (nMs === "") {
nameFem();
}
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 nameFem() {
nTp = Math.random() * 4 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd3 = Math.random() * nm5.length | 0;
if (nTp === 0) {
while (nm1[rnd] === "") {
rnd = Math.random() * nm1.length | 0;
}
while (nm1[rnd] === nm5[rnd3] || nm5[rnd3] === "") {
rnd3 = Math.random() * nm5.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm5[rnd3];
} else {
rnd4 = Math.random() * nm3.length | 0;
rnd5 = Math.random() * nm4.length | 0;
while (nm3[rnd4] === nm1[rnd] || nm3[rnd4] === nm5[rnd3]) {
rnd4 = Math.random() * nm3.length | 0;
}
while (rnd2 === 0 && rnd5 === 0) {
rnd5 = Math.random() * nm4.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm4[rnd5] + nm5[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() * nm19.length | 0;
if (nTp < 2) {
while (nm15[rnd] === "") {
rnd = Math.random() * nm15.length | 0;
}
while (nm15[rnd] === nm19[rnd3] || nm19[rnd3] === "") {
rnd3 = Math.random() * nm19.length | 0;
}
nSr = nm15[rnd] + nm16[rnd2] + nm19[rnd3];
} else {
rnd4 = Math.random() * nm17.length | 0;
rnd5 = Math.random() * nm18.length | 0;
while (nm17[rnd4] === nm15[rnd] || nm17[rnd4] === nm19[rnd3]) {
rnd4 = Math.random() * nm17.length | 0;
}
nSr = nm15[rnd] + nm16[rnd2] + nm17[rnd4] + nm18[rnd5] + nm19[rnd3];
}
testSwear(nSr);
}