From e968f392ef5b2735658600c1668d12b57e90ce32 Mon Sep 17 00:00:00 2001 From: gorhill Date: Sat, 23 May 2015 07:31:46 -0400 Subject: [PATCH] this fixes #224 --- src/css/popup.css | 2 +- src/js/popup.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/css/popup.css b/src/css/popup.css index 014c06a31..e5bf6e629 100644 --- a/src/css/popup.css +++ b/src/css/popup.css @@ -468,7 +468,7 @@ body.portrait #firewallContainer > div > span:nth-of-type(4) { display: none; left: 4px; padding: 0; - position: absolute; + position: fixed; top: 4px; } #rulesetTools > span { diff --git a/src/js/popup.js b/src/js/popup.js index ebda82ce6..7046841f2 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -45,6 +45,21 @@ document.querySelector('#panes > div:nth-of-type(2)').style.setProperty( document.querySelector('#panes > div:nth-of-type(1)').offsetHeight + 'px' ); +// The padlock/eraser must be manually positioned: +// - Its vertical position depends on the height of the popup title bar +// - Its horizontal position depends on whether there is a vertical scrollbar. +document.getElementById('rulesetTools').style.setProperty( + 'top', + (document.getElementById('gotoPrefs').getBoundingClientRect().bottom + 3) + 'px' +); + +var positionRulesetTools = function() { + document.getElementById('rulesetTools').style.setProperty( + 'left', + (document.getElementById('firewallContainer').getBoundingClientRect().left + 3) + 'px' + ); +}; + // https://github.com/chrisaljoudi/uBlock/issues/996 // Experimental: mitigate glitchy popup UI: immediately set the firewall pane // visibility to its last known state. By default the pane is hidden. @@ -284,6 +299,8 @@ var updateAllFirewallCells = function() { ); } + positionRulesetTools(); + uDom('#firewallContainer').toggleClass( 'dirty', popupData.matrixIsDirty === true @@ -648,6 +665,7 @@ var toggleMinimize = function() { name: 'firewallPaneMinimized', value: popupData.firewallPaneMinimized }); + positionRulesetTools(); }; /******************************************************************************/