fix(Turntable): black screen and the song preview disappear when toggle the full app display (#718)

* fix(Turntable): black screen when exit the Full App Display

* fix(Turntable): song preview disappear since the second active the Full App Display
This commit is contained in:
Grason Chan 2022-04-28 18:03:23 +08:00 committed by GitHub
parent 65443477b3
commit 95fd6ed8e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -217,30 +217,17 @@ window.addEventListener("load", rotateTurntable = () => {
setBlurBackdropBtn.addEventListener("click", () => handleBackdrop(fullAppDisplay, setBlurBackdropBtn)); setBlurBackdropBtn.addEventListener("click", () => handleBackdrop(fullAppDisplay, setBlurBackdropBtn));
} }
function handleMainInterface(fromActive, topbarContentFadeIn) { // Todo
const mainInterface = document.querySelector("#main"); function handleToggleFad(isActive) {
const mainPlayBtn = document.querySelector(".main-playButton-PlayButton"); if (isActive) {
const mainTopbarTitle = document.querySelector(".main-entityHeader-topbarTitle"); document.body.append(adModalStyle);
return;
}
const billboard = document.querySelector("#view-billboard-ad"); const billboard = document.querySelector("#view-billboard-ad");
if (fromActive) { billboard?.closest(".ReactModalPortal").remove();
if (!topbarContentFadeIn) { adModalStyle.remove();
mainPlayBtn?.style.setProperty("opacity", "0", "important");
mainTopbarTitle?.style.setProperty("opacity", "0", "important");
}
mainInterface.style.display = "none";
document.body.append(adModalStyle);
} else {
mainInterface.style.display = "block";
billboard?.closest(".ReactModalPortal").remove();
adModalStyle.remove();
setTimeout(() => {
mainPlayBtn?.style.removeProperty("opacity");
mainTopbarTitle?.style.removeProperty("opacity");
}, 250);
}
} }
handleRotate("load"); handleRotate("load");
@ -303,23 +290,23 @@ window.addEventListener("load", rotateTurntable = () => {
nextSong.addEventListener("dblclick", handleFadBtn); nextSong.addEventListener("dblclick", handleFadBtn);
fadBtn.addEventListener("click", () => { fadBtn.addEventListener("click", () => {
const topbarContentFadeIn = document.querySelector(".main-entityHeader-topbarContentFadeIn");
const fullAppDisplay = document.querySelector("#full-app-display"); const fullAppDisplay = document.querySelector("#full-app-display");
fullAppDisplay.appendChild(songPreviewContainer);
if (!clickedFadBtn) { if (!clickedFadBtn) {
if (+localStorage.getItem("enableBlurFad")) fullAppDisplay.dataset.isBlurFad = "true"; if (+localStorage.getItem("enableBlurFad")) fullAppDisplay.dataset.isBlurFad = "true";
fullAppDisplay.appendChild(songPreviewContainer);
handleFadControl(); handleFadControl();
fullAppDisplay.addEventListener("contextmenu", () => handleContextMenu(fullAppDisplay), { once: true }); fullAppDisplay.addEventListener("contextmenu", () => handleContextMenu(fullAppDisplay), { once: true });
fullAppDisplay.addEventListener("dblclick", () => handleMainInterface()); // fullAppDisplay.addEventListener("dblclick", () => handleToggleFad());
clickedFadBtn = true; clickedFadBtn = true;
} }
handleMainInterface("active", topbarContentFadeIn); // handleToggleFad(true);
handleIcons(); handleIcons();
handleFadHeart(); handleFadHeart();
handleTracksNamePreview(); handleTracksNamePreview();