mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 22:17:21 +03:00
Added option for auto-vote.
This commit is contained in:
3
SB.js
3
SB.js
@@ -160,7 +160,8 @@ SB.defaults = {
|
||||
"hideDeleteButtonPlayerControls": false,
|
||||
"hideDiscordLaunches": 0,
|
||||
"hideDiscordLink": false,
|
||||
"invidiousInstances": ["invidio.us", "invidiou.sh", "invidious.snopyta.org"]
|
||||
"invidiousInstances": ["invidio.us", "invidiou.sh", "invidious.snopyta.org"],
|
||||
"autoUpvote": true
|
||||
}
|
||||
|
||||
// Reset config
|
||||
|
||||
@@ -374,5 +374,11 @@
|
||||
},
|
||||
"currentInstances": {
|
||||
"message": "Current Instances:"
|
||||
},
|
||||
"enableAutoUpvote": {
|
||||
"message": "Auto Upvote"
|
||||
},
|
||||
"whatAutoUpvote": {
|
||||
"message": "With this enabled, the extension will upvote all submissions you view if you do not report them. If the notice is disabled, this will not occur."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,8 +556,9 @@ function skipToTime(v, index, sponsorTimes, openNotice) {
|
||||
//send out the message saying that a sponsor message was skipped
|
||||
if (!SB.config.dontShowNotice) {
|
||||
let skipNotice = new SkipNotice(this, currentUUID, SB.config.disableAutoSkip);
|
||||
|
||||
//auto-upvote this sponsor
|
||||
if (SB.config.trackViewCount && !SB.config.disableAutoSkip) {
|
||||
if (SB.config.trackViewCount && !SB.config.disableAutoSkip && SB.config.autoUpvote) {
|
||||
vote(1, currentUUID, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,6 +181,23 @@
|
||||
|
||||
<div class="small-description">__MSG_whatDeleteButton__</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div option-type="toggle" sync-option="autoUpvote">
|
||||
<label class="switch-container" label-name="__MSG_enableAutoUpvote__">
|
||||
<label class="switch">
|
||||
<input type="checkbox" checked>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</label>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div class="small-description">__MSG_whatAutoUpvote__</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
3
popup.js
3
popup.js
@@ -231,7 +231,6 @@ async function runThePopup() {
|
||||
}
|
||||
|
||||
//load video times for this video
|
||||
setTimeout(()=> console.log( SB.config.sponsorTimes.set), 200 )
|
||||
let sponsorTimesStorage = SB.config.sponsorTimes.get(currentVideoID);
|
||||
if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) {
|
||||
if (sponsorTimesStorage[sponsorTimesStorage.length - 1] != undefined && sponsorTimesStorage[sponsorTimesStorage.length - 1].length < 2) {
|
||||
@@ -919,10 +918,8 @@ async function runThePopup() {
|
||||
type: type,
|
||||
UUID: UUID
|
||||
}, function(response) {
|
||||
console.log(response)
|
||||
if (response != undefined) {
|
||||
//see if it was a success or failure
|
||||
console.log(response)
|
||||
if (response.successType == 1 || (response.successType == -1 && response.statusCode == 429)) {
|
||||
//success (treat rate limits as a success)
|
||||
addVoteMessage(chrome.i18n.getMessage("voted"), UUID)
|
||||
|
||||
Reference in New Issue
Block a user