haloUnggoyNames.js (2033B)
1 var nm1 = ["a", "i", "u"]; 2 var nm2 = ["d", "f", "k", "l", "m", "s", "w", "p", "y", "z"]; 3 var nm3 = ["fl", "kl", "sl", "sm", "pl", "zl", "d", "f", "k", "l", "m", "s", "w", "p", "y", "z"]; 4 var nm4 = ["fl", "kl", "sl", "sm", "pl", "zl"]; 5 6 function nameGen() { 7 $('#placeholder').css('textTransform', 'capitalize'); 8 var br = ""; 9 var element = document.createElement("div"); 10 element.setAttribute("id", "result"); 11 for (i = 0; i < 10; i++) { 12 if (i < 5) { 13 rnd = Math.floor(Math.random() * nm2.length); 14 rnd2 = Math.floor(Math.random() * nm1.length); 15 rnd3 = Math.floor(Math.random() * nm2.length); 16 rnd4 = Math.floor(Math.random() * nm2.length); 17 names = nm2[rnd] + nm1[rnd2] + nm2[rnd3] + nm1[rnd2] + nm2[rnd4]; 18 } else if (i < 7) { 19 rnd = Math.floor(Math.random() * nm3.length); 20 rnd2 = Math.floor(Math.random() * nm1.length); 21 rnd1 = Math.floor(Math.random() * nm2.length); 22 rnd3 = Math.floor(Math.random() * nm3.length); 23 if (rnd < 6) { 24 while (rnd3 < 6) { 25 rnd3 = Math.floor(Math.random() * nm3.length); 26 } 27 } 28 rnd4 = Math.floor(Math.random() * nm1.length); 29 rnd5 = Math.floor(Math.random() * nm2.length); 30 names = nm3[rnd] + nm1[rnd2] + nm2[rnd1] + nm3[rnd3] + nm1[rnd4] + nm2[rnd5]; 31 } else { 32 rnd = Math.floor(Math.random() * nm4.length); 33 rnd2 = Math.floor(Math.random() * nm1.length); 34 rnd3 = Math.floor(Math.random() * nm2.length); 35 names = nm4[rnd] + nm1[rnd2] + nm2[rnd3]; 36 } 37 br = document.createElement('br'); 38 element.appendChild(document.createTextNode(names)); 39 element.appendChild(br); 40 } 41 if (document.getElementById("result")) { 42 document.getElementById("placeholder").removeChild(document.getElementById("result")); 43 } 44 document.getElementById("placeholder").appendChild(element); 45 }