zeldaKorokNames.js (2478B)
1 var nm1 = ["", "", "", "", "b", "d", "br", "dr", "gr", "g", "h", "k", "l", "m", "r", "tr", "t"]; 2 var nm2 = ["a", "e", "i", "o", "u"]; 3 var nm3 = ["c", "g", "gn", "gm", "k", "kl", "l", "v", "ld", "lm", "ll", "m", "md", "n", "nd", "r", "rn", "s", "sn", "sm", "sr"]; 4 var nm4 = ["", "", "", "", "", "", "", "", "h", "l", "m", "s", "r", "n", "wn", "w"]; 5 var nm5 = ["b", "d", "f", "g", "h", "k", "l", "m", "n", "p", "r", "s", "t", "z"]; 6 var nm6 = ["b", "d", "f", "g", "h", "l", "k", "m", "n", "p", "r", "s", "t", "v", "w", "z"]; 7 var nm7 = ["c", "d", "f", "g", "h", "k", "l", "m", "n", "ph", "r", "s", "t", "th", "w", "z"]; 8 var nm8 = ["a", "e", "i", "o", "u", "ai", "ae", "ea", "ei", "eo", "ia", "io", "iu", "ie", "oa", "oe", "oi", "ou", "ua", "ue", "uo", "ui"]; 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() * nm6.length); 19 rnd2 = Math.floor(Math.random() * nm2.length); 20 rnd3 = Math.floor(Math.random() * nm7.length); 21 rnd4 = Math.floor(Math.random() * nm8.length); 22 names = nm6[rnd] + nm2[rnd2] + nm7[rnd3] + nm8[rnd4]; 23 } else { 24 if (i < 5) { 25 rnd = Math.floor(Math.random() * nm1.length); 26 rnd2 = Math.floor(Math.random() * nm2.length); 27 rnd3 = Math.floor(Math.random() * nm3.length); 28 rnd4 = Math.floor(Math.random() * nm4.length); 29 rnd5 = Math.floor(Math.random() * nm2.length); 30 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd5] + nm4[rnd4]; 31 } else { 32 rnd = Math.floor(Math.random() * nm5.length); 33 rnd2 = Math.floor(Math.random() * nm2.length); 34 rnd3 = Math.floor(Math.random() * nm7.length); 35 rnd4 = Math.floor(Math.random() * nm2.length); 36 names = nm5[rnd] + nm2[rnd2] + nm7[rnd3] + nm2[rnd4]; 37 } 38 } 39 br = document.createElement('br'); 40 element.appendChild(document.createTextNode(names)); 41 element.appendChild(br); 42 } 43 if (document.getElementById("result")) { 44 document.getElementById("placeholder").removeChild(document.getElementById("result")); 45 } 46 document.getElementById("placeholder").appendChild(element); 47 }