Allow submitting as full video

This commit is contained in:
Ajay
2022-01-02 23:35:24 -05:00
parent 6ed946c998
commit d36b4a54f3
4 changed files with 19 additions and 4 deletions

View File

@@ -4,8 +4,8 @@
"serverAddressComment": "This specifies the default SponsorBlock server to connect to", "serverAddressComment": "This specifies the default SponsorBlock server to connect to",
"categoryList": ["sponsor", "selfpromo", "interaction", "poi_highlight", "intro", "outro", "preview", "filler", "music_offtopic"], "categoryList": ["sponsor", "selfpromo", "interaction", "poi_highlight", "intro", "outro", "preview", "filler", "music_offtopic"],
"categorySupport": { "categorySupport": {
"sponsor": ["skip", "mute"], "sponsor": ["skip", "mute", "full"],
"selfpromo": ["skip", "mute"], "selfpromo": ["skip", "mute", "full"],
"interaction": ["skip", "mute"], "interaction": ["skip", "mute"],
"intro": ["skip", "mute"], "intro": ["skip", "mute"],
"outro": ["skip", "mute"], "outro": ["skip", "mute"],

View File

@@ -302,6 +302,10 @@
"mute": { "mute": {
"message": "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": { "skip_category": {
"message": "Skip {0}?" "message": "Skip {0}?"
}, },

View File

@@ -1,7 +1,7 @@
import * as React from "react"; import * as React from "react";
import * as CompileConfig from "../../config.json"; import * as CompileConfig from "../../config.json";
import Config from "../config"; 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 Utils from "../utils";
import { getCategoryActionType } from "../utils/categoryUtils"; import { getCategoryActionType } from "../utils/categoryUtils";
import SubmissionNoticeComponent from "./SubmissionNoticeComponent"; import SubmissionNoticeComponent from "./SubmissionNoticeComponent";
@@ -100,11 +100,14 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
}; };
// Create time display // Create time display
let timeDisplay: JSX.Element; let timeDisplay: JSX.Element;
const timeDisplayStyle: React.CSSProperties = {};
const sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index]; const sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index];
const segment = sponsorTime.segment; const segment = sponsorTime.segment;
if (sponsorTime?.actionType === ActionType.Full) timeDisplayStyle.display = "none";
if (this.state.editing) { if (this.state.editing) {
timeDisplay = ( timeDisplay = (
<div id={"sponsorTimesContainer" + this.idSuffix} <div id={"sponsorTimesContainer" + this.idSuffix}
style={timeDisplayStyle}
className="sponsorTimeDisplay"> className="sponsorTimeDisplay">
<span id={"nowButton0" + this.idSuffix} <span id={"nowButton0" + this.idSuffix}
@@ -155,6 +158,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
timeDisplay = ( timeDisplay = (
<div id={"sponsorTimesContainer" + this.idSuffix} <div id={"sponsorTimesContainer" + this.idSuffix}
style={timeDisplayStyle}
className="sponsorTimeDisplay" className="sponsorTimeDisplay"
onClick={this.toggleEditTime.bind(this)}> onClick={this.toggleEditTime.bind(this)}>
{utils.getFormattedTime(segment[0], true) + {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); Config.config.segmentTimes.set(this.props.contentContainer().sponsorVideoID, sponsorTimesSubmitting);
this.props.contentContainer().updatePreviewBar(); 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 { previewTime(ctrlPressed = false, shiftPressed = false): void {

View File

@@ -59,7 +59,8 @@ export enum CategoryActionType {
export enum ActionType { export enum ActionType {
Skip = "skip", Skip = "skip",
Mute = "mute" Mute = "mute",
Full = "full"
} }
export const ActionTypes = [ActionType.Skip, ActionType.Mute]; export const ActionTypes = [ActionType.Skip, ActionType.Mute];