mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 14:37:23 +03:00
Switched skipping to use category settings.
Submission editing is now broken as well as clicking submit. Skipping through multiple submissions just treats it as skipping from one (no multiple vote options).
This commit is contained in:
@@ -7,7 +7,7 @@ import NoticeTextSelectionComponent from "./NoticeTextSectionComponent";
|
||||
|
||||
export interface SkipNoticeProps {
|
||||
UUID: string;
|
||||
manualSkip: boolean;
|
||||
autoSkip: boolean;
|
||||
// Contains functions and variables from the content script needed by the skip notice
|
||||
contentContainer: ContentContainer;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ export interface SkipNoticeState {
|
||||
|
||||
class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeState> {
|
||||
UUID: string;
|
||||
manualSkip: boolean;
|
||||
autoSkip: boolean;
|
||||
// Contains functions and variables from the content script needed by the skip notice
|
||||
contentContainer: ContentContainer;
|
||||
|
||||
@@ -42,12 +42,12 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||
this.noticeRef = React.createRef();
|
||||
|
||||
this.UUID = props.UUID;
|
||||
this.manualSkip = props.manualSkip;
|
||||
this.autoSkip = props.autoSkip;
|
||||
this.contentContainer = props.contentContainer;
|
||||
|
||||
let noticeTitle = chrome.i18n.getMessage("noticeTitle");
|
||||
|
||||
if (this.manualSkip) {
|
||||
if (!this.autoSkip) {
|
||||
noticeTitle = chrome.i18n.getMessage("noticeTitleNotSkipped");
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||
</td>
|
||||
|
||||
{/* Never show button if manualSkip is disabled */}
|
||||
{this.manualSkip ? "" :
|
||||
{!this.autoSkip ? "" :
|
||||
<td className="sponsorSkipNoticeRightSection">
|
||||
<button className="sponsorSkipObject sponsorSkipNoticeButton sponsorSkipNoticeRightButton"
|
||||
onClick={this.contentContainer().dontShowNoticeAgain}>
|
||||
@@ -223,7 +223,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||
});
|
||||
|
||||
// See if the title should be changed
|
||||
if (this.manualSkip) {
|
||||
if (!this.autoSkip) {
|
||||
this.setState({
|
||||
noticeTitle: chrome.i18n.getMessage("noticeTitle")
|
||||
});
|
||||
@@ -239,7 +239,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||
//remove this sponsor from the sponsors looked up
|
||||
//find which one it is
|
||||
for (let i = 0; i < this.contentContainer().sponsorTimes.length; i++) {
|
||||
if (this.contentContainer().UUIDs[i] == this.UUID) {
|
||||
if (this.contentContainer().sponsorTimes[i].UUID == this.UUID) {
|
||||
//this one is the one to hide
|
||||
|
||||
//add this as a hidden sponsorTime
|
||||
|
||||
@@ -4,7 +4,7 @@ import Config from "../config";
|
||||
import * as CompileConfig from "../../config.json";
|
||||
|
||||
import Utils from "../utils";
|
||||
import { ContentContainer } from "../types";
|
||||
import { ContentContainer, SponsorTime } from "../types";
|
||||
import SubmissionNoticeComponent from "./SubmissionNoticeComponent";
|
||||
var utils = new Utils();
|
||||
|
||||
@@ -225,16 +225,17 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
||||
}
|
||||
|
||||
/** Returns an array in the sponsorTimeEdits form (minutes and seconds) from a normal seconds sponsor time */
|
||||
getFormattedSponsorTimesEdits(sponsorTime: number[]): string[][] {
|
||||
return [[String(utils.getFormattedMinutes(sponsorTime[0])), String(utils.getFormattedSeconds(sponsorTime[0]))],
|
||||
[String(utils.getFormattedMinutes(sponsorTime[1])), String(utils.getFormattedSeconds(sponsorTime[1]))]];
|
||||
getFormattedSponsorTimesEdits(sponsorTime: SponsorTime): string[][] {
|
||||
return [[String(utils.getFormattedMinutes(sponsorTime.segment[0])), String(utils.getFormattedSeconds(sponsorTime.segment[0]))],
|
||||
[String(utils.getFormattedMinutes(sponsorTime.segment[1])), String(utils.getFormattedSeconds(sponsorTime.segment[1]))]];
|
||||
}
|
||||
|
||||
saveEditTimes() {
|
||||
//TODO: Properly save categories and times
|
||||
// Save sponsorTimes
|
||||
this.props.contentContainer().sponsorTimesSubmitting[this.props.index] =
|
||||
[utils.getRawSeconds(parseFloat(this.state.sponsorTimeEdits[0][0]), parseFloat(this.state.sponsorTimeEdits[0][1])),
|
||||
utils.getRawSeconds(parseFloat(this.state.sponsorTimeEdits[1][0]), parseFloat(this.state.sponsorTimeEdits[1][1]))];
|
||||
// this.props.contentContainer().sponsorTimesSubmitting[this.props.index] =
|
||||
// [utils.getRawSeconds(parseFloat(this.state.sponsorTimeEdits[0][0]), parseFloat(this.state.sponsorTimeEdits[0][1])),
|
||||
// utils.getRawSeconds(parseFloat(this.state.sponsorTimeEdits[1][0]), parseFloat(this.state.sponsorTimeEdits[1][1]))];
|
||||
|
||||
Config.config.sponsorTimes.set(this.props.contentContainer().sponsorVideoID, this.props.contentContainer().sponsorTimesSubmitting);
|
||||
|
||||
@@ -260,7 +261,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
||||
let index = this.props.index;
|
||||
|
||||
//if it is not a complete sponsor time
|
||||
if (sponsorTimes[index].length < 2) {
|
||||
if (sponsorTimes[index].segment.length < 2) {
|
||||
//update video player
|
||||
this.props.contentContainer().changeStartSponsorButton(true, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user