mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 13:07:05 +03:00
Fixed "voted" text.
This commit is contained in:
@@ -41,6 +41,7 @@ export interface SkipNoticeState {
|
|||||||
|
|
||||||
downvoting: boolean;
|
downvoting: boolean;
|
||||||
choosingCategory: boolean;
|
choosingCategory: boolean;
|
||||||
|
thanksForVotingText: boolean; //null until the voting buttons should be hidden
|
||||||
|
|
||||||
actionState: SkipNoticeAction;
|
actionState: SkipNoticeAction;
|
||||||
}
|
}
|
||||||
@@ -114,6 +115,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
|
|
||||||
downvoting: false,
|
downvoting: false,
|
||||||
choosingCategory: false,
|
choosingCategory: false,
|
||||||
|
thanksForVotingText: null,
|
||||||
|
|
||||||
actionState: SkipNoticeAction.None
|
actionState: SkipNoticeAction.None
|
||||||
}
|
}
|
||||||
@@ -161,6 +163,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
<tr id={"sponsorSkipNoticeSecondRow" + this.idSuffix}>
|
<tr id={"sponsorSkipNoticeSecondRow" + this.idSuffix}>
|
||||||
|
|
||||||
{/* Vote Button Container */}
|
{/* Vote Button Container */}
|
||||||
|
{!this.state.thanksForVotingText ?
|
||||||
<td id={"sponsorTimesVoteButtonsContainer" + this.idSuffix}
|
<td id={"sponsorTimesVoteButtonsContainer" + this.idSuffix}
|
||||||
className="sponsorTimesVoteButtonsContainer">
|
className="sponsorTimesVoteButtonsContainer">
|
||||||
|
|
||||||
@@ -185,6 +188,15 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
:
|
||||||
|
|
||||||
|
<td id={"sponsorTimesVoteButtonInfoMessage" + this.idSuffix}
|
||||||
|
className="sponsorTimesInfoMessage sponsorTimesVoteButtonMessage"
|
||||||
|
style={{marginRight: "10px"}}>
|
||||||
|
{this.state.thanksForVotingText}
|
||||||
|
</td>
|
||||||
|
}
|
||||||
|
|
||||||
{/* Unskip Button */}
|
{/* Unskip Button */}
|
||||||
<td className="sponsorSkipNoticeUnskipSection">
|
<td className="sponsorSkipNoticeUnskipSection">
|
||||||
<button id={"sponsorSkipUnskipButton" + this.idSuffix}
|
<button id={"sponsorSkipUnskipButton" + this.idSuffix}
|
||||||
@@ -499,37 +511,15 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
}
|
}
|
||||||
|
|
||||||
addVoteButtonInfo(message) {
|
addVoteButtonInfo(message) {
|
||||||
this.resetVoteButtonInfo();
|
this.setState({
|
||||||
|
thanksForVotingText: message
|
||||||
//hide report button and text for it
|
});
|
||||||
let downvoteButton = document.getElementById("sponsorTimesDownvoteButtonsContainer" + this.idSuffix);
|
|
||||||
if (downvoteButton != null) {
|
|
||||||
downvoteButton.style.display = "none";
|
|
||||||
}
|
|
||||||
let downvoteButtonText = document.getElementById("sponsorTimesReportText" + this.idSuffix);
|
|
||||||
if (downvoteButtonText != null) {
|
|
||||||
downvoteButtonText.style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
//add info
|
|
||||||
let thanksForVotingText = document.createElement("td");
|
|
||||||
thanksForVotingText.id = "sponsorTimesVoteButtonInfoMessage" + this.idSuffix;
|
|
||||||
thanksForVotingText.className = "sponsorTimesInfoMessage sponsorTimesVoteButtonMessage";
|
|
||||||
thanksForVotingText.innerText = message;
|
|
||||||
|
|
||||||
//add element to div
|
|
||||||
document.getElementById("sponsorSkipNoticeSecondRow" + this.idSuffix).prepend(thanksForVotingText);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetVoteButtonInfo() {
|
resetVoteButtonInfo() {
|
||||||
let previousInfoMessage = document.getElementById("sponsorTimesVoteButtonInfoMessage" + this.idSuffix);
|
this.setState({
|
||||||
if (previousInfoMessage != null) {
|
thanksForVotingText: null
|
||||||
//remove it
|
});
|
||||||
document.getElementById("sponsorSkipNoticeSecondRow" + this.idSuffix).removeChild(previousInfoMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
//show button again
|
|
||||||
document.getElementById("sponsorTimesDownvoteButtonsContainer" + this.idSuffix).style.removeProperty("display");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
closeListener() {
|
closeListener() {
|
||||||
|
|||||||
Reference in New Issue
Block a user