Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
xacnio authored and VictorWesterlund committed Jun 18, 2022
1 parent 4f822b2 commit f3f8fe9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chrome/assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class PIPController {
// Returns true if the page is /video/
isPlayerPage() {
const url = new URL(window.location);
const pathname = url.pathname.split("/");
const pattern = /^\/?([A-Za-z-]*)?\/video\//i;

return pathname[1] === "video" ? true : false;
return pattern.test(url.pathname) ? true : false;
}

// Enter/exit PIP mode
Expand Down Expand Up @@ -77,4 +77,4 @@ class PIPController {
}
}

window.addEventListener("load", () => new PIPController(), { once: true });
window.addEventListener("load", () => new PIPController(), { once: true });

0 comments on commit f3f8fe9

Please sign in to comment.