mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 05:57:07 +03:00
Enter unskip with skip notice hidden
This commit is contained in:
@@ -18,6 +18,7 @@ export interface SkipNoticeProps {
|
||||
segments: SponsorTime[];
|
||||
|
||||
autoSkip: boolean;
|
||||
startReskip?: boolean;
|
||||
// Contains functions and variables from the content script needed by the skip notice
|
||||
contentContainer: ContentContainer;
|
||||
|
||||
@@ -120,8 +121,10 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||
countdownTime: Config.config.skipNoticeDuration,
|
||||
countdownText: null,
|
||||
|
||||
skipButtonText: this.getUnskipText(),
|
||||
skipButtonCallback: (index) => this.unskip(index),
|
||||
skipButtonText: this.props.startReskip
|
||||
? this.getReskipText() : this.getUnskipText(),
|
||||
skipButtonCallback: this.props.startReskip
|
||||
? (index) => this.reskip(index) : (index) => this.unskip(index),
|
||||
showSkipButton: true,
|
||||
|
||||
editing: false,
|
||||
|
||||
@@ -1357,12 +1357,17 @@ function skipToTime({v, skipTime, skippingSegments, openNotice, forceAutoSkip, u
|
||||
if (openNotice) {
|
||||
//send out the message saying that a sponsor message was skipped
|
||||
if (!Config.config.dontShowNotice || !autoSkip) {
|
||||
const newSkipNotice = new SkipNotice(skippingSegments, autoSkip, skipNoticeContentContainer, unskipTime);
|
||||
if (onMobileYouTube || Config.config.skipKeybind == null) newSkipNotice.setShowKeybindHint(false);
|
||||
skipNotices.push(newSkipNotice);
|
||||
|
||||
createSkipNotice(skippingSegments, autoSkip, unskipTime, false);
|
||||
} else if (autoSkip) {
|
||||
activeSkipKeybindElement?.setShowKeybindHint(false);
|
||||
activeSkipKeybindElement = newSkipNotice;
|
||||
activeSkipKeybindElement = {
|
||||
setShowKeybindHint: () => {}, //eslint-disable-line @typescript-eslint/no-empty-function
|
||||
toggleSkip: () => {
|
||||
unskipSponsorTime(skippingSegments[0], unskipTime);
|
||||
|
||||
createSkipNotice(skippingSegments, autoSkip, unskipTime, true);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1371,6 +1376,15 @@ function skipToTime({v, skipTime, skippingSegments, openNotice, forceAutoSkip, u
|
||||
if (autoSkip) sendTelemetryAndCount(skippingSegments, skipTime[1] - skipTime[0], true);
|
||||
}
|
||||
|
||||
function createSkipNotice(skippingSegments: SponsorTime[], autoSkip: boolean, unskipTime: number, startReskip: boolean) {
|
||||
const newSkipNotice = new SkipNotice(skippingSegments, autoSkip, skipNoticeContentContainer, unskipTime, startReskip);
|
||||
if (onMobileYouTube || Config.config.skipKeybind == null) newSkipNotice.setShowKeybindHint(false);
|
||||
skipNotices.push(newSkipNotice);
|
||||
|
||||
activeSkipKeybindElement?.setShowKeybindHint(false);
|
||||
activeSkipKeybindElement = newSkipNotice;
|
||||
}
|
||||
|
||||
function unskipSponsorTime(segment: SponsorTime, unskipTime: number = null) {
|
||||
if (segment.actionType === ActionType.Mute) {
|
||||
video.muted = false;
|
||||
|
||||
@@ -19,7 +19,7 @@ class SkipNotice {
|
||||
|
||||
skipNoticeRef: React.MutableRefObject<SkipNoticeComponent>;
|
||||
|
||||
constructor(segments: SponsorTime[], autoSkip = false, contentContainer: ContentContainer, unskipTime: number = null) {
|
||||
constructor(segments: SponsorTime[], autoSkip = false, contentContainer: ContentContainer, unskipTime: number = null, startReskip = false) {
|
||||
this.skipNoticeRef = React.createRef();
|
||||
|
||||
this.segments = segments;
|
||||
@@ -44,6 +44,7 @@ class SkipNotice {
|
||||
ReactDOM.render(
|
||||
<SkipNoticeComponent segments={segments}
|
||||
autoSkip={autoSkip}
|
||||
startReskip={startReskip}
|
||||
contentContainer={contentContainer}
|
||||
ref={this.skipNoticeRef}
|
||||
closeListener={() => this.close()}
|
||||
|
||||
Reference in New Issue
Block a user