mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 19:47:04 +03:00
Add hide segment button to submission menu
This commit is contained in:
@@ -683,6 +683,14 @@ input::-webkit-inner-spin-button {
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hideSegmentSubmitButton {
|
||||||
|
cursor: pointer;
|
||||||
|
margin: auto;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
/* Start SelectorComponent */
|
/* Start SelectorComponent */
|
||||||
|
|
||||||
.sbSelector {
|
.sbSelector {
|
||||||
|
|||||||
@@ -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, Category, ChannelIDStatus, ContentContainer, SponsorTime } from "../types";
|
import { ActionType, Category, ChannelIDStatus, ContentContainer, SponsorHideType, SponsorTime } from "../types";
|
||||||
import SubmissionNoticeComponent from "./SubmissionNoticeComponent";
|
import SubmissionNoticeComponent from "./SubmissionNoticeComponent";
|
||||||
import { RectangleTooltip } from "../render/RectangleTooltip";
|
import { RectangleTooltip } from "../render/RectangleTooltip";
|
||||||
import SelectorComponent, { SelectorOption } from "./SelectorComponent";
|
import SelectorComponent, { SelectorOption } from "./SelectorComponent";
|
||||||
@@ -10,6 +10,7 @@ import { getFormattedTime, getFormattedTimeToSeconds } from "../../maze-utils/sr
|
|||||||
import { asyncRequestToServer } from "../utils/requests";
|
import { asyncRequestToServer } from "../utils/requests";
|
||||||
import { defaultPreviewTime } from "../utils/constants";
|
import { defaultPreviewTime } from "../utils/constants";
|
||||||
import { getVideo, getVideoDuration } from "../../maze-utils/src/video";
|
import { getVideo, getVideoDuration } from "../../maze-utils/src/video";
|
||||||
|
import { AnimationUtils } from "../../maze-utils/src/animationUtils";
|
||||||
|
|
||||||
export interface SponsorTimeEditProps {
|
export interface SponsorTimeEditProps {
|
||||||
index: number;
|
index: number;
|
||||||
@@ -242,6 +243,22 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
onChange={(e) => this.actionTypeSelectionChange(e)}>
|
onChange={(e) => this.actionTypeSelectionChange(e)}>
|
||||||
{this.getActionTypeOptions(sponsorTime)}
|
{this.getActionTypeOptions(sponsorTime)}
|
||||||
</select>
|
</select>
|
||||||
|
<img
|
||||||
|
className="voteButton hideSegmentSubmitButton"
|
||||||
|
title={chrome.i18n.getMessage("hideSegment")}
|
||||||
|
src={sponsorTime.hidden === SponsorHideType.Hidden ? chrome.runtime.getURL("icons/not_visible.svg") : chrome.runtime.getURL("icons/visible.svg")}
|
||||||
|
onClick={(e) => {
|
||||||
|
const stopAnimation = AnimationUtils.applyLoadingAnimation(e.currentTarget, 0.4);
|
||||||
|
stopAnimation();
|
||||||
|
|
||||||
|
if (sponsorTime.hidden === SponsorHideType.Hidden) {
|
||||||
|
sponsorTime.hidden = SponsorHideType.Visible;
|
||||||
|
} else {
|
||||||
|
sponsorTime.hidden = SponsorHideType.Hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.saveEditTimes();
|
||||||
|
}}/>
|
||||||
</div>
|
</div>
|
||||||
): ""}
|
): ""}
|
||||||
|
|
||||||
|
|||||||
@@ -713,7 +713,9 @@ async function startSponsorSchedule(includeIntersectingSegments = false, current
|
|||||||
forceVideoTime ||= Math.max(getCurrentTime(), getVirtualTime());
|
forceVideoTime ||= Math.max(getCurrentTime(), getVirtualTime());
|
||||||
|
|
||||||
if ((shouldSkip(currentSkip)
|
if ((shouldSkip(currentSkip)
|
||||||
|| sponsorTimesSubmitting?.some((segment) => segment.segment === currentSkip.segment && segment.actionType !== ActionType.Chapter))) {
|
|| sponsorTimesSubmitting?.some((segment) => segment.segment === currentSkip.segment
|
||||||
|
&& segment.actionType !== ActionType.Chapter
|
||||||
|
&& segment.hidden === SponsorHideType.Visible))) {
|
||||||
if (forceVideoTime >= skipTime[0] - skipBuffer && (forceVideoTime < skipTime[1] || skipTime[1] < skipTime[0])) {
|
if (forceVideoTime >= skipTime[0] - skipBuffer && (forceVideoTime < skipTime[1] || skipTime[1] < skipTime[0])) {
|
||||||
skipToTime({
|
skipToTime({
|
||||||
v: getVideo(),
|
v: getVideo(),
|
||||||
@@ -1427,7 +1429,8 @@ function updatePreviewBar(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sponsorTimesSubmitting.forEach((segment) => {
|
sponsorTimesSubmitting.forEach((segment) => {
|
||||||
if (segment.actionType !== ActionType.Chapter || segment.segment.length > 1) {
|
if (segment.hidden === SponsorHideType.Visible
|
||||||
|
&& (segment.actionType !== ActionType.Chapter || segment.segment.length > 1)) {
|
||||||
previewBarSegments.push({
|
previewBarSegments.push({
|
||||||
segment: segment.segment as [number, number],
|
segment: segment.segment as [number, number],
|
||||||
category: segment.category,
|
category: segment.category,
|
||||||
@@ -1940,7 +1943,7 @@ function shouldAutoSkip(segment: SponsorTime): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function shouldSkip(segment: SponsorTime): boolean {
|
function shouldSkip(segment: SponsorTime): boolean {
|
||||||
return (segment.actionType !== ActionType.Full
|
return segment.hidden === SponsorHideType.Visible && (segment.actionType !== ActionType.Full
|
||||||
&& getCategorySelection(segment)?.option > CategorySkipOption.ShowOverlay)
|
&& getCategorySelection(segment)?.option > CategorySkipOption.ShowOverlay)
|
||||||
|| (Config.config.autoSkipOnMusicVideos && sponsorTimes?.some((s) => s.category === "music_offtopic")
|
|| (Config.config.autoSkipOnMusicVideos && sponsorTimes?.some((s) => s.category === "music_offtopic")
|
||||||
&& segment.actionType === ActionType.Skip)
|
&& segment.actionType === ActionType.Skip)
|
||||||
@@ -2135,6 +2138,7 @@ function updateSponsorTimesSubmitting(getFromConfig = true) {
|
|||||||
category: segmentTime.category,
|
category: segmentTime.category,
|
||||||
actionType: segmentTime.actionType,
|
actionType: segmentTime.actionType,
|
||||||
description: segmentTime.description,
|
description: segmentTime.description,
|
||||||
|
hidden: segmentTime.hidden,
|
||||||
source: segmentTime.source
|
source: segmentTime.source
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ function SegmentListItem({ segment, videoID, currentTime, isVip, startingLooped,
|
|||||||
&& [SponsorHideType.Visible, SponsorHideType.Hidden].includes(segment.hidden)) &&
|
&& [SponsorHideType.Visible, SponsorHideType.Hidden].includes(segment.hidden)) &&
|
||||||
<img
|
<img
|
||||||
className="voteButton"
|
className="voteButton"
|
||||||
title="Hide Segment"
|
title={chrome.i18n.getMessage("hideSegment")}
|
||||||
src={hidden === SponsorHideType.Hidden ? chrome.runtime.getURL("icons/not_visible.svg") : chrome.runtime.getURL("icons/visible.svg")}
|
src={hidden === SponsorHideType.Hidden ? chrome.runtime.getURL("icons/not_visible.svg") : chrome.runtime.getURL("icons/visible.svg")}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
const stopAnimation = AnimationUtils.applyLoadingAnimation(e.currentTarget, 0.4);
|
const stopAnimation = AnimationUtils.applyLoadingAnimation(e.currentTarget, 0.4);
|
||||||
|
|||||||
Reference in New Issue
Block a user