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.
133 lines
4.6 KiB
JavaScript
133 lines
4.6 KiB
JavaScript
var nm22 = ["", "", "ch", "d", "j", "m", "n", "r", "s", "sh", "t", "y", "z"];
|
|
var nm20 = ["ao", "ai", "ee", "a", "a", "e", "i", "o", "o", "u", "u"];
|
|
var nm23 = ["j", "k", "m", "r", "s", "z", "k", "m", "r", "s", "z"];
|
|
var nm21 = ["l", "n", "r", "s"];
|
|
var nm24 = ["", "", "", "", "", "", "h", "k", "m", "n"];
|
|
var nm19 = ["a", "a", "e", "i", "o", "o", "u", "u"];
|
|
var nm25 = ["", "", "ch", "h", "l", "m", "n", "s", "sh", "t", "y", "z"];
|
|
var nm26 = ["k", "l", "m", "n", "ng", "r", "rs", "s", "y", "z"];
|
|
var nm27 = ["", "", "", "n", "h"];
|
|
var nm28 = ["ei", "ai", "ee", "a", "a", "e", "i", "o", "o", "u", "u", "y", "y"];
|
|
var nm29 = ["k", "l", "m", "n", "r", "s", "y", "z"];
|
|
first = -1;
|
|
triggered = 0;
|
|
reset = 0;
|
|
|
|
function preload(arrayOfImages) {
|
|
$(arrayOfImages).each(function() {
|
|
$('<img/>')[0].src = this;
|
|
});
|
|
}
|
|
preload(['../images/backgrounds/avatarIrohEaster.jpg', '../images/backgrounds/avatarZukoEaster.jpg', '../images/backgrounds/avatarAzula.jpg']);
|
|
|
|
function nameGen(type) {
|
|
if (reset === 1) {
|
|
$("#nameGen").css("background-image", bg);
|
|
reset = 0;
|
|
}
|
|
$('#placeholder').css('textTransform', 'capitalize');
|
|
var tp = type;
|
|
var br = "";
|
|
var element = document.createElement("div");
|
|
element.setAttribute("id", "result");
|
|
nTp = Math.random() * 50 | 0;
|
|
if (nTp === 0 && first !== 0 && triggered === 0) {
|
|
nTp = Math.random() * 3 | 0;
|
|
if (nTp === 0) {
|
|
iroh();
|
|
} else if (nTp === 1) {
|
|
zuko();
|
|
} else {
|
|
azula();
|
|
}
|
|
} else {
|
|
for (i = 0; i < 10; i++) {
|
|
if (tp === 1) {
|
|
nameFem()
|
|
while (nMs === "") {
|
|
nameFem();
|
|
}
|
|
} else {
|
|
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);
|
|
first++;
|
|
}
|
|
}
|
|
|
|
function nameMas() {
|
|
nTp = Math.random() * 6 | 0;
|
|
rnd = Math.random() * nm22.length | 0;
|
|
rnd2 = Math.random() * nm20.length | 0;
|
|
rnd5 = Math.random() * nm24.length | 0;
|
|
if (nTp === 0) {
|
|
while (nm22[rnd] === "" && nm24[rnd5] === "") {
|
|
rnd = Math.random() * nm22.length | 0;
|
|
}
|
|
nMs = nm22[rnd] + nm20[rnd2] + nm24[rnd5];
|
|
} else {
|
|
rnd3 = Math.random() * nm23.length | 0;
|
|
rnd4 = Math.random() * nm20.length | 0;
|
|
if (rnd2 < 3) {
|
|
while (rnd4 < 3) {
|
|
rnd4 = Math.random() * nm20.length | 0;
|
|
}
|
|
}
|
|
if (nTp < 5) {
|
|
while (nm23[rnd3] === nm22[rnd] || nm23[rnd3] === nm24[rnd5]) {
|
|
rnd3 = Math.random() * nm23.length | 0;
|
|
}
|
|
nMs = nm22[rnd] + nm20[rnd2] + nm23[rnd3] + nm20[rnd4] + nm24[rnd5];
|
|
} else {
|
|
rnd6 = Math.random() * nm21.length | 0;
|
|
rnd7 = Math.random() * nm19.length | 0;
|
|
while (nm21[rnd6] === nm23[rnd3] || nm21[rnd6] === nm24[rnd5]) {
|
|
rnd6 = Math.random() * nm21.length | 0;
|
|
}
|
|
nMs = nm20[rnd2] + nm23[rnd3] + nm19[rnd7] + nm21[rnd6] + nm20[rnd4] + nm24[rnd5];
|
|
}
|
|
}
|
|
testSwear(nMs);
|
|
}
|
|
|
|
function nameFem() {
|
|
nTp = Math.random() * 6 | 0;
|
|
rnd = Math.random() * nm25.length | 0;
|
|
rnd2 = Math.random() * nm28.length | 0;
|
|
rnd5 = Math.random() * nm27.length | 0;
|
|
if (nTp < 2) {
|
|
while (nm25[rnd] === "" && nm27[rnd5] === "") {
|
|
rnd = Math.random() * nm25.length | 0;
|
|
}
|
|
nMs = nm25[rnd] + nm28[rnd2] + nm27[rnd5];
|
|
} else {
|
|
rnd3 = Math.random() * nm26.length | 0;
|
|
rnd4 = Math.random() * nm19.length | 0;
|
|
if (nTp < 4) {
|
|
while (nm26[rnd3] === nm25[rnd] || nm26[rnd3] === nm27[rnd5]) {
|
|
rnd3 = Math.random() * nm26.length | 0;
|
|
}
|
|
nMs = nm25[rnd] + nm28[rnd2] + nm26[rnd3] + nm19[rnd4] + nm27[rnd5];
|
|
} else {
|
|
rnd3 = Math.random() * nm29.length | 0;
|
|
rnd6 = Math.random() * nm29.length | 0;
|
|
rnd7 = Math.random() * nm19.length | 0;
|
|
while (nm29[rnd6] === nm29[rnd3]) {
|
|
rnd6 = Math.random() * nm29.length | 0;
|
|
}
|
|
nMs = nm28[rnd2] + nm29[rnd3] + nm19[rnd4] + nm29[rnd6] + nm19[rnd7];
|
|
}
|
|
}
|
|
testSwear(nMs);
|
|
}
|