mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 22:47:18 +03:00
Fix segments not available when hover preview -> click on same video
This commit is contained in:
@@ -338,6 +338,7 @@ function resetValues() {
|
|||||||
existingChaptersImported = false;
|
existingChaptersImported = false;
|
||||||
sponsorSkipped = [];
|
sponsorSkipped = [];
|
||||||
|
|
||||||
|
sponsorVideoID = null;
|
||||||
videoInfo = null;
|
videoInfo = null;
|
||||||
pageType = null;
|
pageType = null;
|
||||||
channelWhitelisted = false;
|
channelWhitelisted = false;
|
||||||
@@ -379,10 +380,8 @@ async function videoIDChange(id): Promise<void> {
|
|||||||
//if the id has not changed return unless the video element has changed
|
//if the id has not changed return unless the video element has changed
|
||||||
if (sponsorVideoID === id && (isVisible(video) || !video)) return;
|
if (sponsorVideoID === id && (isVisible(video) || !video)) return;
|
||||||
|
|
||||||
//set the global videoID
|
|
||||||
sponsorVideoID = id;
|
|
||||||
|
|
||||||
resetValues();
|
resetValues();
|
||||||
|
sponsorVideoID = id;
|
||||||
|
|
||||||
//id is not valid
|
//id is not valid
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
@@ -2203,8 +2202,7 @@ function windowListenerHandler(event: MessageEvent): void {
|
|||||||
const dataType = data.type;
|
const dataType = data.type;
|
||||||
if (data.source !== "sponsorblock") return;
|
if (data.source !== "sponsorblock") return;
|
||||||
|
|
||||||
if (dataType === "navigation") {
|
if (dataType === "navigation" && data.videoID) {
|
||||||
sponsorVideoID = data.videoID;
|
|
||||||
pageType = data.pageType;
|
pageType = data.pageType;
|
||||||
|
|
||||||
if (data.channelID) {
|
if (data.channelID) {
|
||||||
@@ -2213,17 +2211,17 @@ function windowListenerHandler(event: MessageEvent): void {
|
|||||||
status: ChannelIDStatus.Found
|
status: ChannelIDStatus.Found
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
videoIDChange(data.videoID);
|
||||||
} else if (dataType === "ad") {
|
} else if (dataType === "ad") {
|
||||||
if (isAdPlaying != data.playing) {
|
if (isAdPlaying != data.playing) {
|
||||||
isAdPlaying = data.playing
|
isAdPlaying = data.playing
|
||||||
updatePreviewBar();
|
updatePreviewBar();
|
||||||
updateVisibilityOfPlayerControlsButton();
|
updateVisibilityOfPlayerControlsButton();
|
||||||
}
|
}
|
||||||
} else if (dataType === "data") {
|
} else if (dataType === "data" && data.videoID) {
|
||||||
if (data.video !== sponsorVideoID) {
|
videoIDChange(data.videoID);
|
||||||
sponsorVideoID = data.videoID;
|
|
||||||
videoIDChange(sponsorVideoID);
|
|
||||||
}
|
|
||||||
isLivePremiere = data.isLive || data.isPremiere
|
isLivePremiere = data.isLive || data.isPremiere
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user