From adf523cc98169358f305504ef3a0bb5ecdd95934 Mon Sep 17 00:00:00 2001 From: Grason Chan Date: Fri, 29 Oct 2021 23:48:28 +0800 Subject: [PATCH] fix(Turntable): automatically update the song preview when toggle the Shuffle in some scenes - toggle the Shuffle in the Touch Bar - Connect to a device --- Turntable/rotateTurntable.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Turntable/rotateTurntable.js b/Turntable/rotateTurntable.js index fd00d62..d234889 100644 --- a/Turntable/rotateTurntable.js +++ b/Turntable/rotateTurntable.js @@ -251,6 +251,14 @@ window.addEventListener("load", rotateTurntable = () => { handleRotate("load"); + const shuffleBtn = document.querySelector(".main-shuffleButton-button"); + const shuffleObserver = new MutationObserver(() => { + setTimeout(handleTracksNamePreview, 500); + }); + shuffleObserver.observe(shuffleBtn, { + attributes: true, + }); + Spicetify.Player.addEventListener("onplaypause", () => handleRotate("playpause")); Spicetify.Player.addEventListener("songchange", () => { setTimeout(() => {