global: add formatter
This commit is contained in:
parent
eb6819bb76
commit
6c87abd4fc
19 changed files with 3925 additions and 288 deletions
|
|
@ -15,7 +15,6 @@ function initMiniPlayer() {
|
|||
const trackTitleEl = player.querySelector("track-title");
|
||||
const trackArtistEl = player.querySelector("track-artist");
|
||||
|
||||
|
||||
let isTransitioning = false;
|
||||
let currentTrackIndex = 0;
|
||||
let isPlaying = false;
|
||||
|
|
@ -65,9 +64,13 @@ function initMiniPlayer() {
|
|||
if (trackArtistEl) trackArtistEl.textContent = tracks[index].artist;
|
||||
|
||||
if (wasPlaying) {
|
||||
audio.addEventListener("loadeddata", () => {
|
||||
audio.play();
|
||||
}, { once: true });
|
||||
audio.addEventListener(
|
||||
"loadeddata",
|
||||
() => {
|
||||
audio.play();
|
||||
},
|
||||
{ once: true },
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -82,13 +85,15 @@ function initMiniPlayer() {
|
|||
};
|
||||
|
||||
const handlePrev = () => {
|
||||
const newIndex = currentTrackIndex === 0 ? tracks.length - 1 : currentTrackIndex - 1;
|
||||
const newIndex =
|
||||
currentTrackIndex === 0 ? tracks.length - 1 : currentTrackIndex - 1;
|
||||
loadTrack(newIndex);
|
||||
};
|
||||
|
||||
const handleNext = () => {
|
||||
isTransitioning = true;
|
||||
const newIndex = currentTrackIndex === tracks.length - 1 ? 0 : currentTrackIndex + 1;
|
||||
const newIndex =
|
||||
currentTrackIndex === tracks.length - 1 ? 0 : currentTrackIndex + 1;
|
||||
loadTrack(newIndex);
|
||||
};
|
||||
|
||||
|
|
@ -124,7 +129,6 @@ function initMiniPlayer() {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
audio.addEventListener("pause", () => {
|
||||
if (isTransitioning) return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue