popup resizes itself after style changes

This commit is contained in:
Jeremy Schomery 2017-03-14 09:42:00 +03:30
parent 708ff97723
commit b1582d508d
2 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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';
});
}
//