invaderZim.js (2025B)
1 var nm1 = ["", "", "ch", "d", "fl", "g", "gr", "k", "kr", "l", "n", "p", "sk", "skl", "sl", "spl", "sq", "st", "t", "y", "z"]; 2 var nm2 = ["ee", "oo", "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"]; 3 var nm3 = ["b", "bd", "bn", "d", "dg", "dn", "dr", "gd", "gl", "k", "kd", "kl", "l", "p", "pl", "r", "rn", "rdn", "rd", "sl", "st", "tl", "v", "z"]; 4 var nm4 = ["", "", "", "", "", "", "c", "ch", "cks", "d", "g", "l", "lk", "m", "n", "nk", "nt", "r", "rb", "t", "tch"]; 5 var br = ""; 6 7 function nameGen() { 8 $('#placeholder').css('textTransform', 'capitalize'); 9 var element = document.createElement("div"); 10 element.setAttribute("id", "result"); 11 for (i = 0; i < 10; i++) { 12 nameMas(); 13 while (nMs === "") { 14 nameMas(); 15 } 16 nMs = "Invader " + nMs; 17 br = document.createElement('br'); 18 element.appendChild(document.createTextNode(nMs)); 19 element.appendChild(br); 20 } 21 if (document.getElementById("result")) { 22 document.getElementById("placeholder").removeChild(document.getElementById("result")); 23 } 24 document.getElementById("placeholder").appendChild(element); 25 } 26 27 function nameMas() { 28 nTp = Math.random() * 3 | 0; 29 rnd = Math.random() * nm1.length | 0; 30 rnd2 = Math.random() * nm2.length | 0; 31 rnd3 = Math.random() * nm4.length | 0; 32 if (nTp < 2) { 33 while (nm1[rnd] === nm4[rnd3]) { 34 rnd3 = Math.random() * nm4.length | 0; 35 } 36 nMs = nm1[rnd] + nm2[rnd2] + nm4[rnd3]; 37 } else { 38 rnd4 = Math.random() * nm3.length | 0; 39 rnd5 = Math.random() * nm2.length | 0; 40 while (nm3[rnd4] === nm1[rnd] || nm3[rnd4] === nm4[rnd3]) { 41 rnd4 = Math.random() * nm3.length | 0; 42 } 43 while (nm2[rnd2] < 2 && nm2[rnd5] < 2) { 44 rnd5 = Math.random() * nm2.length | 0; 45 } 46 nMs = nm1[rnd] + nm2[rnd2] + nm3[rnd4] + nm2[rnd5] + nm4[rnd3]; 47 } 48 testSwear(nMs); 49 }