avatarFireNationPlaces.js (2823B)
1 var nm1 = ["bh", "ch", "h", "j", "l", "m", "q", "sh", "w", "x", "z"]; 2 var nm2 = ["a", "i", "u", "a", "i", "u", "a", "i", "u", "e", "o"]; 3 var nm3 = ["ch", "d", "dh", "l", "ln", "nt", "nd", "r", "rt", "rn", "rs", "s", "sh", "ss", "sz", "z", "zz", "zh"]; 4 var nm4 = ["", "", "", "h", "n", "ng", "n", "ng"]; 5 var nm5 = ["d", "g", "h", "k", "n", "r", "t", "z"]; 6 var nm6 = ["a", "e", "i", "o", "u", "a", "i", "o", "u"]; 7 var nm7 = ["ch", "d", "k", "n", "s", "r", "t", "y", "z"]; 8 var nm8 = ["Island", "Village"]; 9 var nm9 = ["North", "South", "East", "West"]; 10 var nm10 = ["-", " "]; 11 12 function nameGen() { 13 $('#placeholder').css('textTransform', 'capitalize'); 14 var br = ""; 15 var element = document.createElement("div"); 16 element.setAttribute("id", "result"); 17 for (i = 0; i < 10; i++) { 18 nameMas() 19 while (nMs === "") { 20 nameMas(); 21 } 22 nTp = Math.random() * 6 | 0; 23 if (nTp === 0) { 24 rnd = Math.random() * nm8.length | 0; 25 nMs = nMs + " " + nm8[rnd]; 26 } else if (nTp === 1) { 27 rnd = Math.random() * nm9.length | 0; 28 nMs = nm9[rnd] + " " + nMs; 29 } 30 br = document.createElement('br'); 31 element.appendChild(document.createTextNode(nMs)); 32 element.appendChild(br); 33 } 34 if (document.getElementById("result")) { 35 document.getElementById("placeholder").removeChild(document.getElementById("result")); 36 } 37 document.getElementById("placeholder").appendChild(element); 38 } 39 40 function nameMas() { 41 nTp = Math.random() * 3 | 0; 42 if (nTp === 0) { 43 rnd = Math.random() * nm5.length | 0; 44 rnd2 = Math.random() * nm6.length | 0; 45 rnd3 = Math.random() * nm7.length | 0; 46 rnd4 = Math.random() * nm6.length | 0; 47 rnd5 = Math.random() * nm7.length | 0; 48 rnd6 = Math.random() * nm6.length | 0; 49 while (nm7[rnd3] === nm5[rnd] || nm7[rnd3] === nm7[rnd5]) { 50 rnd3 = Math.random() * nm7.length | 0; 51 } 52 nMs = nm5[rnd] + nm6[rnd2] + nm7[rnd3] + nm6[rnd4] + nm7[rnd5] + nm6[rnd6]; 53 } else { 54 nTp = Math.random() * 5 | 0; 55 rnd = Math.random() * nm1.length | 0; 56 rnd2 = Math.random() * nm2.length | 0; 57 if (nTp < 3) { 58 rnd3 = Math.random() * nm4.length | 0; 59 rnd4 = Math.random() * nm1.length | 0; 60 rnd5 = Math.random() * nm2.length | 0; 61 rnd6 = Math.random() * nm4.length | 0; 62 rnd7 = Math.random() * nm10.length | 0; 63 nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd3] + nm10[rnd7] + nm1[rnd4] + nm2[rnd5] + nm4[rnd6]; 64 } else { 65 rnd3 = Math.random() * nm3.length | 0; 66 rnd4 = Math.random() * nm2.length | 0; 67 nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd4]; 68 } 69 } 70 testSwear(nMs); 71 }