Browse Source

ref: move close icon

Sven 1 year ago
parent
commit
b2d20db93b
4 changed files with 8 additions and 7 deletions
  1. 0 0
      assets/close.png
  2. 0 5
      src/features/layout.ts
  3. 1 1
      src/features/menu/menu_old.ts
  4. 7 1
      src/utils.ts

+ 0 - 0
assets/icon/close.png → assets/close.png


+ 0 - 5
src/features/layout.ts

@@ -126,16 +126,13 @@ async function addQueueButtons(queueItem: HTMLElement) {
     if(songInfo.dataset.bytmLyrics && songInfo.dataset.bytmLyrics.length > 0)
       lyricsUrl = songInfo.dataset.bytmLyrics;
     else if(songInfo.dataset.bytmLoading !== "true") {
-      console.log("##--1", songInfo.dataset);
       songInfo.dataset.bytmLoading = "true";
-      console.log("##--2", songInfo.dataset);
       const imgEl = lyricsBtnElem.querySelector("img") as HTMLImageElement;
       imgEl.src = getAssetUrl("loading.gif");
 
       lyricsUrl = await getGeniusUrl(sanitizeArtists(artist), sanitizeSong(song));
 
       songInfo.dataset.bytmLoading = "false";
-      console.log("##--3", songInfo.dataset);
       imgEl.src = getAssetUrl("external/genius.png");
 
       if(!lyricsUrl) {
@@ -147,8 +144,6 @@ async function addQueueButtons(queueItem: HTMLElement) {
       songInfo.dataset.bytmLyrics = lyricsUrl;
     }
 
-    console.log("##--4", songInfo.dataset);
-
     lyricsUrl && openInNewTab(lyricsUrl);
   });
 

+ 1 - 1
src/features/menu/menu_old.ts

@@ -73,7 +73,7 @@ export async function addMenu() {
 
   const closeElem = document.createElement("img");
   closeElem.id = "betterytm-menu-close";
-  closeElem.src = getAssetUrl("icon/close.png");
+  closeElem.src = getAssetUrl("close.png");
   closeElem.title = "Click to close the menu";
   closeElem.style.marginLeft = "50px";
   closeElem.style.width = "32px";

+ 7 - 1
src/utils.ts

@@ -24,8 +24,9 @@ function getLogLevel(args: unknown[]): number {
   return 0;
 }
 
-/** Common prefix to be able to tell logged messages apart */
+/** Common prefix to be able to tell logged messages apart and filter them in devtools */
 const consPrefix = `[${scriptInfo.name}]`;
+const consPrefixDbg = `[${scriptInfo.name}/#DEBUG]`;
 
 /**
  * Logs string-compatible values to the console, as long as the log level is sufficient.  
@@ -59,6 +60,11 @@ export function error(...args: unknown[]): void {
   console.error(consPrefix, ...args);
 }
 
+/** Logs string-compatible values to the console, intended for debugging only */
+export function dbg(...args: unknown[]): void {
+  console.log(consPrefixDbg, ...args);
+}
+
 /**
  * Returns the current domain as a constant string representation
  * @throws Throws if script runs on an unexpected website