From c5905844074ccd90cd33a2aa7b1ab6ea258b050d Mon Sep 17 00:00:00 2001 From: cpoppema Date: Thu, 24 Mar 2016 19:06:48 +0100 Subject: [PATCH] Set the popup window size manually so it is at least manageable --- code/css/popup.css | 17 +++++++++++++++-- code/js/popup.js | 25 ++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/code/css/popup.css b/code/css/popup.css index dc3d8ea..cb1762e 100644 --- a/code/css/popup.css +++ b/code/css/popup.css @@ -1,8 +1,21 @@ body { - padding-top: .9375rem; - padding-bottom: .9375rem; background-color: #eee; width: 330px; + height: 100%; + overflow-y: auto; +} + +html { + /* firefox only seems to respect this initial value for its panel height */ + height: 600px; + + max-height: 600px; + overflow-y: hidden; +} + +.container { + padding-top: .9375rem; + padding-bottom: .9375rem; } .links { diff --git a/code/js/popup.js b/code/js/popup.js index 5619836..2c08f9a 100644 --- a/code/js/popup.js +++ b/code/js/popup.js @@ -9,7 +9,6 @@ var msg = require('./modules/msg').init('popup'); - function autofocus() { var elem = $('[autofocus]:visible'); if (elem && inViewport(elem.get(0))) { @@ -199,10 +198,16 @@ } else { $(secretElem).hide(); } + + // properly size popup + resizeViewport(); }); } else { // show all $('.secret').show(); + + // properly size popup + resizeViewport(); } } @@ -374,6 +379,9 @@ // show element $(secretElem).show(); + // properly size popup + resizeViewport(); + if ((i + 1) === secrets.length) { // end progress progress.end(); @@ -391,9 +399,18 @@ } var noSecretsMessage = $($('#no-secrets-template').html()); noSecretsMessage.appendTo($('#secrets')); + + // properly size popup + resizeViewport(); } } + function resizeViewport() { + $('html').css('height', ''); + var height = $('body').outerHeight(); + $('html').css('height', height); + } + function restoreLastQuery() { if (!$('#search').length) { return; @@ -473,6 +490,9 @@ showLogout(); } }); + + // properly size popup + resizeViewport(); } function showUnlock() { @@ -484,6 +504,9 @@ $('#unlock-form').show(); var unlockForm = $($('#unlock-form-template').html()); unlockForm.appendTo($('#unlock-form')); + + // properly size popup + resizeViewport(); } function startProgress(elem, reset) {