add shitty fix for context menu
This commit is contained in:
parent
c9f639ba6c
commit
99accb6350
1 changed files with 14 additions and 3 deletions
17
js/events.js
17
js/events.js
|
|
@ -102,7 +102,7 @@ export function initializePlayerEvents(player, audioPlayer, scrobbler, ui) {
|
||||||
shuffleBtn.addEventListener('click', () => {
|
shuffleBtn.addEventListener('click', () => {
|
||||||
player.toggleShuffle();
|
player.toggleShuffle();
|
||||||
shuffleBtn.classList.toggle('active', player.shuffleActive);
|
shuffleBtn.classList.toggle('active', player.shuffleActive);
|
||||||
renderQueue(player);
|
if (window.renderQueueFunction) window.renderQueueFunction();
|
||||||
});
|
});
|
||||||
|
|
||||||
repeatBtn.addEventListener('click', () => {
|
repeatBtn.addEventListener('click', () => {
|
||||||
|
|
@ -364,11 +364,11 @@ export async function handleTrackAction(action, item, player, api, lyricsManager
|
||||||
|
|
||||||
if (action === 'add-to-queue') {
|
if (action === 'add-to-queue') {
|
||||||
player.addToQueue(item);
|
player.addToQueue(item);
|
||||||
renderQueue(player);
|
if (window.renderQueueFunction) window.renderQueueFunction();
|
||||||
showNotification(`Added to queue: ${item.title}`);
|
showNotification(`Added to queue: ${item.title}`);
|
||||||
} else if (action === 'play-next') {
|
} else if (action === 'play-next') {
|
||||||
player.addNextToQueue(item);
|
player.addNextToQueue(item);
|
||||||
renderQueue(player);
|
if (window.renderQueueFunction) window.renderQueueFunction();
|
||||||
showNotification(`Playing next: ${item.title}`);
|
showNotification(`Playing next: ${item.title}`);
|
||||||
} else if (action === 'track-mix') {
|
} else if (action === 'track-mix') {
|
||||||
if (item.mixes && item.mixes.TRACK_MIX) {
|
if (item.mixes && item.mixes.TRACK_MIX) {
|
||||||
|
|
@ -524,6 +524,17 @@ export async function handleTrackAction(action, item, player, api, lyricsManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function updateContextMenuLikeState(contextMenu, contextTrack) {
|
||||||
|
if (!contextMenu || !contextTrack) return;
|
||||||
|
|
||||||
|
const likeItem = contextMenu.querySelector('li[data-action="toggle-like"]');
|
||||||
|
if (!likeItem) return;
|
||||||
|
|
||||||
|
const { db } = await import('./db.js');
|
||||||
|
const isLiked = await db.isFavorite('track', contextTrack.id);
|
||||||
|
likeItem.textContent = isLiked ? 'Unlike' : 'Like';
|
||||||
|
}
|
||||||
|
|
||||||
export function initializeTrackInteractions(player, api, mainContent, contextMenu, lyricsManager, ui, scrobbler) {
|
export function initializeTrackInteractions(player, api, mainContent, contextMenu, lyricsManager, ui, scrobbler) {
|
||||||
let contextTrack = null;
|
let contextTrack = null;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue