moleculeNames.js (4413B)
1 var nm1 = ["", "", "", "", "", "", "", "", "", "", "", "", "", "deca", "di", "duo", "hepta", "hexa", "hydra", "hydro", "hypo", "iso", "mono", "octa", "penta", "tetra", "tri"]; 2 var nm2 = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "a", "e", "i", "o"]; 3 var nm3 = ["b", "br", "c", "ch", "chl", "chr", "cl", "d", "f", "fl", "fr", "g", "gl", "h", "j", "k", "l", "m", "n", "p", "ph", "pl", "pr", "ps", "r", "rh", "s", "sh", "sp", "st", "str", "t", "th", "tr", "v", "w", "z"]; 4 var nm4 = ["b", "bd", "br", "bsc", "c", "cc", "cch", "ch", "chl", "chr", "cl", "cr", "ct", "d", "dr", "dv", "f", "ff", "fl", "g", "gl", "gn", "h", "k", "l", "lb", "lc", "lch", "ldr", "lf", "lg", "ll", "lp", "lph", "lpr", "lt", "m", "mm", "mn", "mph", "n", "nc", "nd", "nh", "nk", "nn", "ns", "nt", "nth", "nthr", "nz", "p", "ph", "phth", "pp", "pr", "ps", "pt", "pth", "q", "rb", "rchl", "rd", "rf", "rg", "rh", "rk", "rl", "rn", "rph", "rq", "rr", "rrh", "rs", "rt", "rv", "s", "sc", "sg", "sp", "sph", "spl", "ss", "st", "str", "t", "th", "tr", "v", "x", "z"]; 5 var nm5 = ["a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "a", "e", "i", "o", "u", "y", "ae", "aa", "ai", "au", "ea", "ee", "ei", "eo", "eu", "ia", "ie", "io", "iu", "ua", "ue", "ui", "ya", "ye", "yo"]; 6 var nm6 = ["aene", "an", "ane", "ar", "as", "ase", "asy", "ate", "eide", "ein", "eite", "el", "ene", "er", "ial", "id", "ide", "iene", "in", "ine", "iol", "ite", "ium", "oate", "ocin", "ol", "ole", "on", "one", "or", "ose", "ox", "oxin", "uene", "um", "ur", "ycin", "yde", "yl", "yme", "yn"]; 7 var br = ""; 8 9 function nameGen() { 10 $('#placeholder').css('textTransform', 'capitalize'); 11 var element = document.createElement("div"); 12 element.setAttribute("id", "result"); 13 for (i = 0; i < 10; i++) { 14 if (i < 4) { 15 rnd = Math.floor(Math.random() * nm1.length); 16 rnd2 = Math.floor(Math.random() * nm2.length); 17 rnd3 = Math.floor(Math.random() * nm3.length); 18 rnd4 = Math.floor(Math.random() * nm5.length); 19 rnd5 = Math.floor(Math.random() * nm4.length); 20 rnd6 = Math.floor(Math.random() * nm6.length); 21 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm5[rnd4] + nm4[rnd5] + nm6[rnd6]; 22 } else if (i < 7) { 23 rnd = Math.floor(Math.random() * nm1.length); 24 rnd2 = Math.floor(Math.random() * nm2.length); 25 rnd3 = Math.floor(Math.random() * nm3.length); 26 rnd4 = Math.floor(Math.random() * nm5.length); 27 rnd5 = Math.floor(Math.random() * nm4.length); 28 rnd6 = Math.floor(Math.random() * nm5.length); 29 rnd7 = Math.floor(Math.random() * nm4.length); 30 rnd8 = Math.floor(Math.random() * nm6.length); 31 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm5[rnd4] + nm4[rnd5] + nm5[rnd6] + nm4[rnd7] + nm6[rnd8]; 32 } else { 33 rnd = Math.floor(Math.random() * nm1.length); 34 rnd2 = Math.floor(Math.random() * nm2.length); 35 rnd3 = Math.floor(Math.random() * nm3.length); 36 rnd4 = Math.floor(Math.random() * nm5.length); 37 rnd5 = Math.floor(Math.random() * nm4.length); 38 rnd6 = Math.floor(Math.random() * nm5.length); 39 rnd7 = Math.floor(Math.random() * nm4.length); 40 rnd8 = Math.floor(Math.random() * nm5.length); 41 rnd9 = Math.floor(Math.random() * nm4.length); 42 rnd10 = Math.floor(Math.random() * nm6.length); 43 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm5[rnd4] + nm4[rnd5] + nm5[rnd6] + nm4[rnd7] + nm5[rnd8] + nm4[rnd9] + nm6[rnd10]; 44 } 45 br = document.createElement('br'); 46 element.appendChild(document.createTextNode(names)); 47 element.appendChild(br); 48 } 49 if (document.getElementById("result")) { 50 document.getElementById("placeholder").removeChild(document.getElementById("result")); 51 } 52 document.getElementById("placeholder").appendChild(element); 53 }