aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/content.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/content.ts')
-rw-r--r--src/content.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/content.ts b/src/content.ts
index e8746a9f..232d940f 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -123,7 +123,7 @@ const manualSkipPercentCount = 0.5;
//get messages from the background script and the popup
chrome.runtime.onMessage.addListener(messageListener);
-function messageListener(request: Message, sender: unknown, sendResponse: (response: MessageResponse) => void): void {
+function messageListener(request: Message, sender: unknown, sendResponse: (response: MessageResponse) => void): void | boolean {
//messages from popup script
switch(request.message){
case "update":
@@ -144,7 +144,7 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
sponsorTimes: sponsorTimes
});
- if (popupInitialised && document.getElementById("sponsorBlockPopupContainer") != null) {
+ if (!request.updating && popupInitialised && document.getElementById("sponsorBlockPopupContainer") != null) {
//the popup should be closed now that another is opening
closeInfoMenu();
}
@@ -179,8 +179,12 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
submitSponsorTimes();
break;
case "refreshSegments":
- sponsorsLookup(sponsorVideoID, false).then(() => sendResponse({}));
- break;
+ sponsorsLookup(sponsorVideoID, false).then(() => sendResponse({
+ found: sponsorDataFound,
+ sponsorTimes: sponsorTimes
+ }));
+
+ return true;
}
}