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.

39 lines
1.7 KiB
JavaScript

var nm1 = ["d", "dh", "g", "gh", "k", "kh", "m", "n", "sh", "t", "th", "tl", "v", "z", "zh"];
var nm2 = ["a'au", "au'ua", "o'ou", "u'u", "u'ua", "u'uo", "ua'au"];
var nm2b = ["a", "o", "u"];
var nm3 = ["d", "g", "l", "m", "n", "r", "v", "z"];
var nm4 = ["c", "ch", "g", "l", "m", "n", "r", "v", "z"];
var nm5 = ["c", "d", "k", "l", "lk", "ll", "m", "n", "rc", "rd", "rg", "rk", "rn"];
var br = "";
function nameGen() {
$('#placeholder').css('textTransform', 'capitalize');
var element = document.createElement("div");
element.setAttribute("id", "result");
for (i = 0; i < 10; i++) {
rnd = Math.floor(Math.random() * nm1.length);
if (i < 5) {
rnd2 = Math.floor(Math.random() * nm2.length);
rnd3 = Math.floor(Math.random() * nm5.length);
names = nm1[rnd] + nm2[rnd2] + nm5[rnd3];
} else if (i < 7) {
rnd2 = Math.floor(Math.random() * nm2b.length);
rnd3 = Math.floor(Math.random() * nm4.length);
names = nm1[rnd] + nm2b[rnd2] + nm4[rnd3];
} else {
rnd2 = Math.floor(Math.random() * nm2b.length);
rnd3 = Math.floor(Math.random() * nm4.length);
rnd4 = Math.floor(Math.random() * nm2b.length);
rnd5 = Math.floor(Math.random() * nm3.length);
names = nm1[rnd] + nm2b[rnd2] + nm3[rnd5] + nm2b[rnd2] + nm4[rnd3];
}
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);
}