Spaces:
Runtime error
Runtime error
style: replace play/pause emoji with SVG icons
Browse files- index.html +11 -9
index.html
CHANGED
|
@@ -342,7 +342,7 @@
|
|
| 342 |
</div>
|
| 343 |
<div id="waveform"></div>
|
| 344 |
<div class="playback-controls">
|
| 345 |
-
<button class="play-btn" id="play-btn" title="Play / Pause">
|
| 346 |
<span class="time-display" id="time-display">0:00 / 0:00</span>
|
| 347 |
<button class="download-btn" id="download-btn">⬇ Download</button>
|
| 348 |
</div>
|
|
@@ -414,9 +414,11 @@
|
|
| 414 |
updateTime();
|
| 415 |
if (!mainAudio.paused) requestAnimationFrame(updateMainProgress);
|
| 416 |
}
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
mainAudio.addEventListener("
|
|
|
|
|
|
|
| 420 |
mainAudio.addEventListener("timeupdate", updateTime);
|
| 421 |
|
| 422 |
playBtn.addEventListener("click", () => { stopFeedAudio(); mainAudio.paused ? mainAudio.play() : mainAudio.pause(); });
|
|
@@ -662,7 +664,7 @@
|
|
| 662 |
if (playingCard) {
|
| 663 |
playingCard.querySelectorAll(".mini-waveform .bar").forEach(b => b.style.background = "");
|
| 664 |
playingCard.classList.remove("playing");
|
| 665 |
-
playingCard.querySelector(".song-play-btn").
|
| 666 |
playingCard = null;
|
| 667 |
}
|
| 668 |
}
|
|
@@ -685,7 +687,7 @@
|
|
| 685 |
feedAudio = new Audio(audioUrl);
|
| 686 |
playingCard = card;
|
| 687 |
card.classList.add("playing");
|
| 688 |
-
card.querySelector(".song-play-btn").
|
| 689 |
feedAudio.play();
|
| 690 |
if (seekRatio != null) {
|
| 691 |
feedAudio.addEventListener("loadedmetadata", () => {
|
|
@@ -710,11 +712,11 @@
|
|
| 710 |
});
|
| 711 |
feedAudio.addEventListener("error", () => stopFeedAudio());
|
| 712 |
feedAudio.addEventListener("pause", () => {
|
| 713 |
-
if (playingCard === card) card.querySelector(".song-play-btn").
|
| 714 |
});
|
| 715 |
feedAudio.addEventListener("play", () => {
|
| 716 |
if (playingCard === card) {
|
| 717 |
-
card.querySelector(".song-play-btn").
|
| 718 |
requestAnimationFrame(updateProgress);
|
| 719 |
}
|
| 720 |
});
|
|
@@ -746,7 +748,7 @@
|
|
| 746 |
: '';
|
| 747 |
card.innerHTML = `
|
| 748 |
<div class="song-card-top">
|
| 749 |
-
<button class="song-play-btn">
|
| 750 |
${thumbHtml}
|
| 751 |
<div class="song-title">${esc(song.title || "Untitled")}</div>
|
| 752 |
<div class="song-tags">${esc(song.tags || "")}</div>
|
|
|
|
| 342 |
</div>
|
| 343 |
<div id="waveform"></div>
|
| 344 |
<div class="playback-controls">
|
| 345 |
+
<button class="play-btn" id="play-btn" title="Play / Pause"><svg width="10" height="12" viewBox="0 0 10 12" fill="currentColor"><path d="M0 0l10 6-10 6z"/></svg></button>
|
| 346 |
<span class="time-display" id="time-display">0:00 / 0:00</span>
|
| 347 |
<button class="download-btn" id="download-btn">⬇ Download</button>
|
| 348 |
</div>
|
|
|
|
| 414 |
updateTime();
|
| 415 |
if (!mainAudio.paused) requestAnimationFrame(updateMainProgress);
|
| 416 |
}
|
| 417 |
+
const playIcon = '<svg width="10" height="12" viewBox="0 0 10 12" fill="currentColor"><path d="M0 0l10 6-10 6z"/></svg>';
|
| 418 |
+
const pauseIcon = '<svg width="10" height="12" viewBox="0 0 10 12" fill="currentColor"><rect x="0" y="0" width="3" height="12"/><rect x="7" y="0" width="3" height="12"/></svg>';
|
| 419 |
+
mainAudio.addEventListener("play", () => { playBtn.innerHTML = pauseIcon; requestAnimationFrame(updateMainProgress); });
|
| 420 |
+
mainAudio.addEventListener("pause", () => { playBtn.innerHTML = playIcon; });
|
| 421 |
+
mainAudio.addEventListener("ended", () => { playBtn.innerHTML = playIcon; waveformEl.querySelectorAll(".bar").forEach(b => b.style.background = ""); });
|
| 422 |
mainAudio.addEventListener("timeupdate", updateTime);
|
| 423 |
|
| 424 |
playBtn.addEventListener("click", () => { stopFeedAudio(); mainAudio.paused ? mainAudio.play() : mainAudio.pause(); });
|
|
|
|
| 664 |
if (playingCard) {
|
| 665 |
playingCard.querySelectorAll(".mini-waveform .bar").forEach(b => b.style.background = "");
|
| 666 |
playingCard.classList.remove("playing");
|
| 667 |
+
playingCard.querySelector(".song-play-btn").innerHTML = '<svg width="8" height="10" viewBox="0 0 10 12" fill="currentColor"><path d="M0 0l10 6-10 6z"/></svg>';
|
| 668 |
playingCard = null;
|
| 669 |
}
|
| 670 |
}
|
|
|
|
| 687 |
feedAudio = new Audio(audioUrl);
|
| 688 |
playingCard = card;
|
| 689 |
card.classList.add("playing");
|
| 690 |
+
card.querySelector(".song-play-btn").innerHTML = '<svg width="8" height="10" viewBox="0 0 10 12" fill="currentColor"><rect x="0" y="0" width="3" height="12"/><rect x="7" y="0" width="3" height="12"/></svg>';
|
| 691 |
feedAudio.play();
|
| 692 |
if (seekRatio != null) {
|
| 693 |
feedAudio.addEventListener("loadedmetadata", () => {
|
|
|
|
| 712 |
});
|
| 713 |
feedAudio.addEventListener("error", () => stopFeedAudio());
|
| 714 |
feedAudio.addEventListener("pause", () => {
|
| 715 |
+
if (playingCard === card) card.querySelector(".song-play-btn").innerHTML = '<svg width="8" height="10" viewBox="0 0 10 12" fill="currentColor"><path d="M0 0l10 6-10 6z"/></svg>';
|
| 716 |
});
|
| 717 |
feedAudio.addEventListener("play", () => {
|
| 718 |
if (playingCard === card) {
|
| 719 |
+
card.querySelector(".song-play-btn").innerHTML = '<svg width="8" height="10" viewBox="0 0 10 12" fill="currentColor"><rect x="0" y="0" width="3" height="12"/><rect x="7" y="0" width="3" height="12"/></svg>';
|
| 720 |
requestAnimationFrame(updateProgress);
|
| 721 |
}
|
| 722 |
});
|
|
|
|
| 748 |
: '';
|
| 749 |
card.innerHTML = `
|
| 750 |
<div class="song-card-top">
|
| 751 |
+
<button class="song-play-btn"><svg width="8" height="10" viewBox="0 0 10 12" fill="currentColor"><path d="M0 0l10 6-10 6z"/></svg></button>
|
| 752 |
${thumbHtml}
|
| 753 |
<div class="song-title">${esc(song.title || "Untitled")}</div>
|
| 754 |
<div class="song-tags">${esc(song.tags || "")}</div>
|