From 45d77d4af3b70b63f66231ac445febffd8e3bb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alperen=20=C3=87etin?= Date: Thu, 16 Jun 2022 17:29:41 +0300 Subject: [PATCH] Update script.js --- chrome/assets/js/script.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/assets/js/script.js b/chrome/assets/js/script.js index 3caaca1..f0cae98 100644 --- a/chrome/assets/js/script.js +++ b/chrome/assets/js/script.js @@ -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 @@ -77,4 +77,4 @@ class PIPController { } } -window.addEventListener("load", () => new PIPController(), { once: true }); \ No newline at end of file +window.addEventListener("load", () => new PIPController(), { once: true });