Ver código fonte

feat: lyrics btn error icon on fail

Sv443 1 ano atrás
pai
commit
c952d13154
1 arquivos alterados com 5 adições e 1 exclusões
  1. 5 1
      src/features/lyrics.ts

+ 5 - 1
src/features/lyrics.ts

@@ -69,6 +69,7 @@ async function addActualMediaCtrlLyricsBtn(likeContainer: HTMLElement) {
 
   const spinnerIconUrl = await getResourceUrl("spinner");
   const lyricsIconUrl = await getResourceUrl("lyrics");
+  const errorIconUrl = await getResourceUrl("error");
 
   const onMutation = async (mutations: MutationRecord[]) => {
     for await(const mut of mutations) {
@@ -96,8 +97,11 @@ async function addActualMediaCtrlLyricsBtn(likeContainer: HTMLElement) {
         imgElem.src = lyricsIconUrl;
         imgElem.classList.remove("bytm-spinner");
 
-        if(!url)
+        if(!url) {
+          imgElem.src = errorIconUrl;
+          imgElem.title = "Couldn't find lyrics URL";
           continue;
+        }
 
         lyricsBtn.href = url;