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.

122 lines
4.9 KiB
JavaScript

var nm1 = ["", "", "", "b", "bh", "bhr", "ch", "d", "dh", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "sh", "v", "y"];
var nm2 = ["aa", "ee", "oo", "a", "a", "a", "i", "i", "o", "u", "e", "a", "a", "a", "i", "i", "o", "u", "e"];
var nm3 = ["bh", "d", "dr", "g", "h", "k", "ksh", "l", "ll", "m", "mr", "n", "nd", "ng", "nj", "nt", "r", "rj", "ry", "sh", "shw", "sr", "sw", "t", "v", "vn", "vr", "y", "z"];
var nm4 = ["a", "a", "e", "i", "o", "u"];
var nm5 = ["", "", "", "d", "l", "m", "n", "nd", "p", "r", "s", "sh", "t", "v"];
var nm6 = ["", "", "", "", "ch", "d", "dr", "j", "k", "kr", "n", "p", "pr", "r", "s", "sh", "sr", "sn", "t", "v", "z"];
var nm7 = ["aa", "ee", "a", "e", "i", "o", "a", "e", "i", "o", "u"];
var nm8 = ["dh", "dr", "g", "h", "l", "m", "mt", "n", "nd", "nw", "nt", "p", "r", "rg", "rp", "rr", "sm", "ss", "st", "t", "th", "y"];
var nm9 = ["a", "i", "a", "i", "e", "u"];
var nm10 = ["", "", "", "", "dh", "l", "ll", "ls", "m", "ms", "n", "ns", "ph", "r"];
var nm11 = ["", "", "", "", "", "b", "bh", "ch", "d", "dh", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "sh", "t", "v"];
var nm12 = ["a", "a", "e", "i", "o", "u"];
var nm13 = ["b", "ch", "d", "dh", "dr", "dw", "g", "h", "j", "k", "kr", "ksh", "ll", "m", "mb", "n", "nd", "nn", "ny", "p", "r", "rd", "rk", "sh", "sht", "t", "tt", "v"];
var nm14 = ["a", "a", "e", "i", "o", "o", "u"];
var nm15 = ["b", "ch", "d", "k", "l", "n", "r", "s", "t", "tt", "v", "y"];
var nm16 = ["a", "a", "a", "e", "i", "i", "o", "o", "u"];
var nm17 = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "d", "j", "k", "l", "n", "p", "r", "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++) {
nameSur();
while (nSr === "") {
nameSur();
}
if (tp === 1) {
nameFem();
while (nMs === "") {
nameFem();
}
} else {
nameMas();
while (nMs === "") {
nameMas();
}
}
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 nameMas() {
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;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm4[rnd5] + nm5[rnd3];
}
testSwear(nMs);
}
function nameFem() {
nTp = Math.random() * 4 | 0;
rnd = Math.random() * nm6.length | 0;
rnd2 = Math.random() * nm7.length | 0;
rnd5 = Math.random() * nm10.length | 0;
if (nTp === 0) {
while (nm6[rnd] === "") {
rnd = Math.random() * nm6.length | 0;
}
while (nm6[rnd] === nm10[rnd5] || nm10[rnd5] === "") {
rnd5 = Math.random() * nm10.length | 0;
}
nMs = nm6[rnd] + nm7[rnd2] + nm10[rnd5];
} else {
rnd3 = Math.random() * nm8.length | 0;
rnd4 = Math.random() * nm9.length | 0;
while (nm8[rnd3] === nm6[rnd] || nm8[rnd3] === nm10[rnd5]) {
rnd3 = Math.random() * nm8.length | 0;
}
nMs = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm9[rnd4] + nm10[rnd5];
}
testSwear(nMs);
}
function nameSur() {
nTp = Math.random() * 2 | 0;
rnd = Math.random() * nm11.length | 0;
rnd2 = Math.random() * nm12.length | 0;
rnd3 = Math.random() * nm17.length | 0;
rnd4 = Math.random() * nm13.length | 0;
rnd5 = Math.random() * nm14.length | 0;
while (nm13[rnd4] === nm11[rnd] || nm13[rnd4] === nm17[rnd3]) {
rnd4 = Math.random() * nm13.length | 0;
}
if (nTp === 0) {
nSr = nm11[rnd] + nm12[rnd2] + nm13[rnd4] + nm14[rnd5] + nm17[rnd3];
} else {
rnd6 = Math.random() * nm15.length | 0;
rnd7 = Math.random() * nm16.length | 0;
while (nm13[rnd4] === nm15[rnd6] || nm15[rnd6] === nm17[rnd3]) {
rnd6 = Math.random() * nm15.length | 0;
}
nSr = nm11[rnd] + nm12[rnd2] + nm13[rnd4] + nm14[rnd5] + nm15[rnd6] + nm16[rnd7] + nm17[rnd3];
}
testSwear(nSr);
}