avatarDragons.js (1140B)
1 var nm1 = ["dr", "f", "h", "ky", "m", "p", "r", "s", "sh", "y", "z", "zh"]; 2 var nm2 = ["a", "u", "a", "e", "i", "o", "u"]; 3 var nm3 = ["h", "k", "l", "n", "n", "n", "ng", "ng", "w"]; 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 nameMas() 12 while (nMs === "") { 13 nameMas(); 14 } 15 br = document.createElement('br'); 16 element.appendChild(document.createTextNode(nMs)); 17 element.appendChild(br); 18 } 19 if (document.getElementById("result")) { 20 document.getElementById("placeholder").removeChild(document.getElementById("result")); 21 } 22 document.getElementById("placeholder").appendChild(element); 23 } 24 25 function nameMas() { 26 rnd = Math.random() * nm1.length | 0; 27 rnd2 = Math.random() * nm2.length | 0; 28 rnd3 = Math.random() * nm3.length | 0; 29 while (nm1[rnd] === nm3[rnd3]) { 30 rnd = Math.random() * nm1.length | 0; 31 } 32 nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3]; 33 testSwear(nMs); 34 }