winterTowns.js (2492B)
1 var nm2 = ["aval", "bare", "bleak", "bliz", "chill", "clear", "cloud", "cold", "cristal", "crystal", "dark", "drift", "frost", "gliss", "ice", "moon", "north", "shiver", "sleet", "snow", "storm", "that", "thaw", "therm", "whit", "white", "wild", "wind", "winter", "wit", "wolf", "yce"]; 2 var nm3 = ["band", "barrow", "bell", "born", "borough", "bourne", "breach", "break", "chill", "cliff", "crest", "dale", "denn", "drift", "fall", "fell", "field", "ford", "fort", "frost", "gard", "garde", "glen", "grasp", "grave", "guard", "hallow", "ham", "hand", "helm", "hill", "hold", "holde", "hollow", "horn", "host", "keep", "maw", "mire", "mond", "moor", "more", "pass", "peak", "point", "port", "reach", "rest", "scar", "shield", "spell", "spire", "storm", "strand", "tide", "vale", "vault", "vein", "ville", "wall", "wallow", "ward", "watch", "wich"]; 3 4 function nameGen() { 5 var nm1 = ["Arcta", "Arcti", "Avala", "Avalan", "Blizz", "Blyz", "Boots", "Brisque", "Chill", "Chillis", "Cristal", "Cryo", "Crystal", "Drift", "Firn", "Flaike", "Flake", "Flo", "Flurris", "Frigid", "Fross", "Frost", "Frostbite", "Fyre", "Glace", "Glacia", "Glacier", "Glacis", "Glaize", "Gliss", "Hayle", "Hearth", "Hiber", "Hiver", "Ice", "Iglis", "Lanche", "Melte", "Mitten", "Mittens", "Névé", "Neige", "Onding", "Quilt", "Rime", "Shiver", "Sleat", "Sleath", "Sled", "Sledge", "Sleet", "Slush", "Snift", "Sno", "Snow", "Solstice", "Thaw", "Thawe", "Thermia", "Thermis", "Thermos", "Wind", "Winde", "Winter", "Wool", "Wynter", "Yce"]; 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 if (i < 4) { 12 rnd = Math.random() * nm1.length | 0; 13 names = nm1[rnd]; 14 nm1.splice(rnd, 1); 15 } else { 16 rnd = Math.random() * nm2.length | 0; 17 rnd2 = Math.random() * nm3.length | 0; 18 while (nm2[rnd] === nm3[rnd2]) { 19 rnd2 = Math.floor(Math.random() * nm3.length); 20 } 21 names = nm2[rnd] + nm3[rnd2]; 22 } 23 br = document.createElement('br'); 24 element.appendChild(document.createTextNode(names)); 25 element.appendChild(br); 26 } 27 if (document.getElementById("result")) { 28 document.getElementById("placeholder").removeChild(document.getElementById("result")); 29 } 30 document.getElementById("placeholder").appendChild(element); 31 }