eraDwarf.js (3685B)
1 var nm1 = ["", "", "", "", "b", "br", "bl", "d", "dr", "f", "fl", "fr", "g", "gr", "h", "ht", "hv", "k", "kr", "kv", "m", "n", "r", "sk", "sv", "th", "thr", "v"]; 2 var nm2 = ["a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "au", "û", "ó", "é", "á", "î", "â", "ei", "ie", "eo"]; 3 var nm3 = ["d", "dg", "dr", "fn", "g", "gn", "gd", "gm", "k", "kr", "kksv", "kn", "km", "ldh", "ldhr", "lm", "m", "mm", "mn", "nd", "ndf", "nn", "nndr", "r", "rd", "rg", "rgh", "rh", "rm", "rr", "s", "st", "th", "thg", "thm", "v", "w"]; 4 var nm4 = ["", "", "", "", "", "fk", "g", "k", "kk", "l", "ldn", "m", "n", "nd", "r", "rd", "rk", "rm", "rn", "rst", "rv", "s", "st", "th"]; 5 var nm5 = ["bh", "d", "dh", "f", "fl", "fr", "fn", "g", "gl", "gh", "gl", "h", "hn", "hr", "hl", "hv", "m", "n", "mh", "s", "th", "v"]; 6 var nm6 = ["a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "û", "í", "á", "ûi", "io", "îo"]; 7 var nm7 = ["d", "df", "dr", "fn", "fl", "fr", "gn", "gm", "gh", "l", "ln", "lm", "lr", "ld", "ll", "m", "mr", "mn", "mh", "md", "mm", "nd", "nr", "nh", "nn", "n", "ngl", "nh", "r", "rd", "rdr", "rn", "rh", "s", "ss", "th", "v", "w"]; 8 var nm8 = ["", "", "", "", "", "n", "nn", "s"]; 9 var br = ""; 10 11 function nameGen(type) { 12 $('#placeholder').css('textTransform', 'capitalize'); 13 var tp = type; 14 var element = document.createElement("div"); 15 element.setAttribute("id", "result"); 16 for (i = 0; i < 10; i++) { 17 if (tp === 1) { 18 rnd = Math.floor(Math.random() * nm5.length); 19 rnd2 = Math.floor(Math.random() * nm6.length); 20 rnd3 = Math.floor(Math.random() * nm7.length); 21 rnd4 = Math.floor(Math.random() * nm6.length); 22 rnd5 = Math.floor(Math.random() * nm8.length); 23 if (rnd5 < 5) { 24 rnd4 = 0; 25 } 26 if (i < 6) { 27 names = nm5[rnd] + nm6[rnd2] + nm7[rnd3] + nm6[rnd4] + nm8[rnd5]; 28 } else { 29 rnd6 = Math.floor(Math.random() * nm6.length); 30 rnd7 = Math.floor(Math.random() * nm7.length); 31 names = nm5[rnd] + nm6[rnd2] + nm7[rnd3] + nm6[rnd6] + nm7[rnd7] + nm6[rnd4] + nm8[rnd5]; 32 } 33 } else { 34 rnd = Math.floor(Math.random() * nm1.length); 35 rnd2 = Math.floor(Math.random() * nm2.length); 36 rnd4 = Math.floor(Math.random() * nm4.length); 37 if (i < 3) { 38 if (rnd < 4) { 39 while (rnd4 < 5) { 40 rnd4 = Math.floor(Math.random() * nm4.length); 41 } 42 } 43 names = nm1[rnd] + nm2[rnd2] + nm4[rnd4]; 44 } else if (i < 7) { 45 rnd3 = Math.floor(Math.random() * nm3.length); 46 rnd5 = Math.floor(Math.random() * nm2.length); 47 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd5] + nm4[rnd4]; 48 } else { 49 rnd3 = Math.floor(Math.random() * nm3.length); 50 rnd5 = Math.floor(Math.random() * nm2.length); 51 rnd6 = Math.floor(Math.random() * nm3.length); 52 rnd7 = Math.floor(Math.random() * nm2.length); 53 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd5] + nm3[rnd6] + nm2[rnd7] + nm4[rnd4]; 54 } 55 } 56 br = document.createElement('br'); 57 element.appendChild(document.createTextNode(names)); 58 element.appendChild(br); 59 } 60 if (document.getElementById("result")) { 61 document.getElementById("placeholder").removeChild(document.getElementById("result")); 62 } 63 document.getElementById("placeholder").appendChild(element); 64 }