This commit is contained in:
Raymond Hill 2018-04-10 08:08:28 -04:00
parent 00cb02ec47
commit 94a43bec0d
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
6 changed files with 44 additions and 20 deletions

View file

@ -1,3 +1,7 @@
html {
height: 100vh;
overflow: hidden;
}
body {
overflow: hidden;
}

View file

@ -1,13 +1,9 @@
body {
background-color: #fff;
box-sizing: border-box;
left: 0;
height: 100vh;
color: #000;
margin: 0;
overflow: auto;
padding: 0;
position: absolute;
right: 0;
top: 0;
}
body > div.body {
padding: 0 0.5em 0.5em 0.5em;
@ -94,7 +90,7 @@ input[type="checkbox"][disabled] + label {
padding: 5px;
background-color: #FEDAE0;
}
@media (max-height: 640px) {
@media (max-height: 640px), (max-height: 800px) and (max-width: 480px) {
.vverbose {
display: none !important;
}

View file

@ -1,3 +1,7 @@
html {
height: 100vh;
overflow: hidden;
}
body {
display: flex;
flex-direction: column;
@ -25,7 +29,7 @@ body {
text-align: center;
vertical-align: top;
width: 50%;
white-space: normal;
white-space: nowrap;
}
#diff .ruleActions h3 {
font-weight: normal;

View file

@ -1,3 +1,7 @@
html {
height: 100vh;
overflow: hidden;
}
body {
overflow: hidden;
}

View file

@ -68,7 +68,6 @@ function renderUserFilters(first) {
}
cmEditor.setValue(content);
if ( first ) {
cmEditor.setCursor(cmEditor.lineCount(), 0);
cmEditor.clearHistory();
}
userFiltersChanged(false);

View file

@ -168,23 +168,40 @@ self.uBlockDashboard.patchCodeMirrorEditor = (function() {
grabFocusAsync(cm);
};
var resizeTimer;
var resize = function() {
var resizeTimer,
resizeObserver;
var resize = function(cm) {
resizeTimer = undefined;
let prect = document.body.getBoundingClientRect();
let child = document.querySelector('.codeMirrorFillVertical');
let crect = child.getBoundingClientRect();
let height = Math.max(prect.bottom - crect.top, 80);
child.style.height = height + 'px';
var child = document.querySelector('.codeMirrorFillVertical');
if ( child === null ) { return; }
var prect = document.documentElement.getBoundingClientRect();
var crect = child.getBoundingClientRect();
var cssHeight = Math.floor(Math.max(prect.bottom - crect.top, 80)) + 'px';
if ( child.style.height !== cssHeight ) {
child.style.height = cssHeight;
if ( cm instanceof CodeMirror ) {
cm.refresh();
}
}
};
var resizeAsync = function(cm, delay) {
if ( resizeTimer !== undefined ) { return; }
resizeTimer = vAPI.setTimeout(
resize.bind(null, cm),
typeof delay === 'number' ? delay : 66
);
};
return function(cm) {
if ( document.querySelector('.codeMirrorFillVertical') !== null ) {
resize();
window.addEventListener('resize', function() {
if ( resizeTimer !== undefined ) { return; }
resizeTimer = vAPI.setTimeout(resize, 66);
var boundResizeAsync = resizeAsync.bind(null, cm);
window.addEventListener('resize', boundResizeAsync);
resizeObserver = new MutationObserver(boundResizeAsync);
resizeObserver.observe(document.querySelector('.body'), {
childList: true,
subtree: true
});
resizeAsync(cm, 1);
}
if ( cm.options.inputStyle === 'contenteditable' ) {
cm.on('beforeSelectionChange', patchSelectAll);