eraElf.js (3549B)
1 var nm1 = ["", "", "", "", "b", "bl", "c", "cl", "d", "f", "g", "gl", "gn", "h", "k", "l", "m", "n", "t", "th", "v", "vr", "w"]; 2 var nm2 = ["a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "í", "ö", "ä", "äo", "á", "ae", "ia", "ie", "io", "au", "ae"]; 3 var nm3 = ["c", "d", "dhg", "dg", "dr", "dh", "f", "g", "gh", "l", "lm", "ln", "ld", "ldth", "ll", "lr", "mn", "m", "mh", "n", "nd", "nr", "nth", "nw", "r", "rd", "rv", "rz", "rth", "s", "sd", "th", "tr", "v"]; 4 var nm4 = ["", "", "", "", "", "dr", "l", "ldr", "lr", "mh", "n", "ng", "r", "rm", "s"]; 5 var nm5 = ["", "", "", "", "", "bh", "cl", "d", "f", "gl", "gh", "h", "l", "m", "n", "rh", "s", "t", "th", "v", "w", "y"]; 6 var nm6 = ["a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "í", "ë", "ö", "á", "ëa", "ia", "io", "au", "ue", "ua", "ía", "ae"]; 7 var nm7 = ["d", "dr", "fr", "l", "ll", "lr", "ln", "lm", "ldr", "ld", "ly", "m", "mv", "my", "mm", "ny", "n", "nn", "nv", "nz", "r", "rm", "ry", "rh", "sn", "sl", "t", "th", "y"]; 8 var nm8 = ["", "", "", "", "", "", "", "d", "n", "r", "s", "th"]; 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 (i < 6) { 24 names = nm5[rnd] + nm6[rnd2] + nm7[rnd3] + nm6[rnd4] + nm8[rnd5]; 25 } else { 26 rnd6 = Math.floor(Math.random() * nm6.length); 27 rnd7 = Math.floor(Math.random() * nm7.length); 28 names = nm5[rnd] + nm6[rnd2] + nm7[rnd3] + nm6[rnd6] + nm7[rnd7] + nm6[rnd4] + nm8[rnd5]; 29 } 30 } else { 31 rnd = Math.floor(Math.random() * nm1.length); 32 rnd2 = Math.floor(Math.random() * nm2.length); 33 rnd4 = Math.floor(Math.random() * nm4.length); 34 if (i < 3) { 35 if (rnd < 4) { 36 while (rnd4 < 5) { 37 rnd4 = Math.floor(Math.random() * nm4.length); 38 } 39 } 40 names = nm1[rnd] + nm2[rnd2] + nm4[rnd4]; 41 } else if (i < 7) { 42 rnd3 = Math.floor(Math.random() * nm3.length); 43 rnd5 = Math.floor(Math.random() * nm2.length); 44 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd5] + nm4[rnd4]; 45 } else { 46 rnd3 = Math.floor(Math.random() * nm3.length); 47 rnd5 = Math.floor(Math.random() * nm2.length); 48 rnd6 = Math.floor(Math.random() * nm3.length); 49 rnd7 = Math.floor(Math.random() * nm2.length); 50 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd5] + nm3[rnd6] + nm2[rnd7] + nm4[rnd4]; 51 } 52 } 53 br = document.createElement('br'); 54 element.appendChild(document.createTextNode(names)); 55 element.appendChild(br); 56 } 57 if (document.getElementById("result")) { 58 document.getElementById("placeholder").removeChild(document.getElementById("result")); 59 } 60 document.getElementById("placeholder").appendChild(element); 61 }