diff options
author | Ajay Ramachandran <[email protected]> | 2020-03-10 12:08:54 -0400 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2020-03-10 12:08:54 -0400 |
commit | 1a92265e65026173e83942886e3de994a4425700 (patch) | |
tree | 4029cbfa5ae88ca71e7c30c722a14ee115bc8bc7 /src/components/NoticeComponent.tsx | |
parent | 92a6065c987db40fe55fa884f3cbcd030d381118 (diff) | |
download | SponsorBlock-1a92265e65026173e83942886e3de994a4425700.tar.gz SponsorBlock-1a92265e65026173e83942886e3de994a4425700.zip |
Made non timed notice the default
Diffstat (limited to 'src/components/NoticeComponent.tsx')
-rw-r--r-- | src/components/NoticeComponent.tsx | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/components/NoticeComponent.tsx b/src/components/NoticeComponent.tsx index a988207e..3aa330c8 100644 --- a/src/components/NoticeComponent.tsx +++ b/src/components/NoticeComponent.tsx @@ -20,17 +20,11 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> { countdownInterval: NodeJS.Timeout; idSuffix: any; - timed: boolean - amountOfPreviousNotices: number; constructor(props: NoticeProps) { super(props); - // Set default to timed - this.timed = props.timed; - if (this.timed === undefined) this.timed = true; - if (props.maxCountdownTime === undefined) props.maxCountdownTime = () => 4; //the id for the setInterval running the countdown @@ -91,7 +85,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> { style={{top: "11px"}}> {/* Time left */} - {this.timed ? ( + {this.props.timed ? ( <span id={"sponsorSkipNoticeTimeLeft" + this.idSuffix} className="sponsorSkipObject sponsorSkipNoticeTimeLeft"> @@ -116,7 +110,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> { //called every second to lower the countdown before hiding the notice countdown() { - if (!this.timed) return; + if (!this.props.timed) return; let countdownTime = this.state.countdownTime - 1; @@ -143,7 +137,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> { } pauseCountdown() { - if (!this.timed) return; + if (!this.props.timed) return; //remove setInterval clearInterval(this.countdownInterval); @@ -162,7 +156,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> { } startCountdown() { - if (!this.timed) return; + if (!this.props.timed) return; //if it has already started, don't start it again if (this.countdownInterval !== null) return; @@ -176,7 +170,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> { } resetCountdown() { - if (!this.timed) return; + if (!this.props.timed) return; this.setState({ countdownTime: this.props.maxCountdownTime(), |