ghostTownNames.js (2164B)
1 function nameGen() { 2 var nm1 = ["ail", "alder", "amber", "arach", "ash", "ashen", "bane", "bare", "barren", "bitter", "black", "bleak", "bligh", "blight", "boon", "brow", "burn", "cease", "char", "charring", "ebon", "onyx", "cinder", "clear", "cold", "crag", "cri", "crow", "dark", "dawn", "death", "deci", "demo", "dew", "dia", "diabo", "dire", "dread", "dusk", "dust", "ember", "fall", "fallen", "far", "farrow", "fes", "fester", "fire", "flame", "flaw", "fog", "fore", "forge", "forging", "frost", "full", "gaze", "ghos", "gloom", "glum", "glumming", "gore", "gray", "grim", "grimming", "hard", "hazel", "il", "ill", "kil", "lo", "lon", "lone", "low", "mad", "mali", "mar", "mause", "maw", "mise", "mourn", "mourning", "mur", "murk", "nec", "necro", "nether", "ni", "nigh", "night", "pyre", "reaper", "reaver", "ridge", "rip", "ripping", "saur", "scorch", "ser", "serpen", "shadow", "shar", "shard", "shel", "shell", "sla", "slate", "sly", "spi", "spine", "talon", "thorn", "thorne", "vile", "vin", "vine", "wear", "weep", "weeping", "wither", "woe", "wrath"]; 3 var nm2 = ["borough", "brook", "brooke", "burg", "burgh", "burn", "bury", "fall", "ford", "fort", "gate", "helm", "mere", "mire", "moor", "more", "moure", "mourn", "rest", "ridge", "thorn", "thorne", "ton", "town", "ville"]; 4 var br = ""; 5 $('#placeholder').css('textTransform', 'capitalize'); 6 var element = document.createElement("div"); 7 element.setAttribute("id", "result"); 8 for (i = 0; i < 10; i++) { 9 rnd = Math.floor(Math.random() * nm1.length); 10 rnd2 = Math.floor(Math.random() * nm2.length); 11 while (nm1[rnd] === nm2[rnd2]) { 12 rnd2 = Math.floor(Math.random() * nm2.length); 13 } 14 names = nm1[rnd] + nm2[rnd2]; 15 nm1.splice(rnd, 1); 16 nm2.splice(rnd2, 1); 17 br = document.createElement('br'); 18 element.appendChild(document.createTextNode(names)); 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 }