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.

135 lines
5.6 KiB
JavaScript

var nm1 = ["", "", "", "", "", "", "", "", "", "", "B", "C", "Ch", "Cl", "D", "H", "J", "K", "Kh", "Kr", "Kw", "M", "Mj", "Mkh", "Nd", "Ph", "S", "Sh", "T", "Th", "W", "Z", "B'G", "B'Ntr", "B'T", "D'", "D'K", "D'V", "G'M", "H'Ll", "H'Hr", "K'Sh", "K'T", "L'T", "M'B", "M'D", "M'G", "M'H", "M'J", "M'Sh", "M'T", "M'W", "N'B", "N'D", "N'G", "N'L", "N'J", "N'K", "N'T", "N'Y", "Q'R", "S'Y", "T'Ch", "T'D", "T'K", "T'Sh", "T'Sw", "T'W", "W'K", "W'T"];
var nm2 = ["a", "a", "a", "a", "e", "i", "o", "o", "u"];
var nm3 = ["b", "d", "h", "k", "l", "lk", "ll", "m", "mb", "mw", "n", "nd", "ndl", "ng", "ngz", "nh", "nj", "nn", "ns", "nt", "nz", "r", "s", "sh", "ss", "t", "w", "z", "zhn", "zz"];
var nm4 = ["a", "a", "a", "e", "e", "e", "i", "o", "a", "a", "a", "e", "e", "e", "i", "o", "u"];
var nm5 = ["b", "d", "j", "k", "l", "m", "n", "ng", "nt", "r", "rr", "t", "v", "z"];
var nm6 = ["", "", "", "", "", "", "", "", "", "", "", "", "h", "k", "l", "m", "n", "r"];
var nm7 = ["", "", "", "", "", "", "", "", "Ch", "J", "K", "M", "Mb", "N", "R", "Sh", "T", "Th", "Z", "C'", "C'Ch", "Ch'T", "K'M", "M'K", "M'T", "M'", "N'Y", "R'Sh"];
var nm8 = ["a", "a", "a", "a", "e", "e", "i", "i", "o", "o", "u"];
var nm9 = ["b", "d", "hn", "k", "ll", "m", "mb", "md", "mw", "n", "nd", "ndr", "nw", "nz", "r", "s", "sd", "sh", "w"];
var nm10 = ["ee", "ea", "ia", "a", "a", "a", "a", "e", "e", "i", "i", "i", "o", "o", "a", "a", "a", "a", "e", "e", "i", "i", "i", "o", "o"];
var nm11 = ["b", "d", "k", "l", "m", "n", "nd", "r", "t", "w"];
var nm12 = ["", "", "", "", "", "", "", "", "", "", "h"];
var nm13 = ["", "", "", "b", "ch", "dz", "kh", "m", "mb", "n", "t", "th", "w", "z"];
var nm14 = ["a", "a", "e", "i", "o", "u"];
var nm15 = ["b", "d", "mb", "mv", "n", "r", "s", "t", "z"];
var nm16 = ["b", "d", "k", "kh", "n", "nd", "ng", "r"];
var nm17 = ["b", "d", "m", "n", "t", "w", "z"];
function nameGen(type) {
$('#placeholder').css('textTransform', 'capitalize');
var tp = type;
var br = "";
var element = document.createElement("div");
element.setAttribute("id", "result");
for (i = 0; i < 10; i++) {
genSur();
while (nMs === "") {
genSur();
}
names = nMs;
if (tp === 1) {
genFem();
while (nMs === "") {
genFem();
}
} else {
genMas();
while (nMs === "") {
genMas();
}
}
names = nMs + " " + names;
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 genMas() {
nTp = Math.random() * 7 | 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() * nm6.length | 0;
while (nm1[rnd] === nm3[rnd3]) {
rnd3 = Math.random() * nm3.length | 0;
}
if (nTp < 5) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm6[rnd5];
} else {
rnd6 = Math.random() * nm4.length | 0;
rnd7 = Math.random() * nm5.length | 0;
while (rnd > 29) {
rnd = Math.random() * nm1.length | 0;
}
while (nm5[rnd7] === nm3[rnd3]) {
rnd7 = Math.random() * nm5.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd7] + nm4[rnd6] + nm6[rnd5];
}
testSwear(nMs);
}
function genFem() {
nTp = Math.random() * 7 | 0;
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() * nm12.length | 0;
while (nm7[rnd] === nm9[rnd3]) {
rnd3 = Math.random() * nm9.length | 0;
}
if (nTp < 5) {
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm10[rnd4] + nm12[rnd5];
} else {
rnd6 = Math.random() * nm8.length | 0;
rnd7 = Math.random() * nm11.length | 0;
while (rnd > 18) {
rnd = Math.random() * nm7.length | 0;
}
while (nm11[rnd7] === nm9[rnd3]) {
rnd7 = Math.random() * nm11.length | 0;
}
nMs = nm7[rnd] + nm8[rnd2] + nm9[rnd3] + nm8[rnd6] + nm11[rnd7] + nm10[rnd4] + nm12[rnd5];
}
testSwear(nMs);
}
function genSur() {
nTp = Math.random() * 8 | 0;
rnd = Math.random() * nm13.length | 0;
rnd2 = Math.random() * nm14.length | 0;
rnd3 = Math.random() * nm15.length | 0;
rnd4 = Math.random() * nm14.length | 0;
if (nTp < 3) {
while (nm13[rnd] === nm15[rnd3] || nm13[rnd] === "") {
rnd = Math.random() * nm13.length | 0;
}
nMs = nm13[rnd] + nm14[rnd2] + nm15[rnd3] + nm14[rnd4];
} else {
rnd5 = Math.random() * nm16.length | 0;
rnd6 = Math.random() * nm14.length | 0;
while (nm16[rnd5] === nm15[rnd3] || nm15[rnd3] === nm13[rnd]) {
rnd3 = Math.random() * nm15.length | 0;
}
if (nTp < 7) {
nMs = nm13[rnd] + nm14[rnd2] + nm15[rnd3] + nm14[rnd4] + nm16[rnd5] + nm14[rnd6];
} else {
rnd7 = Math.random() * nm17.length | 0;
rnd8 = Math.random() * nm14.length | 0;
while (nm16[rnd5] === nm17[rnd7]) {
rnd7 = Math.random() * nm17.length | 0;
}
nMs = nm13[rnd] + nm14[rnd2] + nm15[rnd3] + nm14[rnd4] + nm16[rnd5] + nm14[rnd6] + nm17[rnd7] + nm14[rnd8];
}
}
testSwear(nMs);
}