Browse Source

Replace deprecated String.prototype.substr()

.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
Tobias Speicher 3 năm trước cách đây
mục cha
commit
73448d2bd1

+ 1 - 1
Extensions/UserScript/Return Youtube Dislike.user.js

@@ -313,7 +313,7 @@ function getVideoId() {
     return document.querySelector("meta[itemprop='videoId']").content;
   } else {
     if (pathname.startsWith("/shorts")) {
-      return pathname.substr(8);
+      return pathname.slice(8);
     }
     return urlObject.searchParams.get("v");
   }

+ 1 - 1
Extensions/combined/src/utils.js

@@ -79,7 +79,7 @@ function getVideoId(url) {
     return document.querySelector("meta[itemprop='videoId']").content;
   } else {
     if (pathname.startsWith("/shorts")) {
-      return pathname.substr(8);
+      return pathname.slice(8);
     }
     return urlObject.searchParams.get("v");
   }