Add more types of pop-up to this HTML <html> <head> <title>Pop-up Closer</title> </head>…
- User
Add more types of pop-up to this HTML
function game() { var types = ["annoying", "mine", "clippy", "checkbox", "pthue"]; var randomType = types[Math.floor(Math.random() * types.length)]; switch(randomType) { case "annoying": var annoyingPopup = confirm("An annoying pop-up is in your way. Click OK to close it."); if(annoyingPopup){ alert("You earned 10 points!"); } break; case "mine": var minePopup = prompt("Uh oh! It's a mine trap! You need to close it by typing 'close' to avoid getting a BSOD. Type here: "); if(minePopup === "close"){ alert("You earned 10 points!"); } else { console.log("BSOD: Blue Screen Of Death"); setTimeout(function(){location.reload()},500); } break; case "clippy": var clippyPopup = confirm("Hey! It's Clippy! He will say a random quote. Click OK to hear his quote."); var clippyQuotes = ["It looks like you're trying to close me. Would you like help with that?", "Did you know that CTRL + W will close a tab?", "I may be annoying, but at least I'm not a pop-up ad.", "If you can read this, you're too close.", "Closing me will earn you double points!"]; var randomQuote = clippyQuotes[Math.floor(Math.random() * clippyQuotes.length)]; alert(randomQuote); if(randomQuote === clippyQuotes[1]) { alert("Type 'close' to close Clippy! You need to do this to earn double points."); var closify = prompt("Type 'close': "); if(closify === "close") { alert("You earned 20 points!"); } else { console.log("BSOD: Blue Screen Of Death"); setTimeout(function(){location.reload()},500); } } else{ alert("You earned 10 points!"); } break; case "checkbox": var checkboxPopup = confirm("A checkbox pop-up! Click 'OK' to close the pop-up."); if(checkboxPopup){ alert("You earned 10 points!"); } break; case "pthue": var pthuePopup = confirm("PTHUE! It's in your way! Close it by clicking 'OK'."); if(pthuePopup){ alert("You earned 10 points!"); } break; } setTimeout(game,2000); }
- Assistant
case "advertisement": var adPopup = confirm("An advertisement is in your way. Click 'OK' to close it and continue playing for free!"); if(adPopup){ alert("You earned 10 points!"); } break; case "video": var videoPopup = confirm("A video ad is playing. Click 'OK' to skip the ad."); if(videoPopup){ alert("You earned 10 points!"); } break; case "captcha": var captchaPopup = prompt("Please enter the characters you see in the box below to close the pop-up:"); if(captchaPopup) { alert("You earned 10 points!"); } else { console.log("BSOD: Blue Screen Of Death"); setTimeout(function(){location.reload()},500); } break;