mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2026-01-29 13:50:50 +03:00
Always import chapters when segments
This commit is contained in:
@@ -958,11 +958,7 @@ async function sponsorsLookup(keepOldSubmissions = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function importExistingChapters(wait: boolean) {
|
function importExistingChapters(wait: boolean) {
|
||||||
const containsChapter = sponsorTimes?.some((segment) => segment.actionType === ActionType.Chapter)
|
if (!existingChaptersImported
|
||||||
|| sponsorTimesSubmitting.some((segment) => segment.actionType === ActionType.Chapter);
|
|
||||||
|
|
||||||
if ((Config.config.renderSegmentsAsChapters || containsChapter)
|
|
||||||
&& !existingChaptersImported
|
|
||||||
&& (sponsorTimes?.length > 0 || sponsorTimesSubmitting.length > 0)) {
|
&& (sponsorTimes?.length > 0 || sponsorTimesSubmitting.length > 0)) {
|
||||||
GenericUtils.wait(() => video && getExistingChapters(sponsorVideoID, video.duration),
|
GenericUtils.wait(() => video && getExistingChapters(sponsorVideoID, video.duration),
|
||||||
wait ? 5000 : 0, 100, (c) => c?.length > 0).then((chapters) => {
|
wait ? 5000 : 0, 100, (c) => c?.length > 0).then((chapters) => {
|
||||||
|
|||||||
@@ -220,8 +220,8 @@ class PreviewBar {
|
|||||||
this.createChaptersBar(segments.sort((a, b) => a.segment[0] - b.segment[0]));
|
this.createChaptersBar(segments.sort((a, b) => a.segment[0] - b.segment[0]));
|
||||||
|
|
||||||
const chapterChevron = document.querySelector(".ytp-chapter-title-chevron") as HTMLElement;
|
const chapterChevron = document.querySelector(".ytp-chapter-title-chevron") as HTMLElement;
|
||||||
if (!Config.config.renderSegmentsAsChapters
|
if (segments.some((segment) => segment.actionType !== ActionType.Chapter
|
||||||
|| segments.some((segment) => segment.source === SponsorSourceType.YouTube)) {
|
&& segment.source === SponsorSourceType.YouTube)) {
|
||||||
chapterChevron.style.removeProperty("display");
|
chapterChevron.style.removeProperty("display");
|
||||||
} else {
|
} else {
|
||||||
chapterChevron.style.display = "none";
|
chapterChevron.style.display = "none";
|
||||||
@@ -258,7 +258,9 @@ class PreviewBar {
|
|||||||
const chapterBar = document.querySelector(".ytp-chapters-container:not(.sponsorBlockChapterBar)") as HTMLElement;
|
const chapterBar = document.querySelector(".ytp-chapters-container:not(.sponsorBlockChapterBar)") as HTMLElement;
|
||||||
if (!progressBar || !chapterBar || chapterBar.childElementCount <= 0) return;
|
if (!progressBar || !chapterBar || chapterBar.childElementCount <= 0) return;
|
||||||
|
|
||||||
if (!Config.config.renderSegmentsAsChapters && segments.every((segment) => segment.actionType !== ActionType.Chapter)) {
|
if (!Config.config.renderSegmentsAsChapters
|
||||||
|
&& segments.every((segment) => segment.actionType !== ActionType.Chapter
|
||||||
|
|| segment.source === SponsorSourceType.YouTube)) {
|
||||||
if (this.customChaptersBar) this.customChaptersBar.style.display = "none";
|
if (this.customChaptersBar) this.customChaptersBar.style.display = "none";
|
||||||
chapterBar.style.removeProperty("display");
|
chapterBar.style.removeProperty("display");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user