haloKigYarNames.js (1501B)
1 var nm1 = ["a", "e", "i", "o", "u"]; 2 var nm2 = ["b", "c", "d", "g", "j", "n", "k", "m", "r", "t", "th", "y", "z", "zh"]; 3 var nm3 = ["b", "c", "d", "g", "k", "m", "n", "p", "q", "r", "th", "x", "z"]; 4 5 function nameGen() { 6 $('#placeholder').css('textTransform', 'capitalize'); 7 var br = ""; 8 var element = document.createElement("div"); 9 element.setAttribute("id", "result"); 10 for (i = 0; i < 10; i++) { 11 if (i < 5) { 12 rnd = Math.floor(Math.random() * nm2.length); 13 rnd2 = Math.floor(Math.random() * nm1.length); 14 rnd3 = Math.floor(Math.random() * nm3.length); 15 names = nm2[rnd] + nm1[rnd2] + nm3[rnd3]; 16 } else { 17 rnd = Math.floor(Math.random() * nm2.length); 18 rnd2 = Math.floor(Math.random() * nm1.length); 19 rnd3 = Math.floor(Math.random() * nm3.length); 20 rnd4 = Math.floor(Math.random() * nm2.length); 21 rnd5 = Math.floor(Math.random() * nm1.length); 22 rnd6 = Math.floor(Math.random() * nm3.length); 23 names = nm2[rnd] + nm1[rnd2] + nm3[rnd3] + " " + nm2[rnd4] + nm1[rnd5] + nm3[rnd6]; 24 } 25 br = document.createElement('br'); 26 element.appendChild(document.createTextNode(names)); 27 element.appendChild(br); 28 } 29 if (document.getElementById("result")) { 30 document.getElementById("placeholder").removeChild(document.getElementById("result")); 31 } 32 document.getElementById("placeholder").appendChild(element); 33 }