dndBullywugs.js (1918B)
1 var nm1 = ["b", "bl", "d", "dr", "g", "gl", "gr", "m", "n", "ph", "r", "sp", "spl", "t", "tr", "z", "zp"]; 2 var nm2 = ["au", "ou", "aa", "oo", "a", "i", "o", "u", "a", "i", "o", "u", "a", "i", "o", "u", "a", "i", "o", "u", "a", "i", "o", "u", "a", "i", "o", "u", "a", "i", "o", "u", "a", "i", "o", "u"]; 3 var nm3 = ["bb", "bl", "bbl", "fg", "fl", "g", "gl", "ggl", "lb", "ld", "lt", "mp", "mpl", "nd", "ndl", "np", "npl", "rb", "rbl", "rl", "rt"]; 4 var nm4 = ["e", "i", "o", "u"]; 5 var nm5 = ["d", "f", "ff", "k", "nk", "p", "ps", "s", "th", "x"]; 6 var br = ""; 7 8 function nameGen(type) { 9 $('#placeholder').css('textTransform', 'capitalize'); 10 var tp = type; 11 var element = document.createElement("div"); 12 element.setAttribute("id", "result"); 13 for (i = 0; i < 10; i++) { 14 nameMas(); 15 while (nMs === "") { 16 nameMas(); 17 } 18 br = document.createElement('br'); 19 element.appendChild(document.createTextNode(nMs)); 20 element.appendChild(br); 21 } 22 if (document.getElementById("result")) { 23 document.getElementById("placeholder").removeChild(document.getElementById("result")); 24 } 25 document.getElementById("placeholder").appendChild(element); 26 } 27 28 function nameMas() { 29 nTp = Math.random() * 7 | 0; 30 rnd = Math.random() * nm1.length | 0; 31 rnd2 = Math.random() * nm2.length | 0; 32 rnd5 = Math.random() * nm5.length | 0; 33 if (nTp < 2) { 34 while (nm5[rnd5] === "" && nm1[rnd] === "") { 35 rnd5 = Math.random() * nm5.length | 0; 36 } 37 nMs = nm1[rnd] + nm2[rnd2] + nm5[rnd5]; 38 } else { 39 rnd3 = Math.random() * nm3.length | 0; 40 rnd4 = Math.random() * nm4.length | 0; 41 while (nm3[rnd3] === nm5[rnd5] || nm3[rnd3] === nm1[rnd]) { 42 rnd3 = Math.random() * nm3.length | 0; 43 } 44 nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm4[rnd4] + nm5[rnd5]; 45 } 46 testSwear(nMs); 47 }