narniaCentaurs.js (2161B)
1 function nameGen() { 2 var nm1 = ["agile", "arch", "bitter", "blank", "bold", "brass", "brave", "broken", "charge", "cloud", "cold", "copper", "copse", "court", "crown", "dark", "deep", "den", "diamond", "dim", "dirt", "dream", "drum", "dual", "dust", "earth", "earthen", "even", "fire", "flame", "fluke", "fog", "free", "frost", "ghost", "glass", "glen", "gold", "good", "grand", "great", "grey", "grim", "grove", "half", "heart", "ice", "ink", "iron", "kind", "light", "lightning", "lone", "long", "loud", "lunar", "mad", "mask", "meadow", "might", "mind", "mist", "moon", "mud", "night", "phase", "prime", "proud", "quiver", "rain", "rich", "river", "roon", "rough", "rush", "shadow", "silk", "silver", "single", "sky", "slim", "smoke", "snow", "solar", "spark", "star", "stark", "stone", "sun", "swift", "tall", "temper", "thunder", "wind", "wise", "wood", "world", "young"]; 3 var nm2 = ["arm", "back", "band", "bolt", "chance", "charge", "chest", "clap", "cloud", "clover", "coil", "crest", "crown", "dance", "dream", "drum", "edge", "fire", "flame", "grace", "grip", "heart", "hoof", "horn", "hunt", "light", "lock", "mane", "mask", "might", "mind", "mist", "pride", "reach", "rest", "ridge", "root", "run", "runner", "shine", "star", "stone", "storm", "tale", "trail", "veil", "web", "wish", "wit", "worth"]; 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.random() * nm1.length | 0; 10 rnd2 = Math.random() * nm2.length | 0; 11 if (nm1[rnd] === nm2[rnd2]) { 12 rnd2 = Math.random() * nm2.length | 0; 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 }