mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 14:37:23 +03:00
Fix last imported chapter not displaying sometimes
This commit is contained in:
@@ -1044,7 +1044,7 @@ async function sponsorsLookup(keepOldSubmissions = true) {
|
|||||||
|
|
||||||
function importExistingChapters(wait: boolean) {
|
function importExistingChapters(wait: boolean) {
|
||||||
if (!existingChaptersImported) {
|
if (!existingChaptersImported) {
|
||||||
GenericUtils.wait(() => video && getExistingChapters(sponsorVideoID, video.duration),
|
GenericUtils.wait(() => video?.duration && getExistingChapters(sponsorVideoID, video.duration),
|
||||||
wait ? 5000 : 0, 100, (c) => c?.length > 0).then((chapters) => {
|
wait ? 5000 : 0, 100, (c) => c?.length > 0).then((chapters) => {
|
||||||
if (!existingChaptersImported && chapters?.length > 0) {
|
if (!existingChaptersImported && chapters?.length > 0) {
|
||||||
sponsorTimes = (sponsorTimes ?? []).concat(...chapters).sort((a, b) => a.segment[0] - b.segment[0]);
|
sponsorTimes = (sponsorTimes ?? []).concat(...chapters).sort((a, b) => a.segment[0] - b.segment[0]);
|
||||||
|
|||||||
@@ -682,8 +682,6 @@ class PreviewBar {
|
|||||||
const chaptersContainer = document.querySelector(".ytp-chapter-container") as HTMLDivElement;
|
const chaptersContainer = document.querySelector(".ytp-chapter-container") as HTMLDivElement;
|
||||||
|
|
||||||
if (chaptersContainer) {
|
if (chaptersContainer) {
|
||||||
// TODO: Check if existing chapters exist (if big chapters menu is available?)
|
|
||||||
|
|
||||||
if (segments.length > 0) {
|
if (segments.length > 0) {
|
||||||
chaptersContainer.style.removeProperty("display");
|
chaptersContainer.style.removeProperty("display");
|
||||||
|
|
||||||
@@ -721,7 +719,6 @@ class PreviewBar {
|
|||||||
this.chapterVote.setVisibility(false);
|
this.chapterVote.setVisibility(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Hide chapters menu again
|
|
||||||
chaptersContainer.style.display = "none";
|
chaptersContainer.style.display = "none";
|
||||||
this.chapterVote.setVisibility(false);
|
this.chapterVote.setVisibility(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user