mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 22:17:21 +03:00
Fix popup on firefox
This commit is contained in:
@@ -123,7 +123,7 @@ const manualSkipPercentCount = 0.5;
|
|||||||
//get messages from the background script and the popup
|
//get messages from the background script and the popup
|
||||||
chrome.runtime.onMessage.addListener(messageListener);
|
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
|
//messages from popup script
|
||||||
switch(request.message){
|
switch(request.message){
|
||||||
case "update":
|
case "update":
|
||||||
@@ -179,8 +179,7 @@ async function messageListener(request: Message, sender: unknown, sendResponse:
|
|||||||
submitSponsorTimes();
|
submitSponsorTimes();
|
||||||
break;
|
break;
|
||||||
case "refreshSegments":
|
case "refreshSegments":
|
||||||
await sponsorsLookup(sponsorVideoID, false);
|
sponsorsLookup(sponsorVideoID, false).then(() => sendResponse({}));
|
||||||
sendResponse({});
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -241,6 +241,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
|
|
||||||
function onTabs(tabs) {
|
function onTabs(tabs) {
|
||||||
messageHandler.sendMessage(tabs[0].id, {message: 'getVideoID'}, function(result) {
|
messageHandler.sendMessage(tabs[0].id, {message: 'getVideoID'}, function(result) {
|
||||||
|
console.log(result)
|
||||||
if (result !== undefined && result.videoID) {
|
if (result !== undefined && result.videoID) {
|
||||||
currentVideoID = result.videoID;
|
currentVideoID = result.videoID;
|
||||||
creatingSegment = result.creatingSegment;
|
creatingSegment = result.creatingSegment;
|
||||||
@@ -418,13 +419,13 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
const upvoteButton = document.createElement("img");
|
const upvoteButton = document.createElement("img");
|
||||||
upvoteButton.id = "sponsorTimesUpvoteButtonsContainer" + UUID;
|
upvoteButton.id = "sponsorTimesUpvoteButtonsContainer" + UUID;
|
||||||
upvoteButton.className = "voteButton";
|
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));
|
upvoteButton.addEventListener("click", () => vote(1, UUID));
|
||||||
|
|
||||||
const downvoteButton = document.createElement("img");
|
const downvoteButton = document.createElement("img");
|
||||||
downvoteButton.id = "sponsorTimesDownvoteButtonsContainer" + UUID;
|
downvoteButton.id = "sponsorTimesDownvoteButtonsContainer" + UUID;
|
||||||
downvoteButton.className = "voteButton";
|
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));
|
downvoteButton.addEventListener("click", () => vote(0, UUID));
|
||||||
|
|
||||||
//uuid button
|
//uuid button
|
||||||
@@ -432,7 +433,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
|||||||
const uuidButton = document.createElement("img");
|
const uuidButton = document.createElement("img");
|
||||||
uuidButton.id = "sponsorTimesCopyUUIDButtonContainer" + UUID;
|
uuidButton.id = "sponsorTimesCopyUUIDButtonContainer" + UUID;
|
||||||
uuidButton.className = "voteButton";
|
uuidButton.className = "voteButton";
|
||||||
uuidButton.src = chrome.extension.getURL("icons/clipboard.svg");
|
uuidButton.src = chrome.runtime.getURL("icons/clipboard.svg");
|
||||||
uuidButton.addEventListener("click", () => {
|
uuidButton.addEventListener("click", () => {
|
||||||
navigator.clipboard.writeText(UUID);
|
navigator.clipboard.writeText(UUID);
|
||||||
const stopAnimation = utils.applyLoadingAnimation(uuidButton, 0.3);
|
const stopAnimation = utils.applyLoadingAnimation(uuidButton, 0.3);
|
||||||
|
|||||||
Reference in New Issue
Block a user