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.

57 lines
2.3 KiB
JavaScript

var nm1 = ["", "", "", "b", "d", "f", "g", "h", "k", "pr", "s", "t", "tr", "v", "z"];
var nm2 = ["y", "a", "e", "i", "o", "u"];
var nm3 = ["l", "m", "n", "r", "t", "v", "l", "m", "n", "r", "t", "v", "br", "dr", "ld", "lg", "mr", "nd", "nr", "rd", "st", "str", "tr"];
var nm4 = ["a", "a", "e", "e", "i", "o", "u"];
var nm5 = ["g", "k", "l", "m", "n", "r", "t", "v"];
var nm6 = ["ia", "ea", "io", "ie", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u"];
var nm7 = ["", "", "", "", "", "", "", "l", "n", "r", "s", "sh", "v"];
var nm8 = ["1", "2", "2", "2", "3", "3", "3", "4", "4", "4", "5", "6", "7", "8"];
var br = "";
function nameGen() {
$('#placeholder').css('textTransform', 'capitalize');
var element = document.createElement("div");
element.setAttribute("id", "result");
for (i = 0; i < 10; i++) {
nameMas();
while (nMs === "") {
nameMas();
}
nTp = Math.random() * 4 | 0;
if (nTp === 0) {
rnd = Math.random() * nm8.length | 0;
nMs += "-" + nm8[rnd];
}
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() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd3 = Math.random() * nm3.length | 0;
rnd4 = Math.random() * nm4.length | 0;
rnd7 = Math.random() * nm7.length | 0;
while (nm3[rnd3] === nm1[rnd] || nm3[rnd3] === nm7[rnd7]) {
rnd3 = Math.random() * nm3.length | 0;
}
if (nTp < 2) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm7[rnd7];
} else {
rnd5 = Math.random() * nm5.length | 0;
rnd6 = Math.random() * nm6.length | 0;
while (nm3[rnd3] === nm5[rnd5] || nm5[rnd5] === nm7[rnd7]) {
rnd5 = Math.random() * nm5.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd5] + nm6[rnd6] + nm7[rnd7];
}
testSwear(nMs);
}