diff options
author | Dmitrii Selivanov <selivano.d@gmail.com> | 2022-09-21 13:49:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 13:49:37 +0300 |
commit | 8f88f9203fb0f5618f009f3c80cc1606348bb40a (patch) | |
tree | d573438f5b265913a00d1fe594816ae5a50d4bbd | |
parent | 03c6f3b23469b29bc692ed0f9f25f9e2cd613751 (diff) | |
parent | 11df4d170628cf9e89e88b0551be89b446deae9e (diff) |
Merge pull request #754 from thiagocferr/741-Dislike-Numbers-in-Shorts-disappears-when
HOTFIX: added aditional check for like/dislike buttons inside ACTIVE …
-rw-r--r-- | Extensions/UserScript/Return Youtube Dislike.user.js | 3 | ||||
-rw-r--r-- | Extensions/combined/src/utils.js | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Extensions/UserScript/Return Youtube Dislike.user.js b/Extensions/UserScript/Return Youtube Dislike.user.js index b9ffa27..bbf9abe 100644 --- a/Extensions/UserScript/Return Youtube Dislike.user.js +++ b/Extensions/UserScript/Return Youtube Dislike.user.js @@ -58,6 +58,9 @@ function isInViewport(element) { const height = innerHeight || document.documentElement.clientHeight; const width = innerWidth || document.documentElement.clientWidth; return ( + // When short (channel) is ignored, the element (like/dislike AND short itself) is + // hidden with a 0 DOMRect. In this case, consider it outside of Viewport + !(rect.top == 0 && rect.left == 0 && rect.bottom == 0 && rect.right == 0) && rect.top >= 0 && rect.left >= 0 && rect.bottom <= height && diff --git a/Extensions/combined/src/utils.js b/Extensions/combined/src/utils.js index b92bc0c..e789815 100644 --- a/Extensions/combined/src/utils.js +++ b/Extensions/combined/src/utils.js @@ -87,6 +87,9 @@ function isInViewport(element) { const height = innerHeight || document.documentElement.clientHeight; const width = innerWidth || document.documentElement.clientWidth; return ( + // When short (channel) is ignored, the element (like/dislike AND short itself) is + // hidden with a 0 DOMRect. In this case, consider it outside of Viewport + !(rect.top == 0 && rect.left == 0 && rect.bottom == 0 && rect.right == 0) && rect.top >= 0 && rect.left >= 0 && rect.bottom <= height && |