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.

129 lines
4.8 KiB
JavaScript

var nm1 = ["b'", "b'r", "d'", "d'r", "g'", "h'r", "j'", "m'", "s'tr", "t'", "t'r", "z'", "z'kr", "", "", "b", "d", "h", "j", "m", "n", "r", "s", "t"];
var nm2 = ["a'e", "a'a", "a", "e", "i", "o", "y", "a", "e", "i", "o", "y", "a", "e", "i", "o", "y"];
var nm3 = ["h'n", "h'l", "h'k", "k'", "'k", "l'", "l'n", "l'm", "'m", "c", "d", "k", "l", "ll", "m", "mm", "mn", "n", "nd", "nm", "ns"];
var nm4 = ["a", "e", "o", "a", "e", "o", "i"];
var nm5 = ["d", "dd", "k", "l", "ll", "n", "nn", "r", "rr", "rnn", "tt", "zz"];
var nm6 = ["b'l", "d'k", "d'h", "j'", "k'h", "m'g", "m'r", "m'", "n'", "n'l", "s'l", "b", "c", "d", "h", "j", "m", "n", "sh", "v"];
var nm7 = ["a", "e", "y", "a", "e", "y", "i", "o"];
var nm8 = ["y'", "'d", "r'y", "h'n", "r'h", "'l", "l'n", "l'm", "m'n", "n'", "r'", "r'l", "r'g", "s't", "'sh", "l", "m", "mn", "n", "ng", "r", "rl", "s", "sh", "ss"];
var nm9 = ["i'a", "i'o", "e'a", "ee", "a", "a", "e", "o", "a", "a", "e", "o", "a", "a", "e", "o", "a", "a", "e", "o"];
var nm10 = ["h", "l", "ll", "n", "nn", "s", "sh"];
var nm11 = ["", "", "", "", "d'r", "d'", "d'l", "h'l", "h'", "h'r", "g'r", "g'", "j'", "m'", "m'l", "n'", "n'd", "n'r", "s'", "sh'", "s'tr", "t'h", "t'l", "t'r", "z'kr"];
var nm12 = ["a", "o", "a", "o", "a", "o", "e", "i", "a", "o", "a", "o", "a", "o", "e", "i"];
var nm13 = ["d", "dd", "dr", "gh", "hn", "hr", "k", "l", "ld", "lm", "ln", "m", "mn", "n", "nn", "nd", "nk", "r", "rd", "rg", "rk", "rl"];
var nm14 = ["o", "u", "o", "u", "a", "e", "i"];
var nm15 = ["c", "kk", "m", "mm", "mzz", "nd", "nss", "nn", "nzz", "s", "ss", "zz"];
var nm16 = ["c", "m", "nd", "nn", "s", "ss", "zz"];
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++) {
if (tp === 1) {
genFem();
while (nMs === "") {
genFem();
}
} else {
genMas();
while (nMs === "") {
genMas();
}
}
names = nMs;
genSur();
while (nMs === "") {
genSur();
}
names = names + " " + nMs;
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() * 2 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd6 = Math.random() * nm5.length | 0;
if (rnd < 13 && rnd2 < 2) {
rnd2 += 2;
}
if (nTp === 0) {
while (nm1[rnd] === "") {
rnd = Math.random() * nm1.length | 0;
if (rnd < 13 && rnd2 < 2) {
rnd2 += 2;
}
}
nMs = nm1[rnd] + nm2[rnd2] + nm5[rnd6];
} else {
rnd3 = Math.random() * nm3.length | 0;
if (rnd < 13 || rnd2 < 2) {
while (rnd3 < 8) {
rnd3 = Math.random() * nm3.length | 0;
}
}
rnd4 = Math.random() * nm4.length | 0;
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd6];
}
testSwear(nMs);
}
function genFem() {
nTp = Math.random() * 2 | 0;
rnd = Math.random() * nm6.length | 0;
rnd2 = Math.random() * nm7.length | 0;
rnd6 = Math.random() * nm10.length | 0;
if (nTp === 0) {
nMs = nm6[rnd] + nm7[rnd2] + nm10[rnd6];
} else {
rnd3 = Math.random() * nm8.length | 0;
rnd4 = Math.random() * nm9.length | 0;
if (rnd < 11) {
if (rnd4 < 3) {
rnd4 += 4;
}
}
if (rnd < 11 || rnd4 < 3) {
while (rnd3 < 15) {
rnd3 = Math.random() * nm8.length | 0;
}
}
nMs = nm6[rnd] + nm7[rnd2] + nm8[rnd3] + nm9[rnd4] + nm10[rnd6];
}
testSwear(nMs);
}
function genSur() {
nTp = Math.random() * 2 | 0;
rnd = Math.random() * nm11.length | 0;
rnd2 = Math.random() * nm14.length | 0;
if (nTp === 0) {
rnd6 = Math.random() * nm15.length | 0;
while (rnd < 4) {
rnd = Math.random() * nm11.length | 0;
}
nMs = nm11[rnd] + nm14[rnd2] + nm15[rnd6];
} else {
rnd3 = Math.random() * nm13.length | 0;
rnd4 = Math.random() * nm12.length | 0;
rnd6 = Math.random() * nm16.length | 0;
if (rnd2 < 3) {
while (rnd3 < 15) {
rnd3 = Math.random() * nm13.length | 0;
}
}
nMs = nm11[rnd] + nm14[rnd2] + nm13[rnd3] + nm12[rnd4] + nm16[rnd6];
}
testSwear(nMs);
}