mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-13 02:14:23 +01:00
fix hover preview segments
This commit is contained in:
parent
a45bd4c5c7
commit
059a674ae1
2 changed files with 3 additions and 3 deletions
|
@ -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 {
|
||||||
|
|
|
@ -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++;
|
||||||
|
|
Loading…
Reference in a new issue