Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions public/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,14 @@ input::-webkit-inner-spin-button {
color: white;
}

.hideSegmentSubmitButton {
cursor: pointer;
margin: auto;
top: 0;
bottom: 0;
position: absolute;
}

/* Start SelectorComponent */

.sbSelector {
Expand Down
19 changes: 18 additions & 1 deletion src/components/SponsorTimeEditComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react";
import * as CompileConfig from "../../config.json";
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 { RectangleTooltip } from "../render/RectangleTooltip";
import SelectorComponent, { SelectorOption } from "./SelectorComponent";
Expand All @@ -10,6 +10,7 @@ import { getFormattedTime, getFormattedTimeToSeconds } from "../../maze-utils/sr
import { asyncRequestToServer } from "../utils/requests";
import { defaultPreviewTime } from "../utils/constants";
import { getVideo, getVideoDuration } from "../../maze-utils/src/video";
import { AnimationUtils } from "../../maze-utils/src/animationUtils";

export interface SponsorTimeEditProps {
index: number;
Expand Down Expand Up @@ -242,6 +243,22 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
onChange={(e) => this.actionTypeSelectionChange(e)}>
{this.getActionTypeOptions(sponsorTime)}
</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>
): ""}

Expand Down
11 changes: 8 additions & 3 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,10 @@ async function startSponsorSchedule(includeIntersectingSegments = false, current
if (incorrectVideoCheck(videoID, currentSkip)) return;
forceVideoTime ||= Math.max(getCurrentTime(), getVirtualTime());

if ((shouldSkip(currentSkip) || sponsorTimesSubmitting?.some((segment) => segment.segment === currentSkip.segment))) {
if ((shouldSkip(currentSkip)
|| 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])) {
skipToTime({
v: getVideo(),
Expand Down Expand Up @@ -1426,7 +1429,8 @@ function updatePreviewBar(): void {
}

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({
segment: segment.segment as [number, number],
category: segment.category,
Expand Down Expand Up @@ -1939,7 +1943,7 @@ function shouldAutoSkip(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)
|| (Config.config.autoSkipOnMusicVideos && sponsorTimes?.some((s) => s.category === "music_offtopic")
&& segment.actionType === ActionType.Skip)
Expand Down Expand Up @@ -2134,6 +2138,7 @@ function updateSponsorTimesSubmitting(getFromConfig = true) {
category: segmentTime.category,
actionType: segmentTime.actionType,
description: segmentTime.description,
hidden: segmentTime.hidden,
source: segmentTime.source
});
}
Expand Down
4 changes: 4 additions & 0 deletions src/popup/PopupComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ export const PopupComponent = () => {
<a href="https://matrix.to/#/#sponsor:ajay.app?via=ajay.app&via=matrix.org&via=mozilla.org" target="_blank" rel="noreferrer">
Matrix
</a>
<a href="https://wiki.sponsor.ajay.app/w/Guidelines" target="_blank" rel="noreferrer">
{chrome.i18n.getMessage("guidelines")}
</a>
<br />
<a id="debugLogs"
onClick={async () => {
const logs = await sendMessage({ message: "getLogs" }) as LogResponse;
Expand Down
2 changes: 1 addition & 1 deletion src/popup/SegmentListComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function SegmentListItem({ segment, videoID, currentTime, isVip, startingLooped,
&& [SponsorHideType.Visible, SponsorHideType.Hidden].includes(segment.hidden)) &&
<img
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")}
onClick={(e) => {
const stopAnimation = AnimationUtils.applyLoadingAnimation(e.currentTarget, 0.4);
Expand Down