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.

90 lines
3.2 KiB
JavaScript

var nm1 = ["b", "h", "k", "l", "m", "n", "r", "sh", "t", "v", "w", "y", "x"];
var nm2 = ["ue", "ou", "ao", "ei", "ai", "aa", "ui", "a", "i", "o", "a", "i", "o", "u", "a", "i", "o", "a", "i", "o", "u"];
var nm3 = ["", "", "", "", "", "", "", "h", "n", "ng"];
var nm4 = ["b", "h", "k", "m", "n", "r", "v", "y", "x", "z"];
var nm5 = ["aa", "ei", "ai", "oa", "a", "o"];
var nm6 = ["l", "n", "r", "sh", "t", "v", "y", "z"];
var nm7 = ["a", "a", "i", "o", "u", "u"];
first = -1;
triggered = 0;
reset = 0;
function preload(arrayOfImages) {
$(arrayOfImages).each(function() {
$('<img/>')[0].src = this;
});
}
preload(['../images/backgrounds/avatarWanShiTong.jpg', '../images/backgrounds/avatarBaboon.jpg', '../images/backgrounds/avatarKoh.jpg']);
function nameGen() {
if (reset === 1) {
$("#nameGen").css("background-image", bg);
reset = 0;
}
$('#placeholder').css('textTransform', 'capitalize');
var br = "";
var element = document.createElement("div");
element.setAttribute("id", "result");
nTp = Math.random() * 50 | 0;
if (nTp === 0 && first !== 0 && triggered === 0) {
alert("boop");
nTp = Math.random() * 3 | 0;
if (nTp === 0) {
koh();
} else if (nTp === 1) {
wanShiTong();
} else {
baboon();
}
} else {
for (i = 0; i < 10; i++) {
nameMas()
while (nMs === "") {
nameMas();
}
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() * nm4.length | 0;
rnd2 = Math.random() * nm5.length | 0;
rnd3 = Math.random() * nm6.length | 0;
rnd4 = Math.random() * nm7.length | 0;
while (nm6[rnd3] === nm4[rnd4]) {
rnd3 = Math.random() * nm6.length | 0;
}
nMs = nm4[rnd] + nm5[rnd2] + nm6[rnd3] + nm7[rnd4];
} else {
nTp = Math.random() * 5 | 0;
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd3 = Math.random() * nm3.length | 0;
if (nTp < 3) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3];
} else {
rnd4 = Math.random() * nm1.length | 0;
rnd5 = Math.random() * nm2.length | 0;
rnd6 = Math.random() * nm3.length | 0;
if (nTp === 3) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + " " + nm1[rnd4] + nm2[rnd2] + nm3[rnd3];
} else {
rnd7 = Math.random() * nm1.length | 0;
rnd8 = Math.random() * nm2.length | 0;
rnd9 = Math.random() * nm3.length | 0;
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + " " + nm1[rnd4] + nm2[rnd2] + nm3[rnd3] + " " + nm1[rnd7] + nm2[rnd8] + nm3[rnd9];
}
}
}
testSwear(nMs);
}