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.

72 lines
2.8 KiB
JavaScript

var nm1 = ["bh", "ch", "h", "j", "l", "m", "q", "sh", "w", "x", "z"];
var nm2 = ["a", "i", "u", "a", "i", "u", "a", "i", "u", "e", "o"];
var nm3 = ["ch", "d", "dh", "l", "ln", "nt", "nd", "r", "rt", "rn", "rs", "s", "sh", "ss", "sz", "z", "zz", "zh"];
var nm4 = ["", "", "", "h", "n", "ng", "n", "ng"];
var nm5 = ["d", "g", "h", "k", "n", "r", "t", "z"];
var nm6 = ["a", "e", "i", "o", "u", "a", "i", "o", "u"];
var nm7 = ["ch", "d", "k", "n", "s", "r", "t", "y", "z"];
var nm8 = ["Island", "Village"];
var nm9 = ["North", "South", "East", "West"];
var nm10 = ["-", " "];
function nameGen() {
$('#placeholder').css('textTransform', 'capitalize');
var br = "";
var element = document.createElement("div");
element.setAttribute("id", "result");
for (i = 0; i < 10; i++) {
nameMas()
while (nMs === "") {
nameMas();
}
nTp = Math.random() * 6 | 0;
if (nTp === 0) {
rnd = Math.random() * nm8.length | 0;
nMs = nMs + " " + nm8[rnd];
} else if (nTp === 1) {
rnd = Math.random() * nm9.length | 0;
nMs = nm9[rnd] + " " + nMs;
}
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() * 3 | 0;
if (nTp === 0) {
rnd = Math.random() * nm5.length | 0;
rnd2 = Math.random() * nm6.length | 0;
rnd3 = Math.random() * nm7.length | 0;
rnd4 = Math.random() * nm6.length | 0;
rnd5 = Math.random() * nm7.length | 0;
rnd6 = Math.random() * nm6.length | 0;
while (nm7[rnd3] === nm5[rnd] || nm7[rnd3] === nm7[rnd5]) {
rnd3 = Math.random() * nm7.length | 0;
}
nMs = nm5[rnd] + nm6[rnd2] + nm7[rnd3] + nm6[rnd4] + nm7[rnd5] + nm6[rnd6];
} else {
nTp = Math.random() * 5 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
if (nTp < 3) {
rnd3 = Math.random() * nm4.length | 0;
rnd4 = Math.random() * nm1.length | 0;
rnd5 = Math.random() * nm2.length | 0;
rnd6 = Math.random() * nm4.length | 0;
rnd7 = Math.random() * nm10.length | 0;
nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd3] + nm10[rnd7] + nm1[rnd4] + nm2[rnd5] + nm4[rnd6];
} else {
rnd3 = Math.random() * nm3.length | 0;
rnd4 = Math.random() * nm2.length | 0;
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4];
}
}
testSwear(nMs);
}