diff options
author | Ajay <[email protected]> | 2022-01-21 20:18:42 -0500 |
---|---|---|
committer | Ajay <[email protected]> | 2022-01-21 20:18:42 -0500 |
commit | 46983bec24284222f483d64afa65784134b96b97 (patch) | |
tree | 80206192ba00bf6a7e515b3144852289563ba5f4 /src/utils/categoryUtils.ts | |
parent | e2d56d32fe5f0b7ebc702532f6f0a46c7f164545 (diff) | |
download | SponsorBlock-46983bec24284222f483d64afa65784134b96b97.tar.gz SponsorBlock-46983bec24284222f483d64afa65784134b96b97.zip |
Merge branch 'master' of https://github.com/ajayyy/SponsorBlock into chapters
Diffstat (limited to 'src/utils/categoryUtils.ts')
-rw-r--r-- | src/utils/categoryUtils.ts | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/src/utils/categoryUtils.ts b/src/utils/categoryUtils.ts index 84feb7e7..c00a81b8 100644 --- a/src/utils/categoryUtils.ts +++ b/src/utils/categoryUtils.ts @@ -1,51 +1,41 @@ -import { ActionType, Category, CategoryActionType, SponsorTime } from "../types"; +import { ActionType, Category, SponsorTime } from "../types"; export function getSkippingText(segments: SponsorTime[], autoSkip: boolean): string { const categoryName = chrome.i18n.getMessage(segments.length > 1 ? "multipleSegments" : "category_" + segments[0].category + "_short") || chrome.i18n.getMessage("category_" + segments[0].category); if (autoSkip) { let messageId = ""; - if (getCategoryActionType(segments[0].category) === CategoryActionType.Skippable) { - switch (segments[0].actionType) { - case ActionType.Skip: - messageId = "skipped"; - break; - case ActionType.Mute: - messageId = "muted"; - break; - } - } else { - messageId = "skipped_to_category"; + switch (segments[0].actionType) { + case ActionType.Skip: + messageId = "skipped"; + break; + case ActionType.Mute: + messageId = "muted"; + break; + case ActionType.Poi: + messageId = "skipped_to_category"; + break; } - + return chrome.i18n.getMessage(messageId).replace("{0}", categoryName); } else { let messageId = ""; - if (getCategoryActionType(segments[0].category) === CategoryActionType.Skippable) { - switch (segments[0].actionType) { - case ActionType.Skip: - messageId = "skip_category"; - break; - case ActionType.Mute: - messageId = "mute_category"; - break; - } - } else { - messageId = "skip_to_category"; + switch (segments[0].actionType) { + case ActionType.Skip: + messageId = "skip_category"; + break; + case ActionType.Mute: + messageId = "mute_category"; + break; + case ActionType.Poi: + messageId = "skip_to_category"; + break; } return chrome.i18n.getMessage(messageId).replace("{0}", categoryName); } } -export function getCategoryActionType(category: Category): CategoryActionType { - if (category.startsWith("poi_")) { - return CategoryActionType.POI; - } else { - return CategoryActionType.Skippable; - } -} - export function getCategorySuffix(category: Category): string { if (category.startsWith("poi_")) { return "_POI"; |