Skip to content

Commit 2854594

Browse files
authored
Merge pull request #169 from Authenticator-Extension/popupfix
Fix popup size issue
2 parents 47c71d7 + e734df8 commit 2854594

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/popup.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ async function init() {
109109
}
110110
});
111111

112+
if (ui.instance.isPopup()) {
113+
ui.instance.fixPopupSize();
114+
}
115+
112116
return;
113117
}
114118

src/ui/menu.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,18 @@ async function menu(_ui: UI) {
145145
new URLSearchParams(document.location.search.substring(1));
146146
return params.get('popup');
147147
},
148+
fixPopupSize: () => {
149+
const zoom = Number(localStorage.zoom) / 100 || 1;
150+
const correctHeight = 480 * zoom;
151+
const correctWidth = 320 * zoom;
152+
if (window.innerHeight !== correctHeight ||
153+
window.innerWidth !== correctWidth) {
154+
chrome.windows.getCurrent((currentWindow) => {
155+
chrome.windows.update(
156+
currentWindow.id, {height: correctHeight, width: correctWidth});
157+
});
158+
}
159+
},
148160
dropboxUpload: async () => {
149161
const dbox = new Dropbox();
150162
const response = await dbox.upload(_ui.instance.encryption);

0 commit comments

Comments
 (0)