narniaGiants.js (2326B)
1 function nameGen() { 2 var nm1 = ["anger", "band", "basin", "bitter", "bother", "boulder", "bramble", "bubble", "bumble", "butter", "button", "cannon", "cattle", "cloud", "cobble", "common", "copper", "crumble", "dabble", "dimple", "double", "garden", "good", "grand", "ground", "long", "lumber", "marble", "middle", "moon", "mud", "mumble", "night", "nimble", "pebble", "plane", "pocket", "powder", "puddle", "ramble", "range", "rich", "riddle", "river", "rock", "rumble", "scratch", "shadow", "shock", "silver", "simple", "slumber", "spark", "stone", "storm", "struggle", "tackle", "thunder", "trouble", "tumble", "weather", "whistle", "wild", "wobble", "wonder"]; 3 var nm2 = ["back", "balance", "basin", "bead", "berry", "block", "bottom", "boulder", "branch", "breath", "bubble", "buffer", "buffin", "button", "chin", "cloud", "coat", "cover", "crown", "cushion", "dance", "dock", "drag", "dream", "drum", "feature", "foot", "force", "friend", "grace", "growth", "guard", "guide", "habit", "hand", "heart", "hide", "kin", "kind", "knot", "link", "loaf", "lock", "lumber", "marble", "march", "mask", "might", "mind", "mountain", "move", "noise", "paint", "patch", "plate", "plot", "point", "pound", "pride", "rest", "rhythm", "ride", "roll", "root", "run", "rush", "scratch", "shift", "shine", "shock", "shot", "slumber", "spark", "spell", "stand", "storm", "stream", "string", "swing", "thunder", "tool", "tremor", "tune", "wave", "weather", "wind", "wire", "zephyr", "zone"]; 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 }