text: const musicContainer=document.getElementById("music-container"),playBtn=document.getElementById("play"),prevBtn=document.getElementById("prev"),nextBtn=document.getElementById("next"),audio=document.getElementById("audio"),progress=document.getElementById("progress"),progressContainer=document.getElementById("progress-container"),title=document.getElementById("title"),cover=document.getElementById("cover"),songs=["roadtrip","mask","change my clothes"];let songIndex=0;var urls=[];const coverUrls=["https://i.ytimg.com/vi/Ow_PNMtMGhU/hqdefault.jpg","https://i.ytimg.com/vi/Gp9gFXf56yQ/hqdefault.jpg","https://i.ytimg.com/vi/kxWUcCUfDuE/hqdefault.jpg"];function getDefaultLink(){return urls[0]}function loadSong(e){title.innerHTML=songs[e],audio.src=urls[e],cover.src=coverUrls[e]}function playSong(){musicContainer.classList.add("play"),playBtn.querySelector("i.fas").classList.remove("fa-play"),playBtn.querySelector("i.fas").classList.add("fa-pause"),audio.play()}function pauseSong(){musicContainer.classList.remove("play"),playBtn.querySelector("i.fas").classList.add("fa-play"),playBtn.querySelector("i.fas").classList.remove("fa-pause"),audio.pause()}function prevSong(){--songIndex<0&&(songIndex=songs.length-1),loadSong(songIndex),playSong()}function nextSong(){++songIndex>songs.length-1&&(songIndex=0),loadSong(songIndex),playSong()}function updateProgress(e){const{duration:t,currentTime:n}=e.srcElement,s=n/t*100;progress.style.width=`${s}%`}function setProgress(e){const t=this.clientWidth,n=e.offsetX,s=audio.duration;audio.currentTime=n/t*s}async function registerListeners(){let e=await fetch("https://269bdcbf-8e2f-4567-bfd0-5179d00382ba.id.repl.co/dream-music");urls=await e.json(),document.getElementById("audio").src=urls[0],playBtn.addEventListener("click",()=>{musicContainer.classList.contains("play")?pauseSong():playSong()}),prevBtn.addEventListener("click",prevSong),nextBtn.addEventListener("click",nextSong),audio.addEventListener("timeupdate",updateProgress),progressContainer.addEventListener("click",setProgress),audio.addEventListener("ended",nextSong)}"serviceWorker"in navigator&&navigator.serviceWorker.register("/service-worker.js"),document.getElementById("cover").src=coverUrls[0],document.getElementById("title").innerHTML="roadtrip",registerListeners();
  