From a08dbf4da17ff21b397a8cf1e3077a2ad95a5949 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 5 Apr 2021 23:35:05 -0400 Subject: [PATCH] Add submitting for highlight category --- config.json.example | 2 +- public/_locales/en/messages.json | 25 +++- src/components/CategoryChooserComponent.tsx | 3 +- .../CategorySkipOptionsComponent.tsx | 12 +- src/components/SkipNoticeComponent.tsx | 12 +- src/components/SponsorTimeEditComponent.tsx | 81 ++++++----- src/config.ts | 128 +++--------------- src/content.ts | 19 +-- src/js-components/previewBar.ts | 2 +- src/types.ts | 18 ++- src/utils.ts | 11 +- 11 files changed, 143 insertions(+), 170 deletions(-) diff --git a/config.json.example b/config.json.example index 0d5db7f5..fae36834 100644 --- a/config.json.example +++ b/config.json.example @@ -2,5 +2,5 @@ "serverAddress": "https://sponsor.ajay.app", "testingServerAddress": "https://sponsor.ajay.app/test", "serverAddressComment": "This specifies the default SponsorBlock server to connect to", - "categoryList": ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic"] + "categoryList": ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "highlight"] } diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json index bf491142..0396ec2d 100644 --- a/public/_locales/en/messages.json +++ b/public/_locales/en/messages.json @@ -335,9 +335,6 @@ "createdBy": { "message": "Created By" }, - "autoSkip": { - "message": "Auto Skip" - }, "showSkipNotice": { "message": "Show Notice After A Segment Is Skipped" }, @@ -534,14 +531,20 @@ "category_music_offtopic_short": { "message": "Non-Music" }, + "category_highlight": { + "message": "Highlight" + }, + "category_highlight_description": { + "message": "The part of the video that most people are looking for. Similar to \"Video starts at x\" comments." + }, "category_livestream_messages": { "message": "Livestream: Donation/Message Readings" }, "category_livestream_messages_short": { "message": "Message Reading" }, - "disable": { - "message": "Disable" + "autoSkip": { + "message": "Auto Skip" }, "manualSkip": { "message": "Manual Skip" @@ -549,6 +552,18 @@ "showOverlay": { "message": "Show In Seek Bar" }, + "disable": { + "message": "Disable" + }, + "autoSkip_POI": { + "message": "Auto skip to the start" + }, + "manualSkip_POI": { + "message": "Ask when video loads" + }, + "showOverlay_POI": { + "message": "Show In Seek Bar" + }, "colorFormatIncorrect": { "message": "Your color is formatted incorrectly. It should be a 3 or 6 digit hex code with a number sign at the beginning." }, diff --git a/src/components/CategoryChooserComponent.tsx b/src/components/CategoryChooserComponent.tsx index bb86e10f..e5b08923 100644 --- a/src/components/CategoryChooserComponent.tsx +++ b/src/components/CategoryChooserComponent.tsx @@ -1,6 +1,7 @@ import * as React from "react"; import * as CompileConfig from "../../config.json"; +import { Category } from "../types"; import CategorySkipOptionsComponent from "./CategorySkipOptionsComponent"; export interface CategoryChooserProps { @@ -58,7 +59,7 @@ class CategoryChooserComponent extends React.Component ); diff --git a/src/components/CategorySkipOptionsComponent.tsx b/src/components/CategorySkipOptionsComponent.tsx index 3cc03527..a51d7a26 100644 --- a/src/components/CategorySkipOptionsComponent.tsx +++ b/src/components/CategorySkipOptionsComponent.tsx @@ -1,10 +1,13 @@ import * as React from "react"; import Config from "../config" -import { CategorySkipOption } from "../types"; +import { Category, CategorySkipOption } from "../types"; + +import Utils from "../utils"; +const utils = new Utils(); export interface CategorySkipOptionsProps { - category: string; + category: Category; defaultColor?: string; defaultPreviewColor?: string; } @@ -146,10 +149,13 @@ class CategorySkipOptionsComponent extends React.Component - {chrome.i18n.getMessage(optionName)} + {chrome.i18n.getMessage(optionName !== "disable" ? optionName + utils.getCategoryActionType(this.props.category) + : optionName)} ); } diff --git a/src/components/SkipNoticeComponent.tsx b/src/components/SkipNoticeComponent.tsx index 2990eee3..f042bcd5 100644 --- a/src/components/SkipNoticeComponent.tsx +++ b/src/components/SkipNoticeComponent.tsx @@ -1,10 +1,13 @@ import * as React from "react"; import * as CompileConfig from "../../config.json"; import Config from "../config" -import { ContentContainer, SponsorHideType, SponsorTime } from "../types"; +import { Category, ContentContainer, CategoryActionType, SponsorHideType, SponsorTime } from "../types"; import NoticeComponent from "./NoticeComponent"; import NoticeTextSelectionComponent from "./NoticeTextSectionComponent"; +import Utils from "../utils"; +const utils = new Utils(); + export enum SkipNoticeAction { None, Upvote, @@ -342,7 +345,7 @@ class SkipNoticeComponent extends React.Component utils.getCategoryActionType(cat.name as Category) === CategoryActionType.Skippable)); + for (const category of categories) { elements.push(