aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay <[email protected]>2022-01-02 23:35:24 -0500
committerAjay <[email protected]>2022-01-02 23:35:24 -0500
commitd36b4a54f3154fdcfbd2e5f059c401bdd6ceeee3 (patch)
tree235bb7fca965ecd06eb69be389d7e4695b655f4d
parent6ed946c99829079dd5f5978bf37710453f8a4b9d (diff)
downloadSponsorBlock-d36b4a54f3154fdcfbd2e5f059c401bdd6ceeee3.tar.gz
SponsorBlock-d36b4a54f3154fdcfbd2e5f059c401bdd6ceeee3.zip
Allow submitting as full video
-rw-r--r--config.json.example4
-rw-r--r--public/_locales/en/messages.json4
-rw-r--r--src/components/SponsorTimeEditComponent.tsx12
-rw-r--r--src/types.ts3
4 files changed, 19 insertions, 4 deletions
diff --git a/config.json.example b/config.json.example
index 7ff22bb7..0a587e3c 100644
--- a/config.json.example
+++ b/config.json.example
@@ -4,8 +4,8 @@
"serverAddressComment": "This specifies the default SponsorBlock server to connect to",
"categoryList": ["sponsor", "selfpromo", "interaction", "poi_highlight", "intro", "outro", "preview", "filler", "music_offtopic"],
"categorySupport": {
- "sponsor": ["skip", "mute"],
- "selfpromo": ["skip", "mute"],
+ "sponsor": ["skip", "mute", "full"],
+ "selfpromo": ["skip", "mute", "full"],
"interaction": ["skip", "mute"],
"intro": ["skip", "mute"],
"outro": ["skip", "mute"],
diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json
index c56b3275..c862ba00 100644
--- a/public/_locales/en/messages.json
+++ b/public/_locales/en/messages.json
@@ -302,6 +302,10 @@
"mute": {
"message": "Mute"
},
+ "full": {
+ "message": "Full Video",
+ "description": "Used for the name of the option to label an entire video as sponsor or self promotion."
+ },
"skip_category": {
"message": "Skip {0}?"
},
diff --git a/src/components/SponsorTimeEditComponent.tsx b/src/components/SponsorTimeEditComponent.tsx
index 144f3c82..1a734cb5 100644
--- a/src/components/SponsorTimeEditComponent.tsx
+++ b/src/components/SponsorTimeEditComponent.tsx
@@ -1,7 +1,7 @@
import * as React from "react";
import * as CompileConfig from "../../config.json";
import Config from "../config";
-import { ActionType, ActionTypes, Category, CategoryActionType, ContentContainer, SponsorTime } from "../types";
+import { ActionType, Category, CategoryActionType, ContentContainer, SponsorTime } from "../types";
import Utils from "../utils";
import { getCategoryActionType } from "../utils/categoryUtils";
import SubmissionNoticeComponent from "./SubmissionNoticeComponent";
@@ -100,11 +100,14 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
};
// Create time display
let timeDisplay: JSX.Element;
+ const timeDisplayStyle: React.CSSProperties = {};
const sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index];
const segment = sponsorTime.segment;
+ if (sponsorTime?.actionType === ActionType.Full) timeDisplayStyle.display = "none";
if (this.state.editing) {
timeDisplay = (
<div id={"sponsorTimesContainer" + this.idSuffix}
+ style={timeDisplayStyle}
className="sponsorTimeDisplay">
<span id={"nowButton0" + this.idSuffix}
@@ -155,6 +158,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
timeDisplay = (
<div id={"sponsorTimesContainer" + this.idSuffix}
+ style={timeDisplayStyle}
className="sponsorTimeDisplay"
onClick={this.toggleEditTime.bind(this)}>
{utils.getFormattedTime(segment[0], true) +
@@ -444,6 +448,12 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
Config.config.segmentTimes.set(this.props.contentContainer().sponsorVideoID, sponsorTimesSubmitting);
this.props.contentContainer().updatePreviewBar();
+
+ if (sponsorTimesSubmitting[this.props.index].actionType === ActionType.Full
+ && (sponsorTimesSubmitting[this.props.index].segment[0] !== 0 || sponsorTimesSubmitting[this.props.index].segment[1] !== 0)) {
+ this.setTimeTo(0, 0);
+ this.setTimeTo(1, 0);
+ }
}
previewTime(ctrlPressed = false, shiftPressed = false): void {
diff --git a/src/types.ts b/src/types.ts
index 1caf257c..cac7e340 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -59,7 +59,8 @@ export enum CategoryActionType {
export enum ActionType {
Skip = "skip",
- Mute = "mute"
+ Mute = "mute",
+ Full = "full"
}
export const ActionTypes = [ActionType.Skip, ActionType.Mute];