blob: d93c2c7b3c8b98c3babaacab2425e9716a1d060c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
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 = "";
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 = "";
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 getCategorySuffix(category: Category): string {
if (category.startsWith("poi_")) {
return "_POI";
} else if (category === "exclusive_access") {
return "_full";
} else if (category === "chapter") {
return "_chapter";
} else {
return "";
}
}
export function shortCategoryName(categoryName: string): string {
return chrome.i18n.getMessage("category_" + categoryName + "_short") || chrome.i18n.getMessage("category_" + categoryName);
}
export const DEFAULT_CATEGORY = "chooseACategory";
|