Explorar o código

feat: use onInteraction for all lyrics btns

Sven hai 10 meses
pai
achega
9666e4ab9e
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      src/features/lyrics.ts

+ 7 - 0
src/features/lyrics.ts

@@ -397,6 +397,13 @@ export async function createLyricsBtn(geniusUrl?: string, hideIfLoading = true)
   imgElem.classList.add("bytm-generic-btn-img");
   imgElem.src = await getResourceUrl("icon-lyrics");
 
+  onInteraction(linkElem, (e) => {
+    const url = linkElem.href ?? geniusUrl;
+    if(!url || e instanceof MouseEvent)
+      return;
+    openInTab(url);
+  });
+
   linkElem.appendChild(imgElem);
 
   onInteraction(linkElem, async (e) => {