mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 14:07:13 +03:00
Prevented contributions from counting twice.
This commit is contained in:
@@ -159,6 +159,9 @@ function submitTimes(videoID, callback) {
|
|||||||
|
|
||||||
//submit these times
|
//submit these times
|
||||||
for (let i = 0; i < sponsorTimes.length; i++) {
|
for (let i = 0; i < sponsorTimes.length; i++) {
|
||||||
|
//to prevent it from happeneing twice
|
||||||
|
let increasedContributionAmount = false;
|
||||||
|
|
||||||
//submit the sponsorTime
|
//submit the sponsorTime
|
||||||
sendRequestToServer("GET", "/api/postVideoSponsorTimes?videoID=" + videoID + "&startTime=" + sponsorTimes[i][0] + "&endTime=" + sponsorTimes[i][1]
|
sendRequestToServer("GET", "/api/postVideoSponsorTimes?videoID=" + videoID + "&startTime=" + sponsorTimes[i][0] + "&endTime=" + sponsorTimes[i][1]
|
||||||
+ "&userID=" + userID, function(xmlhttp, error) {
|
+ "&userID=" + userID, function(xmlhttp, error) {
|
||||||
@@ -177,7 +180,11 @@ function submitTimes(videoID, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//save the amount contributed
|
//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) {
|
} else if (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user