drWhoDalekNames.js (1283B)
1 var nm1 = ["C", "Ch", "D", "Dh", "G", "Gh", "K", "Kh", "R", "S", "Th", "V"]; 2 var nm2 = ["a", "aa", "e", "a", "e", "a", "e", "i", "o"]; 3 var nm3 = ["c", "d", "k", "m", "n", "r", "s", "ss", "st", "t", "th", "y"]; 4 5 function nameGen() { 6 $('#placeholder').css('textTransform', 'capitalize'); 7 var br = ""; 8 var element = document.createElement("div"); 9 element.setAttribute("id", "result"); 10 var ext = Math.floor(Math.random() * 150); 11 for (i = 0; i < 10; i++) { 12 if (ext === 1) { 13 names = "Exterminate! Exterminate! Exterminate!"; 14 if (i === 9) { 15 names = "Just kidding. :) Enjoy this Easter egg." 16 } 17 } else { 18 rnd = Math.floor(Math.random() * nm1.length); 19 rnd2 = Math.floor(Math.random() * nm2.length); 20 rnd3 = Math.floor(Math.random() * nm3.length); 21 names = nm1[rnd] + nm2[rnd2] + nm3[rnd3]; 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 }