Extension - new (spring 2024) UI support

Add new player selector for isVideoLoaded() (fixes #1043)
This commit is contained in:
Enguerran P
2024-04-17 18:55:48 +00:00
parent 27d97a8b5a
commit fd45f86f9a
+3
View File
@@ -98,6 +98,9 @@ function isInViewport(element) {
function isVideoLoaded() {
const videoId = getVideoId(window.location.href);
return (
// desktop: spring 2024 UI
document.querySelector(`ytd-watch-grid[video-id='${videoId}']`) !== null ||
// desktop: older UI
document.querySelector(`ytd-watch-flexy[video-id='${videoId}']`) !== null ||
// mobile: no video-id attribute
document.querySelector('#player[loading="false"]:not([hidden])') !== null