mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2026-01-01 22:29:20 +03:00
Fixed sponsor data found check
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
if(id = getYouTubeVideoID(document.URL)){ // Direct Links
|
if(id = getYouTubeVideoID(document.URL)){ // Direct Links
|
||||||
|
//reset sponsor data found check
|
||||||
|
sponsorDataFound = false;
|
||||||
sponsorsLookup(id);
|
sponsorsLookup(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,7 +15,10 @@ var lastTime;
|
|||||||
|
|
||||||
chrome.runtime.onMessage.addListener( // Detect URL Changes
|
chrome.runtime.onMessage.addListener( // Detect URL Changes
|
||||||
function(request, sender, sendResponse) {
|
function(request, sender, sendResponse) {
|
||||||
if (request.message === 'ytvideoid') { // Message from background script
|
//message from background script
|
||||||
|
if (request.message === 'ytvideoid') {
|
||||||
|
//reset sponsor data found check
|
||||||
|
sponsorDataFound = false;
|
||||||
sponsorsLookup(request.id);
|
sponsorsLookup(request.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +49,8 @@ function sponsorsLookup(id) {
|
|||||||
|
|
||||||
xmlhttp.onreadystatechange = function () {
|
xmlhttp.onreadystatechange = function () {
|
||||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
|
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
|
||||||
|
sponsorDataFound = true;
|
||||||
|
|
||||||
sponsorTimes = JSON.parse(xmlhttp.responseText).sponsorTimes;
|
sponsorTimes = JSON.parse(xmlhttp.responseText).sponsorTimes;
|
||||||
|
|
||||||
// If the sponsor data exists, add the event to run on the videos "ontimeupdate"
|
// If the sponsor data exists, add the event to run on the videos "ontimeupdate"
|
||||||
|
|||||||
Reference in New Issue
Block a user