Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ELDRAZI-17 authored Mar 30, 2024
1 parent 3c776a8 commit af79ee5
Showing 1 changed file with 83 additions and 2 deletions.
85 changes: 83 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ function playAudio(soundId) {
audio.play();
}

function refreshPage() {
location.reload();
function stopAllAudio() {
var allAudio = document.querySelectorAll('audio');
allAudio.forEach(function(audio) {
audio.pause();
audio.currentTime = 0;
});
}

var fullscreenBtn = document.getElementById('fullscreen-btn');
Expand Down Expand Up @@ -42,3 +46,80 @@ function exitFullscreen() {
document.msExitFullscreen();
}
}

document.addEventListener("keydown", function(event) {
switch(event.key) {

case "a":
playAudio('work_it');
break;

case "q":
playAudio('harder');
break;

case "z":
playAudio('make_it');
break;

case "s":
playAudio('better');
break;

case "e":
playAudio('do_it');
break;

case "d":
playAudio('faster');
break;

case "r":
playAudio('makes_us');
break;

case "f":
playAudio('stronger');
break;

case "t":
playAudio('more_than');
break;

case "g":
playAudio('ever');
break;

case "y":
playAudio('hour');
break;

case "h":
playAudio('after');
break;

case "u":
playAudio('our');
break;

case "j":
playAudio('work_is');
break;

case "i":
playAudio('never');
break;

case "k":
playAudio('over');
break;

case "w":
playAudio('all');
break;

case "x":
playAudio('all_2');
break;
}
});

0 comments on commit af79ee5

Please sign in to comment.