Explorar o código

ref!: remove sideBarMini observer

Sv443 hai 10 horas
pai
achega
ac9a8b0579
Modificáronse 1 ficheiros con 3 adicións e 14 borrados
  1. 3 14
      src/observers.ts

+ 3 - 14
src/observers.ts

@@ -27,7 +27,6 @@ export type YTMObserverName =
   | "navBar"                 // the navigation / title bar at the top of the page
   | "mainPanel"              // the main content panel - includes things like the video element
   | "sideBar"                // the sidebar on the left side of the page
-  | "sideBarMini"            // the minimized sidebar on the left side of the page
   | "sidePanel"              // the side panel on the right side of the /watch page
   | "playerBar"              // media controls bar at the bottom of the page
   | "playerBarInfo"          // song title, artist, album, etc. inside the player bar
@@ -51,6 +50,7 @@ const defaultObserverOptions: SelectorObserverOptions = {
   disableOnNoListeners: false,
   enableOnAddListener: false,
   defaultDebounce: 150,
+  defaultDebounceType: "immediate",
 };
 
 /** Global SelectorObserver instances usable throughout the script for improved performance */
@@ -172,6 +172,8 @@ export function initObservers() {
       const sidebarSelector = "ytmusic-app-layout tp-yt-app-drawer";
       globservers.sideBar = new SelectorObserver(sidebarSelector, {
         ...defaultObserverOptions,
+        attributes: true,
+        childList: true,
         subtree: true,
       });
 
@@ -179,19 +181,6 @@ export function initObservers() {
         listener: () => globservers.sideBar.enable(),
       });
 
-      //#region sideBarMini
-      // -> the minimized sidebar on the left side of the page
-      //    enabled by "body"
-      const sideBarMiniSelector = "ytmusic-app-layout #mini-guide";
-      globservers.sideBarMini = new SelectorObserver(sideBarMiniSelector, {
-        ...defaultObserverOptions,
-        subtree: true,
-      });
-
-      globservers.body.addListener(sideBarMiniSelector, {
-        listener: () => globservers.sideBarMini.enable(),
-      });
-
       //#region sidePanel
       // -> the side panel on the right side of the /watch page
       //    enabled by "body"