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.

70 lines
4.6 KiB
JavaScript

var nm1 = ["", "", "", "", "", "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "y", "z"];
var nm2 = ["a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "ae", "ai", "aa", "ea", "ia", "ua", "uu"];
var nm3 = ["b", "br", "bh", "d", "dr", "dh", "g", "gr", "gw", "h", "hw", "k", "kh", "l", "lg", "lw", "lgr", "lb", "ld", "n", "ng", "nj", "nn", "ns", "ph", "r", "rk", "rl", "rm", "s", "sg", "sk", "th", "v", "w", "wr"];
var nm4 = ["b", "d", "g", "h", "k", "l", "n", "r", "s", "v", "w"];
var nm5 = ["a", "e", "i", "o", "u"];
var nm6 = ["", "", "", "", "", "", "c", "ch", "d", "h", "k", "l", "ll", "n", "nd", "ng", "nn", "p", "r", "rd", "rn", "rth", "s", "sh", "th", "z"];
var br = "";
function nameGen() {
var nm7 = ["Action", "Adventure", "Advice", "Alcohol", "Ambition", "Anger", "Animal", "Ant", "Apple", "Arch", "Army", "Aspect", "Attack", "Autumn", "Award", "Ball", "Bath", "Battle", "Beach", "Bead", "Bean", "Bear", "Beast", "Beetle", "Being", "Bell", "Berry", "Bird", "Birth", "Black", "Blade", "Bone", "Border", "Box", "Brass", "Brave", "Break", "Breath", "Brush", "Bubble", "Candle", "Cat", "Cattle", "Chalk", "Champion", "Change", "Chaos", "Child", "Cloud", "Clover", "Cobweb", "Copper", "Creature", "Cross", "Crown", "Dance", "Darkness", "Dead", "Death", "Dirt", "Dish", "Dream", "East", "Eternity", "Evil", "Eye", "Face", "Fall", "Fang", "Farm", "Fear", "Feast", "Feather", "Fire", "Fish", "Flame", "Flower", "Fortune", "Freedom", "Friend", "Frog", "Fruit", "Future", "Game", "Garden", "Ghost", "Giant", "Gift", "Glass", "God", "Gold", "Grain", "Grass", "Ground", "Growth", "Guard", "Hammer", "Harmony", "Hate", "Hatred", "Heart", "Hide", "Hill", "Hold", "Home", "Honey", "Honor", "Horse", "Host", "House", "Human", "Hunt", "Ice", "Image", "Ink", "Iron", "Jewel", "Knife", "Laugh", "Leaf", "Leather", "Life", "Light", "Lock", "Love", "Luck", "Magic", "Marble", "Mask", "Midnight", "Mouse", "Mud", "Music", "Night", "North", "Nut", "Ocean", "Oil", "Omen", "Peace", "Peak", "People", "Pig", "Plant", "Powder", "Pride", "Prize", "Quill", "Rabbit", "Rain", "River", "Ruby", "Salt", "Sand", "Sapphire", "Scale", "Scent", "Shade", "Shadow", "Shape", "Sign", "Silk", "Silver", "Sky", "Smoke", "Snail", "Snake", "Snow", "Song", "South", "Spider", "Spirit", "Spring", "Storm", "Stranger", "Summer", "Surprise", "Thread", "Thunder", "Tooth", "Tree", "Village", "Voice", "Volcano", "Wall", "Water", "Wave", "Weather", "West", "Winter", "Wool", "World"];
$('#placeholder').css('textTransform', 'capitalize');
var element = document.createElement("div");
element.setAttribute("id", "result");
for (i = 0; i < 10; i++) {
nameMas();
while (nMs === "") {
nameMas();
}
rnd = Math.random() * nm7.length | 0;
nMs = nMs + " (" + nm7[rnd] + ")";
nm7.splice(rnd, 1);
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() {
rnd = Math.random() * nm1.length | 0;
rnd2 = Math.random() * nm2.length | 0;
rnd3 = Math.random() * nm3.length | 0;
rnd4 = Math.random() * nm5.length | 0;
rnd5 = Math.random() * nm6.length | 0;
while (nm3[rnd3] === nm1[rnd] || nm3[rnd3] === nm6[rnd5]) {
rnd3 = Math.random() * nm3.length | 0;
}
nTp = Math.random() * 6 | 0;
if (nTp < 2) {
while (nm1[rnd] === "") {
rnd = Math.random() * nm1.length | 0;
}
while (nm6[rnd5] === nm1[rnd] || nm6[rnd5] === "") {
rnd5 = Math.random() * nm6.length | 0;
}
nMs = nm1[rnd] + nm2[rnd2] + nm6[rnd5];
} else if (nTp < 4) {
if (nTp === 2) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm5[rnd4] + nm6[rnd5];
} else {
nMs = nm1[rnd] + nm5[rnd4] + nm3[rnd3] + nm2[rnd2] + nm6[rnd5];
}
} else {
rnd6 = Math.random() * nm2.length | 0;
rnd7 = Math.random() * nm4.length | 0;
while (nm4[rnd7] === nm3[rnd3] || nm4[rnd7] === nm6[rnd5]) {
rnd7 = Math.random() * nm4.length | 0;
}
if (nTp === 4) {
nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm5[rnd4] + nm4[rnd7] + nm2[rnd6] + nm6[rnd5];
} else {
nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd7] + nm5[rnd4] + nm3[rnd3] + nm2[rnd6] + nm6[rnd5];
}
}
testSwear(nMs);
}