diff --git a/content.js b/content.js index a1ad6950..2e55d804 100644 --- a/content.js +++ b/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;