mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 12:37:05 +03:00
Made it only count a contribution if it was uploaded successfully.
This commit is contained in:
@@ -147,6 +147,20 @@ function submitTimes(videoID, callback) {
|
|||||||
callback({
|
callback({
|
||||||
statusCode: xmlhttp.status
|
statusCode: xmlhttp.status
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (xmlhttp.status == 200) {
|
||||||
|
//add these to the storage log
|
||||||
|
chrome.storage.sync.get(["sponsorTimesContributed"], function(result) {
|
||||||
|
let currentContributionAmount = 0;
|
||||||
|
if (result.sponsorTimesContributed != undefined) {
|
||||||
|
//current contribution amount is known
|
||||||
|
currentContributionAmount = result.sponsorTimesContributed;
|
||||||
|
}
|
||||||
|
|
||||||
|
//save the amount contributed
|
||||||
|
chrome.storage.sync.set({"sponsorTimesContributed": currentContributionAmount + sponsorTimes.length});
|
||||||
|
});
|
||||||
|
}
|
||||||
} else if (error) {
|
} else if (error) {
|
||||||
callback({
|
callback({
|
||||||
statusCode: -1
|
statusCode: -1
|
||||||
@@ -155,18 +169,6 @@ function submitTimes(videoID, callback) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//add these to the storage log
|
|
||||||
chrome.storage.sync.get(["sponsorTimesContributed"], function(result) {
|
|
||||||
let currentContributionAmount = 0;
|
|
||||||
if (result.sponsorTimesContributed != undefined) {
|
|
||||||
//current contribution amount is known
|
|
||||||
currentContributionAmount = result.sponsorTimesContributed;
|
|
||||||
}
|
|
||||||
|
|
||||||
//save the amount contributed
|
|
||||||
chrome.storage.sync.set({"sponsorTimesContributed": currentContributionAmount + sponsorTimes.length});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user