fix hover preview segments

This commit is contained in:
Michael C 2022-01-15 22:49:22 -05:00
parent a45bd4c5c7
commit 059a674ae1
No known key found for this signature in database
GPG key ID: FFB04FB3B878B7B4
2 changed files with 3 additions and 3 deletions

View file

@ -945,7 +945,7 @@ function getYouTubeVideoID(document: Document): string | boolean {
// skip to document if matches pattern // skip to document if matches pattern
if (url.includes("/channel/") || url.includes("/user/") || url.includes("/c/")) return getYouTubeVideoIDFromDocument(document); if (url.includes("/channel/") || url.includes("/user/") || url.includes("/c/")) return getYouTubeVideoIDFromDocument(document);
// not sure, try URL then document // not sure, try URL then document
return getYouTubeVideoIDFromURL(url) || getYouTubeVideoIDFromDocument(document); return getYouTubeVideoIDFromURL(url) || getYouTubeVideoIDFromDocument(document, false);
} }
function getYouTubeVideoIDFromDocument(document: Document, hideIcon = true): string | boolean { function getYouTubeVideoIDFromDocument(document: Document, hideIcon = true): string | boolean {

View file

@ -331,7 +331,7 @@ export default class Utils {
findReferenceNode(): HTMLElement { findReferenceNode(): HTMLElement {
const selectors = [ const selectors = [
"#player-container-id", "#player-container",
"#movie_player", "#movie_player",
"#c4-player", // Channel Trailer "#c4-player", // Channel Trailer
"#main-panel.ytmusic-player-page", // YouTube music "#main-panel.ytmusic-player-page", // YouTube music
@ -347,7 +347,7 @@ export default class Utils {
let index = 1; let index = 1;
//find the child that is the video player (sometimes it is not the first) //find the child that is the video player (sometimes it is not the first)
while (index < player.children.length && (!referenceNode.classList.contains("html5-video-player") || !referenceNode.classList.contains("ytp-embed"))) { while (index < player.children.length && (!referenceNode.classList?.contains("html5-video-player") || !referenceNode.classList?.contains("ytp-embed"))) {
referenceNode = player.children[index] as HTMLElement; referenceNode = player.children[index] as HTMLElement;
index++; index++;