mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 21:17:20 +03:00
Only show skip keybind hint on one notice
This commit is contained in:
@@ -23,7 +23,8 @@ export interface SkipNoticeProps {
|
||||
// Contains functions and variables from the content script needed by the skip notice
|
||||
contentContainer: ContentContainer;
|
||||
|
||||
closeListener: () => void
|
||||
closeListener: () => void;
|
||||
showKeybindHint?: boolean;
|
||||
}
|
||||
|
||||
export interface SkipNoticeState {
|
||||
@@ -44,6 +45,8 @@ export interface SkipNoticeState {
|
||||
thanksForVotingText?: string; //null until the voting buttons should be hidden
|
||||
|
||||
actionState?: SkipNoticeAction;
|
||||
|
||||
showKeybindHint?: boolean;
|
||||
}
|
||||
|
||||
class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeState> {
|
||||
@@ -112,7 +115,9 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||
choosingCategory: false,
|
||||
thanksForVotingText: null,
|
||||
|
||||
actionState: SkipNoticeAction.None
|
||||
actionState: SkipNoticeAction.None,
|
||||
|
||||
showKeybindHint: this.props.showKeybindHint ?? true
|
||||
}
|
||||
|
||||
if (!this.autoSkip) {
|
||||
@@ -200,7 +205,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||
style={{marginLeft: "4px"}}
|
||||
onClick={() => this.prepAction(SkipNoticeAction.Unskip)}>
|
||||
|
||||
{this.state.unskipText + " (" + Config.config.skipKeybind + ")"}
|
||||
{this.state.unskipText + (this.state.showKeybindHint ? " (" + Config.config.skipKeybind + ")" : "")}
|
||||
</button>
|
||||
</td>
|
||||
|
||||
|
||||
@@ -1003,6 +1003,7 @@ function skipToTime(v: HTMLVideoElement, skipTime: number[], skippingSegments: S
|
||||
if (openNotice) {
|
||||
//send out the message saying that a sponsor message was skipped
|
||||
if (!Config.config.dontShowNotice || !autoSkip) {
|
||||
skipNotices.forEach((notice) => notice.setShowKeybindHint(false));
|
||||
skipNotices.push(new SkipNotice(skippingSegments, autoSkip, skipNoticeContentContainer));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,12 @@ class SkipNotice {
|
||||
);
|
||||
}
|
||||
|
||||
setShowKeybindHint(value: boolean): void {
|
||||
this.skipNoticeRef.current.setState({
|
||||
showKeybindHint: value
|
||||
});
|
||||
}
|
||||
|
||||
close(): void {
|
||||
ReactDOM.unmountComponentAtNode(this.noticeElement);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user