فهرست منبع

feat: use onInteraction for all lyrics btns

Sven 10 ماه پیش
والد
کامیت
9666e4ab9e
1فایلهای تغییر یافته به همراه7 افزوده شده و 0 حذف شده
  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) => {