From d0c8561ee97174681ab9bc792e2b09707aa411f7 Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 11 Feb 2015 14:44:08 -0500 Subject: [PATCH] fix padlock position bug when refreshing from popup --- src/js/popup.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/js/popup.js b/src/js/popup.js index 94d8c29dd..5c643e9c2 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -165,6 +165,11 @@ var addFirewallRow = function(des) { if ( popupHeight === undefined ) { popupHeight = uDom('#panes > div:nth-of-type(1)').nodeAt(0).offsetHeight; uDom('#panes > div:nth-of-type(2)').css('height', popupHeight + 'px'); + + // The padlock must be manually positioned: + // - It's vertical position depends on the height on the title bar. + var rect = document.getElementById('gotoPrefs').getBoundingClientRect(); + document.getElementById('saveRules').style.setProperty('top', (rect.bottom + 4) + 'px'); } return row; }; @@ -276,13 +281,11 @@ var buildAllFirewallRows = function() { dfPaneBuilt = true; } - // The padlock must be manually positioned, because its position depends - // on whether there is a vertical scrollbar. - var pane = document.getElementById('firewallContainer'); - var rect = pane.getBoundingClientRect(); - var padlock = document.getElementById('saveRules'); - padlock.style.setProperty('left', (rect.left + 4) + 'px'); - padlock.style.setProperty('top', (rect.top + 4) + 'px'); + // The padlock must be manually positioned: + // - Its horizontal position depends on whether there is a vertical + // scrollbar. + var rect = document.getElementById('firewallContainer').getBoundingClientRect(); + document.getElementById('saveRules').style.setProperty('left', (rect.left + 4) + 'px'); updateAllFirewallCells(); };