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.

123 lines
5.3 KiB
JavaScript

var nm1 = ["c", "d", "f", "h", "l", "m", "n", "r", "s", "v", "y", "z", "zh", "vh", "vr", "sh", "th", "rh", "ph", "ll", "hr", "fr", "dh", "ch"];
var nm2 = ["a", "e", "i", "o", "u", "a", "e", "a", "e", "a", "e"];
var nm3 = ["f", "m", "n", "r", "s", "v", "y", "z", "fr", "ld", "ll", "ln", "lm", "lr", "lv", "mm", "nn", "nv", "nr", "nd", "rl", "rh", "rv", "rd", "ss", "sh", "vr", "vl", "zl"];
var nm4 = ["tjn", "jrn", "rjn", "jld", "jrd", "jrs", "jrt", "jnt", "jnd", "jlt", "rjd", "ljn", "ljd"];
var nm5 = ["l", "ll", "n", "ph", "r", "s", "sh", "th", "v", "z"];
var nm6 = ["l", "n", "s", "r", "v", "z"];
var nm7 = ["e", "a", "i", "a"];
var nm8 = ["", "", "", "b", "bj", "d", "f", "fr", "g", "gj", "h", "k", "kn", "l", "m", "n", "r", "s", "sv", "t", "th", "v"];
var nm9 = ["a", "e", "i", "o", "o", "u"];
var nm10 = ["d", "dg", "dv", "g", "gn", "k", "l", "ld", "lg", "ll", "lm", "lt", "lv", "m", "n", "nn", "r", "rf", "rn", "rr", "rs", "ss", "v"];
var nm11 = ["a", "a", "e", "i", "i", "o"];
var nm12 = ["d", "g", "l", "ld", "lf", "m", "n", "nd", "r"];
var nm13 = ["a", "a", "e", "i", "i", "o", "ia", "ai"];
var nm14 = ["", "f", "fn", "l", "lf", "ls", "m", "n", "ns", "nt", "r", "rg", "rn", "rr", "s", "t"];
var nm15 = ["Atoel", "Bysnoe", "Camoa", "Dei-Ijla", "Eryut", "Fyth", "Golmarr", "Hyskaris", "Iryut", "Muscadet"];
var nm16 = ["Arda", "Bosco", "Gucuma", "Kisne", "Lesrekta", "Muruc", "Paharo", "Roda", "Tehp", "Ymir"];
var nm17 = ["Alf", "Isaf", "Tors", "Tin", "Ak", "Aku", "Bi", "Blon", "Dal", "Grim", "Ho", "Hol", "Husa", "Haf", "Hof", "Hri", "Hraf", "Hua", "Hvan", "Inn", "Kopa", "Lons", "Lit", "Nja", "Reyk", "Sol", "Sand", "Sel", "Stok", "Stuk", "Sval", "Vest"];
var nm18 = ["vik", "hofn", "nes", "rost", "duos", "nesi", "nes", "lid", "holt", "snes", "baer", "tir", "tur", "sey", "nir", "sos", "nes", "sker", "ras", "vatn", "hofn", "holt", "vik", "foss"];
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++) {
if (tp === 1) {
nameMas();
while (nMs === "") {
nameMas();
}
} else {
nameFem();
while (nMs === "") {
nameFem();
}
}
if (i < 2) {
rnd = Math.random() * nm15.length | 0;
nMs = nMs + " " + nm15[rnd];
} else if (i < 4) {
rnd = Math.random() * nm16.length | 0;
nMs = nMs + " " + nm16[rnd];
} else {
rnd = Math.random() * nm17.length | 0;
rnd2 = Math.random() * nm18.length | 0;
nMs = nMs + " " + nm17[rnd] + nm18[rnd2];
}
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() * 6 | 0;
rnd = Math.random() * nm8.length | 0;
rnd2 = Math.random() * nm13.length | 0;
rnd3 = Math.random() * nm14.length | 0;
if (nTp === 0) {
while (nm14[rnd3] === "") {
rnd3 = Math.random() * nm14.length | 0;
}
while (nm8[rnd] === "" || nm8[rnd] === nm14[rnd3]) {
rnd = Math.random() * nm8.length | 0;
}
nMs = nm8[rnd] + nm13[rnd2] + nm14[rnd3];
} else {
rnd4 = Math.random() * nm10.length | 0;
rnd5 = Math.random() * nm9.length | 0;
if (nTp < 4) {
nMs = nm8[rnd] + nm9[rnd5] + nm10[rnd4] + nm13[rnd2] + nm14[rnd3];
} else {
rnd6 = Math.random() * nm12.length | 0;
rnd7 = Math.random() * nm11.length | 0;
nMs = nm8[rnd] + nm9[rnd5] + nm10[rnd4] + nm11[rnd7] + nm12[rnd6] + nm13[rnd2] + nm14[rnd3];
}
}
testSwear(nMs);
}
function nameFem() {
nTp = Math.random() * 6 | 0;
rnd = Math.random() * nm1.length | 0;
if (nTp === 0) {
while (rnd > 11) {
rnd = Math.random() * nm1.length | 0;
}
rnd2 = Math.random() * nm4.length | 0;
nMs = nm1[rnd] + nm4[rnd2];
} else if (nTp < 3) {
rnd2 = Math.random() * nm2.length | 0;
rnd3 = Math.random() * nm3.length | 0;
rnd4 = Math.random() * nm2.length | 0;
rnd5 = Math.random() * nm6.length | 0;
if (nTp === 1) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4] + nm6[rnd5];
} else {
rnd6 = Math.random() * nm5.length | 0;
rnd7 = Math.random() * nm2.length | 0;
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4] + nm5[rnd6] + nm2[rnd7] + nm6[rnd5];
}
} else {
rnd2 = Math.random() * nm2.length | 0;
if (rnd < 12) {
rnd3 = Math.random() * nm3.length | 0;
rnd4 = Math.random() * nm2.length | 0;
while (nm3 > 7) {
rnd3 = Math.random() * nm3.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4];
} else {
rnd3 = Math.random() * nm6.length | 0;
nMs = nm1[rnd] + nm2[rnd2] + nm6[rnd3];
}
}
testSwear(nMs);
}