Prechádzať zdrojové kódy

feat: add aria role button to lyrics btn

Sv443 1 rok pred
rodič
commit
5d9dea4067
3 zmenil súbory, kde vykonal 6 pridanie a 5 odobranie
  1. 1 1
      src/features/input.ts
  2. 1 0
      src/features/lyrics.ts
  3. 4 4
      src/utils.ts

+ 1 - 1
src/features/input.ts

@@ -102,7 +102,7 @@ function switchSite(newDomain: Domain) {
       subdomain = "www";
 
     if(!subdomain)
-      throw new TypeError(`Unrecognized domain '${newDomain}'`);
+      throw new Error(`Unrecognized domain '${newDomain}'`);
 
 
     const { pathname, search, hash } = new URL(location.href);

+ 1 - 0
src/features/lyrics.ts

@@ -211,6 +211,7 @@ export function createLyricsBtn(geniusUrl?: string, hideIfLoading = true): HTMLA
   linkElem.title = geniusUrl ? "Click to open this song's lyrics in a new tab" : "Loading...";
   if(geniusUrl)
     linkElem.href = geniusUrl;
+  linkElem.role = "button";
   linkElem.target = "_blank";
   linkElem.rel = "noopener noreferrer";
   linkElem.style.visibility = hideIfLoading && geniusUrl ? "initial" : "hidden";

+ 4 - 4
src/utils.ts

@@ -66,11 +66,11 @@ export function dbg(...args: unknown[]): void {
 //#SECTION video time
 
 /**
- * Returns the current video time in seconds
- * @param force Set to true to dispatch mouse movement events in case the video time can't be estimated
+ * Returns the current video time in seconds  
+ * Dispatches mouse movement events in case the video time can't be estimated
  * @returns Returns null if the video time is unavailable
  */
-export function getVideoTime(force = false) {
+export function getVideoTime() {
   const domain = getDomain();
 
   try {
@@ -93,7 +93,7 @@ export function getVideoTime(force = false) {
       //   ytForceShowVideoTime();
       //   const videoTime = document.querySelector("#TODO")?.getAttribute("aria-valuenow") ?? null;
       // }
-      void [ force, ytForceShowVideoTime ];
+      void ytForceShowVideoTime;
 
       return null;
     }