1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 07:22:28 +02:00

Replace old resizing code with CSS flex

This commit is contained in:
Raymond Hill 2020-04-24 20:10:35 -04:00
parent c02349979c
commit 9845e4d61a
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 7 additions and 15 deletions

View File

@ -1,14 +1,18 @@
html, body {
height: 100%;
display: flex;
flex-direction: column;
height: 100vh;
justify-content: stretch;
overflow: hidden;
position: relative;
width: 100%;
width: 100vw;
}
#dashboard-nav {
background-color: var(--default-surface);
border: 0;
box-shadow: var(--dashboard-bar-shadow);
display: flex;
flex-shrink: 0;
flex-wrap: wrap;
overflow-x: hidden;
padding: 0;
@ -48,6 +52,7 @@ html, body {
iframe {
background-color: transparent;
border: 0;
flex-grow: 1;
margin: 0;
padding: 0;
width: 100%;

View File

@ -30,16 +30,6 @@
/******************************************************************************/
const resizeFrame = function() {
const navRect = document.getElementById('dashboard-nav')
.getBoundingClientRect();
const viewRect = document.documentElement.getBoundingClientRect();
document.getElementById('iframe').style.setProperty(
'height',
(viewRect.height - navRect.height) + 'px'
);
};
const discardUnsavedData = function(synchronous = false) {
const paneFrame = document.getElementById('iframe');
const paneWindow = paneFrame.contentWindow;
@ -121,12 +111,9 @@ vAPI.messaging.send('dashboard', {
document.body.classList.toggle('canUpdateShortcuts', response === true);
});
resizeFrame();
vAPI.localStorage.getItemAsync('dashboardLastVisitedPane').then(value => {
loadDashboardPanel(value !== null ? value : 'settings.html', true);
window.addEventListener('resize', resizeFrame);
uDom('.tabButton').on('click', onTabClickHandler);
// https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event