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.

107 lines
4.2 KiB
JavaScript

var nm1 = ["", "", "", "b", "bh", "d", "dh", "h", "k", "kh", "kr", "ks", "m", "n", "p", "pr", "r", "s", "sh", "t", "v", "y"];
var nm2 = ["a", "a", "e", "e", "i", "o", "u", "u"];
var nm3 = ["bh", "d", "h", "j", "l", "m", "n", "nd", "nt", "nz", "rb", "rbh", "rh", "sn", "sr", "t", "th"];
var nm4 = ["a", "e", "e", "i", "i", "o", "u"];
var nm5 = ["", "", "", "", "j", "m", "n", "nt", "s", "t"];
var nm8 = ["", "", "", "", "c", "d", "dh", "g", "h", "k", "kh", "l", "m", "n", "p", "pr", "r", "s", "sh", "v", "y"];
var nm9 = ["a", "a", "a", "e", "e", "i", "i", "i", "o", "u", "u"];
var nm10 = ["bh", "bj", "d", "dj", "h", "j", "l", "m", "mr", "ms", "n", "nd", "p", "pt", "r", "ry", "s", "sh", "t", "v"];
var nm11 = ["a", "a", "i", "o", "u"];
var nm12 = ["d", "j", "l", "m", "n", "nd", "nt", "t", "tr"];
var nm13 = ["a", "a", "a", "e", "i", "u"];
var nm14 = ["", "", "", "", "", "", "", "", "", "h", "j", "sh"];
var nm15 = ["", "", "b", "d", "dh", "gh", "k", "kh", "m", "n", "r", "s", "sh", "t", "v", "y"];
var nm16 = ["a", "a", "e", "i", "o", "a", "a", "e", "i", "o", "u"];
var nm17 = ["br", "d", "dj", "dr", "f", "h", "j", "l", "m", "mr", "n", "nd", "nr", "pt", "r", "s", "sh", "sr", "t", "th", "tr"];
var nm18 = ["a", "a", "e", "i", "i", "u"];
var nm19 = ["", "", "", "", "d", "h", "j", "l", "m", "n", "n", "t", "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 (nMs === "") {
nameSur();
}
names = nMs;
if (tp === 1) {
nameFem();
while (nMs === "") {
nameFem();
}
} else {
nameMas();
while (nMs === "") {
nameMas();
}
}
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 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;
while ("" === nm1[rnd] && "" === nm5[rnd5]) {
rnd = Math.random() * nm1.length | 0;
}
while (nm3[rnd3] === nm1[rnd] || nm3[rnd3] === nm5[rnd5]) {
rnd3 = Math.random() * nm3.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd5];
testSwear(nMs);
}
function nameFem() {
nTp = Math.random() * 5 | 0;
rnd = Math.random() * nm8.length | 0;
rnd2 = Math.random() * nm9.length | 0;
rnd3 = Math.random() * nm10.length | 0;
rnd4 = Math.random() * nm13.length | 0;
rnd5 = Math.random() * nm14.length | 0;
while (nm10[rnd3] === nm8[rnd] || nm10[rnd3] === nm14[rnd5]) {
rnd3 = Math.random() * nm10.length | 0;
}
if (nTp < 4) {
nMs = nm8[rnd] + nm9[rnd2] + nm10[rnd3] + nm13[rnd4] + nm14[rnd5];
} else {
rnd6 = Math.random() * nm11.length | 0;
rnd7 = Math.random() * nm12.length | 0;
while (nm10[rnd3] === nm12[rnd7] || nm12[rnd7] === nm14[rnd5]) {
rnd7 = Math.random() * nm12.length | 0;
}
nMs = nm8[rnd] + nm9[rnd2] + nm10[rnd3] + nm11[rnd6] + nm12[rnd7] + nm13[rnd4] + nm14[rnd5];
}
testSwear(nMs);
}
function nameSur() {
rnd = Math.random() * nm15.length | 0;
rnd2 = Math.random() * nm16.length | 0;
rnd3 = Math.random() * nm17.length | 0;
rnd4 = Math.random() * nm18.length | 0;
rnd5 = Math.random() * nm19.length | 0;
while ("" === nm15[rnd] && "" === nm19[rnd5]) {
rnd = Math.random() * nm15.length | 0;
}
while (nm17[rnd3] === nm15[rnd] || nm17[rnd3] === nm19[rnd5]) {
rnd3 = Math.random() * nm17.length | 0;
}
nMs = nm15[rnd] + nm16[rnd2] + nm17[rnd3] + nm18[rnd4] + nm19[rnd5];
testSwear(nMs);
}