new: Added music collection page

This commit is contained in:
2024-12-25 23:58:02 +08:00
parent 1c23f2ac25
commit 2986e30558
17 changed files with 1678 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
const bodyWrap = document.getElementById('body-wrap');
const playerWrap = document.getElementById('music-player-wrap');
syncWidth();
window.addEventListener('resize', syncWidth);
function syncWidth() {
playerWrap.style.width =window.getComputedStyle(bodyWrap).width;
}
function play(name, singer, coverSrc, musicSrc, lyricSrc) {
fetch(lyricSrc)
.then((res) => {
return res.text();
})
.then((data) => {
const musicData = musicSrc;
const lyricData = data;
MollyPlayer({
music: {
src: musicData,
lrc: lyricData,
cover: coverSrc,
title: name,
author: singer,
loop: true,
},
target: '#music-player',
autoplay: true,
});
});
}