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.

126 lines
4.3 KiB
JavaScript

var nm15 = ["ch", "b", "f", "g", "h", "l", "m", "p", "r", "b", "f", "g", "h", "l", "m", "p", "r", "sh", "x"];
var nm16 = ["ao", "uo", "aa", "a", "e", "o", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u"];
var nm17 = ["h", "l", "m", "n", "h", "l", "m", "n", "h", "l", "m", "n", "h", "l", "m", "n", "sh", "t"];
var nm18 = ["", "", "", "", "", "", "h", "ng", "n", "ng", "n", "r"];
var nm19 = ["", "", "b", "f", "g", "gy", "h", "k", "ky", "l", "n", "m", "s", "sh", "t", "w"];
var nm20 = ["k", "l", "m", "n", "r", "sh", "v", "y"];
var nm21 = ["", "", "", "", "", "", "", "", "", "", "ph", "h", "h", "ng", "n", "n"];
var nm22 = ["a", "e", "i", "o", "a", "o"];
first = -1;
triggered = 0;
reset = 0;
function preload(arrayOfImages) {
$(arrayOfImages).each(function() {
$('<img/>')[0].src = this;
});
}
preload(['../images/backgrounds/avatarTheBoulder.jpg', '../images/backgrounds/avatarToph.jpg', '../images/backgrounds/avatarJooDee.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) {
toph();
} else if (nTp === 1) {
jooDee();
} else {
theBoulder();
}
} else {
for (i = 0; i < 10; i++) {
if (tp === 1) {
nTp = Math.random() * 7 | 0;
nameFem()
while (nMs === "") {
nameFem();
}
names = nMs;
if (nTp === 0) {
nameFem()
while (nMs === "") {
nameFem();
}
names = names + " " + nMs;
}
} else {
nTp = Math.random() * 4 | 0;
nameMas()
while (nMs === "") {
nameMas();
}
names = nMs;
if (nTp === 0) {
nameMas()
while (nMs === "") {
nameMas();
}
names = names + " " + nMs;
}
}
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);
first++;
}
}
function nameMas() {
nTp = Math.random() * 5 | 0;
rnd = Math.random() * nm15.length | 0;
rnd2 = Math.random() * nm16.length | 0;
rnd5 = Math.random() * nm18.length | 0;
if (nTp < 2) {
nMs = nm15[rnd] + nm16[rnd2] + nm18[rnd5];
} else {
rnd3 = Math.random() * nm17.length | 0;
rnd4 = Math.random() * nm16.length | 0;
if (rnd2 < 4) {
while (rnd4 < 3) {
rnd4 = Math.random() * nm16.length | 0;
}
}
while (nm17[rnd3] === nm15[rnd] || nm17[rnd3] === nm18[rnd5]) {
rnd3 = Math.random() * nm17.length | 0;
}
nMs = nm15[rnd] + nm16[rnd2] + nm17[rnd3] + nm16[rnd4] + nm18[rnd5];
}
testSwear(nMs);
}
function nameFem() {
nTp = Math.random() * 4 | 0;
rnd = Math.random() * nm19.length | 0;
rnd2 = Math.random() * nm22.length | 0;
rnd5 = Math.random() * nm21.length | 0;
if (nTp < 2) {
while (nm19[rnd] === "" && nm21[rnd5] === "") {
rnd = Math.random() * nm19.length | 0;
}
nMs = nm19[rnd] + nm22[rnd2] + nm21[rnd5];
} else {
rnd3 = Math.random() * nm20.length | 0;
rnd4 = Math.random() * nm22.length | 0;
while (nm20[rnd3] === nm19[rnd] || nm20[rnd3] === nm22[rnd5]) {
rnd3 = Math.random() * nm20.length | 0;
}
nMs = nm19[rnd] + nm22[rnd2] + nm20[rnd3] + nm22[rnd4] + nm21[rnd5];
}
testSwear(nMs);
}