Userscript - new (spring 2024) UI support

Add new player selector for isVideoLoaded() (fixes #1043)
This commit is contained in:
Enguerran P
2024-04-17 19:11:19 +00:00
parent 27d97a8b5a
commit 17f5bdf00a
@@ -567,7 +567,12 @@ function isVideoLoaded() {
const videoId = getVideoId();
return (
document.querySelector(`ytd-watch-flexy[video-id='${videoId}']`) !== null
// 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
);
}