Skip to content

Commit

Permalink
Fix refresh on popup never ends when not on bilibili
Browse files Browse the repository at this point in the history
  • Loading branch information
hanydd committed Feb 28, 2024
1 parent a980c55 commit 6413c35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,14 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
break;
case "refreshSegments":
// update video on refresh if videoID invalid
if (!getVideoID()) checkVideoIDChange();
if (!getVideoID()) {
checkVideoIDChange().then(() => {
if (!getVideoID()) {
// if not on a video page, send a message to the popup to stop refresh animation
chrome.runtime.sendMessage({ message: "infoUpdated" });
}
});
}
// fetch segments
sponsorsLookup(false);

Expand Down
6 changes: 4 additions & 2 deletions src/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
return;
}

//if request is undefined, then the page currently being browsed is not Bilibili
if (request != undefined) {
// if request is undefined, then the page currently being browsed is not Bilibili
if (request.found != undefined) {
//remove loading text
PageElements.mainControls.style.display = "block";
PageElements.whitelistButton.classList.remove("hidden");
Expand All @@ -471,6 +471,8 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {

PageElements.issueReporterImportExport.classList.remove("hidden");
}
} else {
displayNoVideo();
}

//see if whitelist button should be swapped
Expand Down

0 comments on commit 6413c35

Please sign in to comment.