mirror of https://github.com/gorhill/uBlock.git
Replace old resizing code with CSS flex
This commit is contained in:
parent
c02349979c
commit
9845e4d61a
|
@ -1,14 +1,18 @@
|
||||||
html, body {
|
html, body {
|
||||||
height: 100%;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100vh;
|
||||||
|
justify-content: stretch;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100vw;
|
||||||
}
|
}
|
||||||
#dashboard-nav {
|
#dashboard-nav {
|
||||||
background-color: var(--default-surface);
|
background-color: var(--default-surface);
|
||||||
border: 0;
|
border: 0;
|
||||||
box-shadow: var(--dashboard-bar-shadow);
|
box-shadow: var(--dashboard-bar-shadow);
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-shrink: 0;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -48,6 +52,7 @@ html, body {
|
||||||
iframe {
|
iframe {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: 0;
|
border: 0;
|
||||||
|
flex-grow: 1;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -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 discardUnsavedData = function(synchronous = false) {
|
||||||
const paneFrame = document.getElementById('iframe');
|
const paneFrame = document.getElementById('iframe');
|
||||||
const paneWindow = paneFrame.contentWindow;
|
const paneWindow = paneFrame.contentWindow;
|
||||||
|
@ -121,12 +111,9 @@ vAPI.messaging.send('dashboard', {
|
||||||
document.body.classList.toggle('canUpdateShortcuts', response === true);
|
document.body.classList.toggle('canUpdateShortcuts', response === true);
|
||||||
});
|
});
|
||||||
|
|
||||||
resizeFrame();
|
|
||||||
|
|
||||||
vAPI.localStorage.getItemAsync('dashboardLastVisitedPane').then(value => {
|
vAPI.localStorage.getItemAsync('dashboardLastVisitedPane').then(value => {
|
||||||
loadDashboardPanel(value !== null ? value : 'settings.html', true);
|
loadDashboardPanel(value !== null ? value : 'settings.html', true);
|
||||||
|
|
||||||
window.addEventListener('resize', resizeFrame);
|
|
||||||
uDom('.tabButton').on('click', onTabClickHandler);
|
uDom('.tabButton').on('click', onTabClickHandler);
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
// https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
||||||
|
|
Loading…
Reference in New Issue