From 1ac507813dd08e0ceea67851465bad37ffe11eef Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Thu, 11 Jun 2020 09:16:41 +0900 Subject: [PATCH] Provide working solution --- app.js | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index f09cb70..32369fc 100644 --- a/app.js +++ b/app.js @@ -1 +1,94 @@ -console.log("Javascript is alive!"); +document.addEventListener('DOMContentLoaded',()=>{ + console.log("Javascript is alive!") + var greeting = document.getElementById("greeting") + greeting.innerHTML="Hello, World!" + var listelements = document.getElementsByTagName("li") + for (var i=0;i{ + var listitems = document.getElementsByTagName("li"); + for (var i=0;i{ + var selectedItem = document.querySelector(".selected") + selectedItem.classList.remove("selected") + var changer = document.querySelector("img:not(.img-changer)") + changer.src = "./images/panic.jpeg" + }) + + document.getElementById("ghosting").addEventListener("mouseover",(event)=>{ + event.target.remove() + }) + document.getElementById("resize").addEventListener("mouseover",(event)=>{ + event.target.style.width=event.target.offsetWidth*2+"px" + }) + document.getElementById("resize").addEventListener("mouseout",(event)=>{ + event.target.style.width=event.target.offsetWidth/2+"px" + }) + var keySequence = [] + + var arrayMatches = (arr1,arr2)=>{ + if (arr1.length!=arr2.length) { + return false; + } + for (var i=0;i{ + var keysListeningFor = [0,1,2,3,4,5,6,7,8,9] + if (keysListeningFor.includes(Number(event.key))) { + alert("I HATE NUMBERZZZ!") + } + keySequence.push(event.key) + if (keySequence.length>10) { + keySequence = keySequence.slice(1,11) + } + var konamiCodeArray = ["up","up","down","down","left","right","left","right","b","a"] + if (arrayMatches(konamiCodeArray,keySequence.map(val=>{ + var newval = val.replace("Arrow","") + newval = newval[0].toLowerCase() + newval.substr(1) + return newval + }))) { + alert("YOU ARE AN EVENT HANDLER GURUUUUUUUUU!") + } + }) +})