mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 05:57:07 +03:00
Clear segment list & show loading animation in popup on video change
also removed the creatingSegment variable - results in "Start/End Segment Now" correctly updating when using buttons on the controls panel instead also the "refreshSegments" message no longer sends a response, as we send an update manually now
This commit is contained in:
@@ -215,7 +215,6 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
|
||||
case "getVideoID":
|
||||
sendResponse({
|
||||
videoID: sponsorVideoID,
|
||||
creatingSegment: isSegmentCreationInProgress(),
|
||||
});
|
||||
|
||||
break;
|
||||
@@ -243,15 +242,9 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
|
||||
// update video on refresh if videoID invalid
|
||||
if (!sponsorVideoID) videoIDChange(getYouTubeVideoID(document));
|
||||
// fetch segments
|
||||
sponsorsLookup(false).then(() => sendResponse({
|
||||
found: sponsorDataFound,
|
||||
status: lastResponseStatus,
|
||||
sponsorTimes: sponsorTimes,
|
||||
time: video.currentTime,
|
||||
onMobileYouTube
|
||||
}));
|
||||
sponsorsLookup(false);
|
||||
|
||||
return true;
|
||||
break;
|
||||
case "unskip":
|
||||
unskipSponsorTime(sponsorTimes.find((segment) => segment.UUID === request.UUID), null, true);
|
||||
break;
|
||||
@@ -438,6 +431,13 @@ async function videoIDChange(id: string): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
// Notify the popup about the video change
|
||||
chrome.runtime.sendMessage({
|
||||
message: "videoChanged",
|
||||
videoID: sponsorVideoID,
|
||||
whitelisted: channelWhitelisted
|
||||
});
|
||||
|
||||
sponsorsLookup();
|
||||
|
||||
// Make sure all player buttons are properly added
|
||||
|
||||
Reference in New Issue
Block a user