1/* --------------------------------------------------------------- */ 2/* magic 8-ball scripting */ 3/* ----------------------------------------------------------------*/ 4function magic8ballClick() { 5 var answer = document.getElementById("magic8ball_answer"); 6 var inputText = document.getElementById("8ball-input"); 7 8 var ballresponses = [ 9 "It is certain.", 10 "It is decidedly so.", 11 "Without a doubt.", 12 "Yes - definitely.", 13 "You may rely on it.", 14 "As I see it, yes.", 15 "Most likely.", 16 "Outlook good.", 17 "Yes.", 18 "Signs point to yes.", 19 "Reply hazy, try again.", 20 "Ask again later.", 21 "Better not tell you now.", 22 "Cannot predict now.", 23 "Concentrate and ask again.", 24 "Don't count on it.", 25 "My reply is no.", 26 "My sources say no.", 27 "Outlook not so good.", 28 "Very doubtful.", 29 ]; 30 31 if (inputText.value.length > 1) { 32 var num = 33 (Math.floor(Math.random() * 1000) + Math.floor(Math.random() * 67) + Math.floor(Math.random() * 13)) % 34 ballresponses.length; 35 answer.innerText = ballresponses[num]; 36 answer.style.fontSize = "18px"; 37 answer.style.left = "10%"; 38 answer.style.width = "80%"; 39 inputText.value = ""; 40 } 41} 42 43/* check to see if user hit enter in cowsay window */ 44function check8BallEnter() { 45 var key = window.event.keyCode; 46 47 // If the user has pressed enter 48 if (key === 13) { 49 magic8ballClick(); 50 document.getElementById("8ball-input").value = document.getElementById("8ball-input").value + "\n*"; 51 document.getElementById("8ball-input").value = ""; 52 return false; 53 } 54}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.