Added "read the guidelines button.

This commit is contained in:
Ajay Ramachandran
2020-06-05 21:38:38 -04:00
parent 730d966019
commit 89cc6ed184
4 changed files with 20 additions and 3 deletions

View File

@@ -611,7 +611,11 @@
"multipleSegments": {
"message": "Multiple Segments"
},
"categoryGuidelines": {
"message": "Category Guidelines"
"guidelines": {
"message": "Guidelines"
},
"readTheGuidelines": {
"message": "Read The Guidelines!!",
"description": "Show the first time they submit or if they are \"high risk\""
}
}

View File

@@ -86,13 +86,20 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
{this.getSponsorTimeMessages()}
</td>
</tr>
{/* Last Row */}
<tr id={"sponsorSkipNoticeSecondRow" + this.state.idSuffix}>
<td className="sponsorSkipNoticeRightSection"
style={{position: "relative"}}>
{/* Guidelines button */}
<button className="sponsorSkipObject sponsorSkipNoticeButton sponsorSkipNoticeRightButton"
onClick={() => window.open("https://github.com/ajayyy/SponsorBlock/wiki/Guidelines")}>
{chrome.i18n.getMessage(Config.config.submissionCountSinceCategories > 3 ? "guidelines" : "readTheGuidelines")}
</button>
{/* Submit Button */}
<button className="sponsorSkipObject sponsorSkipNoticeButton sponsorSkipNoticeRightButton"
onClick={this.submit.bind(this)}>

View File

@@ -14,6 +14,7 @@ interface SBConfig {
minutesSaved: number,
skipCount: number,
sponsorTimesContributed: number,
submissionCountSinceCategories: number, // New count used to show the "Read The Guidelines!!" message
disableSkipping: boolean,
trackViewCount: boolean,
dontShowNotice: boolean,
@@ -129,6 +130,7 @@ var Config: SBObject = {
minutesSaved: 0,
skipCount: 0,
sponsorTimesContributed: 0,
submissionCountSinceCategories: 0,
disableSkipping: false,
trackViewCount: true,
dontShowNotice: false,

View File

@@ -1476,6 +1476,10 @@ async function sendSubmitMessage(){
// Increase contribution count
Config.config.sponsorTimesContributed = Config.config.sponsorTimesContributed + sponsorTimesSubmitting.length;
// New count just used to see if a warning "Read The Guidelines!!" message needs to be shown
// One per time submitting
Config.config.submissionCountSinceCategories = Config.config.submissionCountSinceCategories + 1;
// Empty the submitting times
sponsorTimesSubmitting = [];