more modern js, more keyboard-controls #5

Merged
zotan merged 30 commits from ctucx/webmusic:master into master 2021-03-21 18:04:15 +01:00
Showing only changes of commit db8b55cadc - Show all commits

View file

@ -70,39 +70,39 @@ const initState = () => {
document.getElementById("repeatButton").addEventListener("click", toggleRepeat)
document.getElementById("continuousButton").addEventListener("click", toggleContinue)
audioPlayer.addEventListener("canplay", function () {
audioPlayer.addEventListener("canplay", () => {
audioPlayer.play();
});
audioPlayer.addEventListener("play", function () {
audioPlayer.addEventListener("play", () => {
setPlayerState("playing");
});
audioPlayer.addEventListener("pause", function () {
audioPlayer.addEventListener("pause", () => {
setPlayerState("paused");
});
audioPlayer.addEventListener("error", function () {
audioPlayer.addEventListener("error", () => {
setPlayerState("error loading track");
});
audioPlayer.addEventListener("ended", function () {
audioPlayer.addEventListener("ended", () => {
setPlayerState("idle");
nextTrack();
});
audioPlayer.addEventListener("timeupdate", function () {
audioPlayer.addEventListener("timeupdate", () => {
updatePlayerState();
});
dirElements.forEach(function(element){
dirElements.forEach((element) => {
element.id = id++;
});
fileElements.forEach(function(element){
fileElements.forEach((element) => {
element.id = id++;
element.addEventListener("click", function(event) {
element.addEventListener("click", (event) => {
event.preventDefault();
event.stopPropagation();
playSong(event.target.id);