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.
80 lines
3.1 KiB
JavaScript
80 lines
3.1 KiB
JavaScript
var nm1 = ["b", "ch", "g", "h", "l", "m", "n", "s", "sh", "w", "y", "z"];
|
|
var nm2 = ["ao", "ai", "ia", "a", "i", "o", "u", "a", "i", "o", "u"];
|
|
var nm3 = ["f", "j", "l", "p", "sh", "y", "z"];
|
|
var nm4 = ["", "", "", "", "", "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"];
|
|
|
|
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() * 4 | 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() * 6 | 0;
|
|
rnd = Math.random() * nm1.length | 0;
|
|
rnd2 = Math.random() * nm2.length | 0;
|
|
rnd3 = Math.random() * nm4.length | 0;
|
|
if (nTp < 4) {
|
|
if (nTp === 0) {
|
|
nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd3]
|
|
} else {
|
|
rnd4 = Math.random() * nm1.length | 0;
|
|
rnd5 = Math.random() * nm2.length | 0;
|
|
rnd6 = Math.random() * nm4.length | 0;
|
|
if (nTp < 3) {
|
|
nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd3] + " " + nm1[rnd4] + nm2[rnd5] + nm4[rnd6];
|
|
} else {
|
|
rnd7 = Math.random() * nm1.length | 0;
|
|
rnd8 = Math.random() * nm2.length | 0;
|
|
nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd3] + " " + nm1[rnd4] + nm2[rnd5] + nm4[rnd6] + " " + nm1[rnd7] + nm2[rnd8];
|
|
}
|
|
}
|
|
} else {
|
|
rnd4 = Math.random() * nm3.length | 0;
|
|
rnd5 = Math.random() * nm2.length | 0;
|
|
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm2[rnd5] + nm4[rnd3];
|
|
}
|
|
}
|
|
testSwear(nMs);
|
|
}
|