zeldaAnoukiNames.js (1136B)
1 var nm1 = ["", "", "", "", "b", "d", "f", "g", "h", "k", "l", "m", "n", "p", "r", "s", "t", "w", "y", "z"]; 2 var nm2 = ["a", "u", "o", "e"]; 3 var nm3 = ["u", "o", "u", "o", "u", "o", "oo"]; 4 var br = ""; 5 6 function nameGen() { 7 $('#placeholder').css('textTransform', 'capitalize'); 8 var element = document.createElement("div"); 9 element.setAttribute("id", "result"); 10 for (i = 0; i < 10; i++) { 11 rnd = Math.floor(Math.random() * nm1.length); 12 rnd2 = Math.floor(Math.random() * nm2.length); 13 rnd3 = Math.floor(Math.random() * nm3.length); 14 rnd4 = Math.floor(Math.random() * nm1.length); 15 while (rnd4 < 4) { 16 rnd4 = Math.floor(Math.random() * nm1.length); 17 } 18 names = nm1[rnd] + nm2[rnd2] + nm1[rnd4] + nm3[rnd3]; 19 br = document.createElement('br'); 20 element.appendChild(document.createTextNode(names)); 21 element.appendChild(br); 22 } 23 if (document.getElementById("result")) { 24 document.getElementById("placeholder").removeChild(document.getElementById("result")); 25 } 26 document.getElementById("placeholder").appendChild(element); 27 }