mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-26 00:03:01 +01:00
Extensions: Supports YouTube Shorts
This commit is contained in:
1 parent
39c3b49c7c
commit
1cc579d00d
5 files changed
+43
-4
No files matched your search
@@ -45,10 +45,25 @@ function getVideoId(url) {
|
||||
if (pathname.startsWith("/clip")) {
|
||||
return document.querySelector("meta[itemprop='videoId']").content;
|
||||
} else {
|
||||
if (pathname.startsWith("/shorts")) {
|
||||
return pathname.substr(8);
|
||||
}
|
||||
return urlObject.searchParams.get("v");
|
||||
}
|
||||
}
|
||||
|
||||
function isInViewport(element) {
|
||||
const rect = element.getBoundingClientRect();
|
||||
const height = innerHeight || document.documentElement.clientHeight;
|
||||
const width = innerWidth || document.documentElement.clientWidth;
|
||||
return (
|
||||
rect.top >= 0 &&
|
||||
rect.left >= 0 &&
|
||||
rect.bottom <= height &&
|
||||
rect.right <= width
|
||||
);
|
||||
}
|
||||
|
||||
function isVideoLoaded() {
|
||||
const videoId = getVideoId(window.location.href);
|
||||
return (
|
||||
@@ -67,4 +82,4 @@ function cLog(message, writer) {
|
||||
}
|
||||
}
|
||||
|
||||
export { numberFormat, getBrowser, getVideoId, isVideoLoaded, cLog }
|
||||
export { numberFormat, getBrowser, getVideoId, isInViewport, isVideoLoaded, cLog }
|
||||
Reference in new issue
Block a user