mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-09-20 04:53:43 +02:00
Prevented contributions from counting twice.
This commit is contained in:
parent
dfad1a5636
commit
fc155ccdfa
1 changed files with 8 additions and 1 deletions
|
@ -159,6 +159,9 @@ function submitTimes(videoID, callback) {
|
|||
|
||||
//submit these times
|
||||
for (let i = 0; i < sponsorTimes.length; i++) {
|
||||
//to prevent it from happeneing twice
|
||||
let increasedContributionAmount = false;
|
||||
|
||||
//submit the sponsorTime
|
||||
sendRequestToServer("GET", "/api/postVideoSponsorTimes?videoID=" + videoID + "&startTime=" + sponsorTimes[i][0] + "&endTime=" + sponsorTimes[i][1]
|
||||
+ "&userID=" + userID, function(xmlhttp, error) {
|
||||
|
@ -177,7 +180,11 @@ function submitTimes(videoID, callback) {
|
|||
}
|
||||
|
||||
//save the amount contributed
|
||||
chrome.storage.sync.set({"sponsorTimesContributed": currentContributionAmount + sponsorTimes.length});
|
||||
if (!increasedContributionAmount) {
|
||||
increasedContributionAmount = true;
|
||||
|
||||
chrome.storage.sync.set({"sponsorTimesContributed": currentContributionAmount + sponsorTimes.length});
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (error) {
|
||||
|
|
Loading…
Reference in a new issue