From 5209c0ea04b6930a33683326788f1327829f0b02 Mon Sep 17 00:00:00 2001 From: Ajay Date: Mon, 17 Oct 2022 09:23:59 -0400 Subject: [PATCH] Import chapters as chooseACategory if chapters is disabled --- src/content.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/content.ts b/src/content.ts index 28817872..e9324ece 100644 --- a/src/content.ts +++ b/src/content.ts @@ -271,8 +271,13 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo for (const segment of importedSegments) { if (!sponsorTimesSubmitting.some( (s) => Math.abs(s.segment[0] - segment.segment[0]) < 1 - && Math.abs(s.segment[1] - segment.segment[1]) < 1) - && (segment.category !== "chapter" || utils.getCategorySelection("chapter"))) { + && Math.abs(s.segment[1] - segment.segment[1]) < 1)) { + if (segment.category === "chapter" && !utils.getCategorySelection("chapter")) { + segment.category = "chooseACategory" as Category; + segment.actionType = ActionType.Skip; + segment.description = ""; + } + sponsorTimesSubmitting.push(segment); addedSegments = true; }