From b1582d508db9a530a5c4d88f53e247e7eb4f13d2 Mon Sep 17 00:00:00 2001 From: Jeremy Schomery Date: Tue, 14 Mar 2017 09:42:00 +0330 Subject: [PATCH] popup resizes itself after style changes --- popup.css | 2 +- popup.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/popup.css b/popup.css index 188a2f77..f1e23951 100644 --- a/popup.css +++ b/popup.css @@ -1,7 +1,6 @@ body { width: 252px; font-size: 12px; - height: 50px; /**/ font-family: Arial,"Helvetica Neue",Helvetica,sans-serif; } input[type=checkbox] { @@ -228,6 +227,7 @@ body>div:not(#installed) { justify-content: center; } #confirm { + z-index: 2147483647; display: none; /* flex */ position: absolute; left: 0; diff --git a/popup.js b/popup.js index af93d162..f96483e1 100644 --- a/popup.js +++ b/popup.js @@ -82,6 +82,9 @@ function showStyles(styles) { styles.map(createStyleElement).forEach(function(e) { installed.appendChild(e); }); + // force Chrome to resize the popup + document.body.style.height = '10px'; + document.documentElement.style.height = '10px'; } function createStyleElement(style) { @@ -131,9 +134,6 @@ document.getElementById('confirm').addEventListener('click', e => { if (document.getElementById('installed').children.length === 0) { showStyles([]); } - // force Chrome to minimize popup's height - document.body.style.height = '10px'; - document.documentElement.style.height = '10px'; }); } //