mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 22:17:21 +03:00
Fix close button layout issues
This commit is contained in:
25
src/popup.ts
25
src/popup.ts
@@ -122,9 +122,16 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
||||
"sponsorTimesDonateContainer",
|
||||
"sbConsiderDonateLink",
|
||||
"sbCloseDonate",
|
||||
"sbBetaServerWarning"
|
||||
"sbBetaServerWarning",
|
||||
"sbCloseButton"
|
||||
].forEach(id => PageElements[id] = document.getElementById(id));
|
||||
|
||||
PageElements.sbCloseButton.addEventListener("click", () => {
|
||||
sendTabMessage({
|
||||
message: "closePopup"
|
||||
});
|
||||
});
|
||||
|
||||
// Hide donate button if wanted (Safari, or user choice)
|
||||
if (!showDonationLink()) {
|
||||
PageElements.sbDonate.style.display = "none";
|
||||
@@ -588,6 +595,22 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
|
||||
chrome.runtime.sendMessage({ "message": "openHelp" });
|
||||
}
|
||||
|
||||
function sendTabMessage(data: Message): Promise<unknown> {
|
||||
return new Promise((resolve) => {
|
||||
messageHandler.query({
|
||||
active: true,
|
||||
currentWindow: true
|
||||
}, tabs => {
|
||||
messageHandler.sendMessage(
|
||||
tabs[0].id,
|
||||
data,
|
||||
(response) => resolve(response)
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
//make the options username setting option visible
|
||||
function setUsernameButton() {
|
||||
PageElements.usernameInput.value = PageElements.usernameValue.innerText;
|
||||
|
||||
Reference in New Issue
Block a user