dndYuanTi.js (2304B)
1 var nm1 = ["", "", "", "", "", "h", "m", "n", "s", "sh", "ss", "ssh", "sz", "t", "th", "y", "z", "zh", "zs"]; 2 var nm2 = ["a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "a", "e", "i", "o", "u", "oa", "ui"]; 3 var nm3 = ["h", "hl", "htl", "hl", "hs", "hsh", "k", "kh", "kl", "ktl", "ks", "l", "lk", "ls", "ltl", "lts", "lsh", "m", "n", "s", "sh", "ss", "st", "stl", "sz", "sk", "t", "tl", "ts", "tsh", "tsz", "tz", "tstl", "zs", "zh", "zsh", "zt", "ztl"]; 4 var nm4 = ["h", "hs", "hl", "l", "ll", "s", "sh", "ss", "shl", "t", "th", "y", "z", "zh"]; 5 var nm5 = ["a", "i", "u", "a", "i", "u", "a", "i", "u", "a", "i", "u", "a", "i", "u", "a", "i", "u", "ie", "ia", "ei", "ee", "iu", "ui"]; 6 var nm6 = ["", "", "", "", "", "", "", "", "h", "h", "l", "ll", "s", "ss", "sh"]; 7 var br = ""; 8 9 function nameGen(type) { 10 $('#placeholder').css('textTransform', 'capitalize'); 11 var tp = type; 12 var element = document.createElement("div"); 13 element.setAttribute("id", "result"); 14 for (i = 0; i < 10; i++) { 15 nameMas(); 16 while (nMs === "") { 17 nameMas(); 18 } 19 br = document.createElement('br'); 20 element.appendChild(document.createTextNode(nMs)); 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 } 28 29 function nameMas() { 30 rnd = Math.random() * nm1.length | 0; 31 rnd2 = Math.random() * nm2.length | 0; 32 rnd3 = Math.random() * nm3.length | 0; 33 rnd4 = Math.random() * nm5.length | 0; 34 rnd5 = Math.random() * nm6.length | 0; 35 if (i < 6) { 36 while (nm1[rnd] === nm3[rnd3] || nm3[rnd3] === nm6[rnd5]) { 37 rnd3 = Math.random() * nm3.length | 0; 38 } 39 nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm5[rnd4] + nm6[rnd5]; 40 } else { 41 rnd6 = Math.random() * nm4.length | 0; 42 rnd7 = Math.random() * nm2.length | 0; 43 while (nm3[rnd4] === nm4[rnd6] || nm4[rnd6] === nm6[rnd5]) { 44 rnd6 = Math.random() * nm4.length | 0; 45 } 46 nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd7] + nm4[rnd6] + nm5[rnd4] + nm6[rnd5]; 47 } 48 testSwear(nMs); 49 }