Added skip button in control bar instead of using skip notice

This commit is contained in:
Ajay Ramachandran
2021-08-18 02:07:24 -04:00
parent 2a0e893dfc
commit e126b59078
11 changed files with 237 additions and 50 deletions

View File

@@ -0,0 +1,23 @@
import { Category, CategoryActionType, 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) {
const messageId = getCategoryActionType(segments[0].category) === CategoryActionType.Skippable
? "skipped" : "skipped_to_category";
return chrome.i18n.getMessage(messageId).replace("{0}", categoryName);
} else {
const messageId = getCategoryActionType(segments[0].category) === CategoryActionType.Skippable
? "skip_category" : "skip_to_category";
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;
}
}