From 1f70381f6f04e509d1f66e32cb6e0e50c6447ad2 Mon Sep 17 00:00:00 2001 From: Grason Chan Date: Sat, 10 Jul 2021 01:50:23 +0800 Subject: [PATCH] refactor(Turntable): refactor the "Enable blur backdrop" feature You can right click in the Full App Display to find it. --- Turntable/rotateTurntable.js | 56 ++++++++++++++---------------------- Turntable/user.css | 28 +++++++++++------- 2 files changed, 38 insertions(+), 46 deletions(-) diff --git a/Turntable/rotateTurntable.js b/Turntable/rotateTurntable.js index 40eaa84..78c57fd 100644 --- a/Turntable/rotateTurntable.js +++ b/Turntable/rotateTurntable.js @@ -7,8 +7,7 @@ window.addEventListener("load", rotateTurntable = () => { } const adModalStyle = document.createElement("style"); - const STYLE_FOR_AD_MODAL = -` + const STYLE_FOR_AD_MODAL = ` .ReactModalPortal { display: none } @@ -29,59 +28,45 @@ window.addEventListener("load", rotateTurntable = () => { } } - function handleFadControl(event) { - event.stopPropagation(); - } - function handleFadDblclick() { const fadControlsBtns = document.querySelectorAll("#fad-controls button"); for (const fadControl of fadControlsBtns) { - fadControl.addEventListener("dblclick", handleFadControl); + fadControl.addEventListener("dblclick", event => event.stopPropagation()); } } function handleConfigSwitch() { - const genericModal = document.querySelector("generic-modal"); - - document.querySelectorAll("#popup-config-container > div")[0].remove(); - - handleInitalStatus(genericModal); - } - - function handleInitalStatus(genericModal) { - genericModal.remove(); + document.querySelector("generic-modal").remove(); handleRotate(); handleFadDblclick(); } - function handleBackdrop() { - const fadClassList = document.querySelector("#full-app-display").classList; - + function handleBackdrop(fullAppDisplay, setBlurBackdropBtn) { if (!+localStorage.getItem("enableBlurFad")) { - fadClassList.add("blur-fad"); + fullAppDisplay.setAttribute("data-is-blur-fad", "true"); + setBlurBackdropBtn.classList.remove("disabled"); localStorage.setItem("enableBlurFad", "1"); } else { - fadClassList.remove("blur-fad"); + fullAppDisplay.setAttribute("data-is-blur-fad", "false"); + setBlurBackdropBtn.classList.add("disabled"); localStorage.setItem("enableBlurFad", "0"); } } - function handleContextMenu() { - const configPopupCloseBtn = document.querySelector(".main-trackCreditsModal-closeBtn"); + function handleContextMenu(fullAppDisplay) { const configContainer = document.querySelector("#popup-config-container"); const settingRowReferenceNode = document.querySelectorAll("#popup-config-container > div")[0]; const settingRowContainer = document.createElement("div"); - const settingRow = -` + const settingRow = `
-