Add functions for importing/exporting segments

This commit is contained in:
Ajay
2022-02-26 01:07:29 -05:00
parent eb35f5c543
commit f81cfbecfe
11 changed files with 382 additions and 70 deletions

View File

@@ -9,6 +9,7 @@ import Config from "../config";
import { ActionType, Category, SegmentContainer, SponsorSourceType, SponsorTime } from "../types";
import Utils from "../utils";
import { partition } from "../utils/arrayUtils";
import { shortCategoryName } from "../utils/categoryUtils";
import { GenericUtils } from "../utils/genericUtils";
const utils = new Utils();
@@ -154,7 +155,7 @@ class PreviewBar {
private setTooltipTitle(segment: PreviewBarSegment, tooltip: HTMLElement): void {
if (segment) {
const name = segment.description || utils.shortCategoryName(segment.category);
const name = segment.description || shortCategoryName(segment.category);
if (segment.unsubmitted) {
tooltip.textContent = chrome.i18n.getMessage("unsubmitted") + " " + name;
} else {
@@ -603,7 +604,7 @@ class PreviewBar {
chapterButton.disabled = false;
const chapterTitle = chaptersContainer.querySelector(".ytp-chapter-title-content") as HTMLDivElement;
chapterTitle.innerText = chosenSegment.description || utils.shortCategoryName(chosenSegment.category);
chapterTitle.innerText = chosenSegment.description || shortCategoryName(chosenSegment.category);
} else {
// Hide chapters menu again
chaptersContainer.style.display = "none";