mirror of
https://github.com/morpheusthewhite/spicetify-themes.git
synced 2024-11-25 04:12:29 +01:00
fix(Turntable): hide the song preview when the queue is the same song
This commit is contained in:
parent
9157e1dade
commit
a2973f463a
@ -96,32 +96,25 @@ window.addEventListener("load", rotateTurntable = () => {
|
|||||||
|
|
||||||
function handleTracksNamePreview() {
|
function handleTracksNamePreview() {
|
||||||
const prevTracks = Spicetify.Queue.prevTracks;
|
const prevTracks = Spicetify.Queue.prevTracks;
|
||||||
|
const currentTrack = Spicetify.Queue.track;
|
||||||
const nextTracks = Spicetify.Queue.nextTracks;
|
const nextTracks = Spicetify.Queue.nextTracks;
|
||||||
|
|
||||||
// let prevTracksIndexRefer = 1;
|
|
||||||
// let nextTracksIndexRefer = 0;
|
|
||||||
|
|
||||||
// while (
|
|
||||||
// prevTracks[prevTracks.length - prevTracksIndexRefer].metadata.hidden
|
|
||||||
// ||
|
|
||||||
// prevTracks[prevTracks.length - prevTracksIndexRefer].provider == "ad"
|
|
||||||
// ) ++prevTracksIndexRefer;
|
|
||||||
// previousSong.innerHTML = `< ${prevTracks[prevTracks.length - prevTracksIndexRefer].metadata.title}`;
|
|
||||||
|
|
||||||
// while (
|
|
||||||
// nextTracks[nextTracksIndexRefer].metadata.hidden
|
|
||||||
// ||
|
|
||||||
// nextTracks[nextTracksIndexRefer].provider == "ad"
|
|
||||||
// ) ++nextTracksIndexRefer;
|
|
||||||
// nextSong.innerHTML = `${nextTracks[nextTracksIndexRefer].metadata.title} >`;
|
|
||||||
|
|
||||||
trackCondition = element => !element.contextTrack.metadata.hidden && element.provider != "ad";
|
trackCondition = element => !element.contextTrack.metadata.hidden && element.provider != "ad";
|
||||||
|
|
||||||
const prevTrack = prevTracks.slice().reverse().find(trackCondition);
|
const prevTrack = prevTracks.slice().reverse().find(trackCondition);
|
||||||
previousSong.innerHTML = `< ${prevTrack.contextTrack.metadata.title}`;
|
|
||||||
|
|
||||||
const nextTrack = nextTracks.find(trackCondition);
|
const nextTrack = nextTracks.find(trackCondition);
|
||||||
nextSong.innerHTML = `${nextTrack.contextTrack.metadata.title} >`;
|
|
||||||
|
const prevTrackTitle = prevTrack.contextTrack.metadata.title;
|
||||||
|
const currentTrackTitle = currentTrack.contextTrack.metadata.title;
|
||||||
|
const nextTrackTitle = nextTrack.contextTrack.metadata.title;
|
||||||
|
|
||||||
|
if (currentTrackTitle === prevTrackTitle && currentTrackTitle === nextTrackTitle) {
|
||||||
|
previousSong.innerHTML = "";
|
||||||
|
nextSong.innerHTML = "";
|
||||||
|
} else {
|
||||||
|
previousSong.innerHTML = `< ${prevTrackTitle}`;
|
||||||
|
nextSong.innerHTML = `${nextTrackTitle} >`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleConfigSwitch() {
|
function handleConfigSwitch() {
|
||||||
|
Loading…
Reference in New Issue
Block a user