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.
127 lines
4.5 KiB
JavaScript
127 lines
4.5 KiB
JavaScript
var nm8 = ["b", "d", "h", "k", "m", "n", "p", "r", "s", "t", "v", "z"];
|
|
var nm9 = ["oa", "a", "i", "o", "e", "a", "o", "u", "a", "i", "o", "e", "a", "o", "u"];
|
|
var nm10 = ["d", "k", "l", "n", "r", "t", "d", "k", "kk", "l", "lr", "n", "nr", "r", "rl", "rn", "rm", "rr", "sr", "t", "vr"];
|
|
var nm6 = ["a", "i", "o", "e", "a", "o", "u"];
|
|
var nm7 = ["d", "l", "n", "y"];
|
|
var nm11 = ["", "", "", "", "k", "k", "r", "m", "n", "q", "q", "s"];
|
|
var nm12 = ["", "", "h", "k", "k", "k", "ky", "l", "m", "n", "r", "s", "t", "v", "y", "z"];
|
|
var nm14 = ["h", "k", "l", "ll", "m", "n", "nn", "r", "rr", "s", "t", "y"];
|
|
var nm15 = ["d", "n", "r", "y"];
|
|
var nm16 = ["ue", "ia", "a", "i", "o", "e", "a", "o", "u", "a", "i", "o", "e", "a", "o", "u"];
|
|
var nm17 = ["", "", "", "", "n", "k", "h"];
|
|
first = -1;
|
|
triggered = 0;
|
|
reset = 0;
|
|
|
|
function preload(arrayOfImages) {
|
|
$(arrayOfImages).each(function() {
|
|
$('<img/>')[0].src = this;
|
|
});
|
|
}
|
|
preload(['../images/backgrounds/avatarEsnaDesna.jpg', '../images/backgrounds/avatarSokka.jpg', '../images/backgrounds/avatarVarrick.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) {
|
|
sokka();
|
|
} else if (nTp === 1) {
|
|
varrick();
|
|
} else {
|
|
eskaDesna();
|
|
}
|
|
} 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() * nm8.length | 0;
|
|
rnd2 = Math.random() * nm9.length | 0;
|
|
rnd5 = Math.random() * nm11.length | 0;
|
|
if (nTp === 0) {
|
|
while (nm8[rnd] === "" && nm11[rnd5] === "") {
|
|
rnd5 = Math.random() * nm11.length | 0;
|
|
}
|
|
nMs = nm8[rnd] + nm9[rnd2] + nm11[rnd5];
|
|
} else {
|
|
rnd3 = Math.random() * nm10.length | 0;
|
|
rnd4 = Math.random() * nm6.length | 0;
|
|
while (nm10[rnd3] === nm8[rnd] || nm10[rnd3] === nm11[rnd5]) {
|
|
rnd3 = Math.random() * nm10.length | 0;
|
|
}
|
|
if (nTp < 5) {
|
|
nMs = nm8[rnd] + nm9[rnd2] + nm10[rnd3] + nm6[rnd4] + nm11[rnd5];
|
|
} else {
|
|
rnd6 = Math.random() * nm7.length | 0;
|
|
rnd7 = Math.random() * nm6.length | 0;
|
|
while (nm10[rnd3] === nm7[rnd6] || nm7[rnd6] === nm11[rnd5]) {
|
|
rnd6 = Math.random() * nm7.length | 0;
|
|
}
|
|
nMs = nm8[rnd] + nm9[rnd2] + nm10[rnd3] + nm6[rnd4] + nm7[rnd6] + nm6[rnd7] + nm11[rnd5];
|
|
}
|
|
}
|
|
testSwear(nMs);
|
|
}
|
|
|
|
function nameFem() {
|
|
nTp = Math.random() * 6 | 0;
|
|
rnd = Math.random() * nm12.length | 0;
|
|
rnd2 = Math.random() * nm16.length | 0;
|
|
rnd5 = Math.random() * nm17.length | 0;
|
|
if (nTp === 0) {
|
|
while (nm12[rnd] === "" && nm17[rnd5] === "") {
|
|
rnd = Math.random() * nm12.length | 0;
|
|
}
|
|
nMs = nm12[rnd] + nm16[rnd2] + nm17[rnd5];
|
|
} else {
|
|
rnd3 = Math.random() * nm14.length | 0;
|
|
rnd4 = Math.random() * nm6.length | 0;
|
|
if (nTp < 4) {
|
|
while (nm14[rnd3] === nm12[rnd] || nm14[rnd3] === nm17[rnd5]) {
|
|
rnd3 = Math.random() * nm14.length | 0;
|
|
}
|
|
nMs = nm12[rnd] + nm16[rnd2] + nm14[rnd3] + nm6[rnd4] + nm17[rnd5];
|
|
} else {
|
|
rnd6 = Math.random() * nm15.length | 0;
|
|
rnd7 = Math.random() * nm6.length | 0;
|
|
while (nm14[rnd3] === nm12[rnd] || nm14[rnd3] === nm15[rnd6]) {
|
|
rnd3 = Math.random() * nm14.length | 0;
|
|
}
|
|
nMs = nm12[rnd] + nm16[rnd2] + nm14[rnd3] + nm6[rnd4] + nm15[rnd6] + nm6[rnd7];
|
|
}
|
|
}
|
|
testSwear(nMs);
|
|
}
|