mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 20:17:05 +03:00
Improved speed of whitelist check.
This commit is contained in:
24
content.js
24
content.js
@@ -378,6 +378,18 @@ function sponsorsLookup(id, channelIDPromise) {
|
||||
v.addEventListener('durationchange', updatePreviewBar);
|
||||
}
|
||||
|
||||
if (channelIDPromise != null) {
|
||||
if (channelIDPromise.isFulfilled) {
|
||||
whitelistCheck();
|
||||
} else if (channelIDPromise.isRejected) {
|
||||
//try again
|
||||
wait(getChannelID).then(whitelistCheck).catch();
|
||||
} else {
|
||||
//add it as a then statement
|
||||
channelIDPromise.then(whitelistCheck);
|
||||
}
|
||||
}
|
||||
|
||||
//check database for sponsor times
|
||||
//made true once a setTimeout has been created to try again after a server error
|
||||
let recheckStarted = false;
|
||||
@@ -396,18 +408,6 @@ function sponsorsLookup(id, channelIDPromise) {
|
||||
updatePreviewBar();
|
||||
}
|
||||
|
||||
if (channelIDPromise != null) {
|
||||
if (channelIDPromise.isFulfilled) {
|
||||
whitelistCheck();
|
||||
} else if (channelIDPromise.isRejected) {
|
||||
//try again
|
||||
wait(getChannelID).then(whitelistCheck).catch();
|
||||
} else {
|
||||
//add it as a then statement
|
||||
channelIDPromise.then(whitelistCheck);
|
||||
}
|
||||
}
|
||||
|
||||
sponsorLookupRetries = 0;
|
||||
} else if (xmlhttp.readyState == 4 && xmlhttp.status == 404) {
|
||||
sponsorDataFound = false;
|
||||
|
||||
Reference in New Issue
Block a user