Fix popup width when embedded in page

This commit is contained in:
Alec Rust
2022-08-21 11:56:31 +01:00
parent 780ea4a9d0
commit bc1263c341
2 changed files with 13 additions and 7 deletions

View File

@@ -75,6 +75,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
const PageElements: PageElements = {};
[
"sponsorBlockPopupBody",
"sponsorblockPopup",
"sponsorStart",
// Top toggles
@@ -132,7 +133,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
getSegmentsFromContentScript(false);
await utils.wait(() => Config.config !== null && allowPopup, 5000, 5);
document.querySelector("body").style.removeProperty("visibility");
PageElements.sponsorBlockPopupBody.style.removeProperty("visibility");
if (!Config.configSyncListeners.includes(contentConfigUpdateListener)) {
Config.configSyncListeners.push(contentConfigUpdateListener);
}
@@ -145,6 +146,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
if (window !== window.top) {
PageElements.sbCloseButton.classList.remove("hidden");
PageElements.sponsorBlockPopupBody.classList.add("is-embedded");
}
// Hide donate button if wanted (Safari, or user choice)
@@ -187,7 +189,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
if (window !== window.top) {
document.addEventListener("keydown", (e) => {
const target = e.target as HTMLElement;
if (target.tagName === "INPUT"
if (target.tagName === "INPUT"
|| target.tagName === "TEXTAREA"
|| e.key === "ArrowUp"
|| e.key === "ArrowDown") {
@@ -255,7 +257,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
}
PageElements.sponsorTimesOthersTimeSavedDisplay.innerText = getFormattedHours(minutesSaved);
}
Config.config.isVip = userInfo.vip;
}
});
@@ -489,7 +491,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
}
segmentTimeFromToNode.style.margin = "5px";
// for inline-styling purposes
const labelContainer = document.createElement("div");
labelContainer.appendChild(categoryColorCircle);