fix: 收藏 (#301)

This commit is contained in:
52fisher 2024-12-08 16:13:42 +08:00 committed by GitHub
parent e434faf684
commit baedee5638
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 26 deletions

View File

@ -189,7 +189,7 @@ progress::-webkit-progress-value {
.button-group { .button-group {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin: 15px 0; margin: 5px 0;
} }
.player-controls { .player-controls {
@ -285,12 +285,12 @@ textarea {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
/* 媒体查询 屏幕宽度小于440px时 */
@media screen and (max-width: 440px) { @media screen and (max-width: 440px) {
.player{ .player{
width: 90%; width: 90%;
} }
.footer {
position: relative;
}
} }

View File

@ -71,14 +71,16 @@ function togglePlayMode(isSend = true) {
} }
function addToFavorites() { function addToFavorites() {
const isLiked = $(".favorite").hasClass("favorite-active");
const cmd = $(".favorite").hasClass("favorite-active") const cmd = isLiked? "取消收藏": "加入收藏";
? "取消收藏" if (isLiked) {
: "加入收藏";
if ($(".favorite").hasClass("favorite-active")) {
$(".favorite").removeClass("favorite-active"); $(".favorite").removeClass("favorite-active");
// 取消收藏
favoritelist = favoritelist.filter((item) => item != $("#music_name").val());
} else { } else {
$(".favorite").addClass("favorite-active"); $(".favorite").addClass("favorite-active");
// 加入收藏
favoritelist.push($("#music_name").val());
} }
sendcmd(cmd); sendcmd(cmd);
} }