diff options
author | Ajay Ramachandran <[email protected]> | 2024-02-29 03:34:45 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2024-02-29 03:34:45 -0500 |
commit | ec7eee650b67b7661aff2cbc52f29c79752d3e62 (patch) | |
tree | aa84256bbb540cad12caa3c0de4cb714d1429908 | |
parent | 742eb7ef57e1de436553eed20c45bf9542a86369 (diff) | |
parent | 154bb1749d7fa111cef024a3d29d3f8f3cdf021c (diff) | |
download | SponsorBlock-ec7eee650b67b7661aff2cbc52f29c79752d3e62.tar.gz SponsorBlock-ec7eee650b67b7661aff2cbc52f29c79752d3e62.zip |
Merge pull request #1979 from HanYaodong/dev_refresh
[Fix] Stop Refresh Animation on Popup When Triggered on Non-YouTube Pages
-rw-r--r-- | src/content.ts | 7 | ||||
-rw-r--r-- | src/popup.ts | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/content.ts b/src/content.ts index 504ba8d5..f89fb369 100644 --- a/src/content.ts +++ b/src/content.ts @@ -258,7 +258,12 @@ 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 still no video ID found, return an empty info to the popup + if (!getVideoID()) chrome.runtime.sendMessage({ message: "infoUpdated" }); + }); + } // fetch segments sponsorsLookup(false); diff --git a/src/popup.ts b/src/popup.ts index 86e79f54..f954f168 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -465,8 +465,8 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { return; } - //if request is undefined, then the page currently being browsed is not YouTube - if (request != undefined) { + // if request has no field other than message, then the page currently being browsed is not YouTube + if (request.found != undefined) { //remove loading text PageElements.mainControls.style.display = "block"; if (request.onMobileYouTube) PageElements.mainControls.classList.add("hidden"); @@ -490,6 +490,8 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { PageElements.issueReporterImportExport.classList.remove("hidden"); } + } else { + displayNoVideo(); } //see if whitelist button should be swapped |