diff options
author | Ajay Ramachandran <[email protected]> | 2021-07-29 21:25:16 -0400 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2021-07-29 21:25:16 -0400 |
commit | 8d83076ea19e0c87706b2261e9f857960eaea8b8 (patch) | |
tree | 0e1bdad9a1512d2b54bf2ecaad28fa502f5abad2 | |
parent | 17437870e799a480585ea6c01703f805d889bc58 (diff) | |
download | SponsorBlock-8d83076ea19e0c87706b2261e9f857960eaea8b8.tar.gz SponsorBlock-8d83076ea19e0c87706b2261e9f857960eaea8b8.zip |
Fix popup on firefox
-rw-r--r-- | src/content.ts | 5 | ||||
-rw-r--r-- | src/popup.ts | 7 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/content.ts b/src/content.ts index 6320249a..9ee55c94 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); -async function messageListener(request: Message, sender: unknown, sendResponse: (response: MessageResponse) => void): Promise<void> { +function messageListener(request: Message, sender: unknown, sendResponse: (response: MessageResponse) => void): Promise<void> { //messages from popup script switch(request.message){ case "update": @@ -179,8 +179,7 @@ async function messageListener(request: Message, sender: unknown, sendResponse: submitSponsorTimes(); break; case "refreshSegments": - await sponsorsLookup(sponsorVideoID, false); - sendResponse({}); + sponsorsLookup(sponsorVideoID, false).then(() => sendResponse({})); break; } } diff --git a/src/popup.ts b/src/popup.ts index 97fb1ae9..b5ca8235 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -241,6 +241,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { function onTabs(tabs) { messageHandler.sendMessage(tabs[0].id, {message: 'getVideoID'}, function(result) { + console.log(result) if (result !== undefined && result.videoID) { currentVideoID = result.videoID; creatingSegment = result.creatingSegment; @@ -418,13 +419,13 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { const upvoteButton = document.createElement("img"); upvoteButton.id = "sponsorTimesUpvoteButtonsContainer" + UUID; upvoteButton.className = "voteButton"; - upvoteButton.src = chrome.extension.getURL("icons/thumbs_up.svg"); + upvoteButton.src = chrome.runtime.getURL("icons/thumbs_up.svg"); upvoteButton.addEventListener("click", () => vote(1, UUID)); const downvoteButton = document.createElement("img"); downvoteButton.id = "sponsorTimesDownvoteButtonsContainer" + UUID; downvoteButton.className = "voteButton"; - downvoteButton.src = chrome.extension.getURL("icons/thumbs_down.svg"); + downvoteButton.src = chrome.runtime.getURL("icons/thumbs_down.svg"); downvoteButton.addEventListener("click", () => vote(0, UUID)); //uuid button @@ -432,7 +433,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> { const uuidButton = document.createElement("img"); uuidButton.id = "sponsorTimesCopyUUIDButtonContainer" + UUID; uuidButton.className = "voteButton"; - uuidButton.src = chrome.extension.getURL("icons/clipboard.svg"); + uuidButton.src = chrome.runtime.getURL("icons/clipboard.svg"); uuidButton.addEventListener("click", () => { navigator.clipboard.writeText(UUID); const stopAnimation = utils.applyLoadingAnimation(uuidButton, 0.3); |