Nextcloud different iframe height approach for #96

This commit is contained in:
the-djmaze 2022-10-12 00:14:13 +02:00
parent 921ce9471e
commit cf8cdc25c3
2 changed files with 20 additions and 18 deletions

View file

@ -1,18 +1,18 @@
(()=>{
const
buffer = 0, //was 5 but this was creating a white space of 5px at the bottom of the page
ifr = document.getElementById('rliframe'),
pageY = elem => elem.offsetParent ? (elem.offsetTop + pageY(elem.offsetParent)) : elem.offsetTop,
resizeIframe = () => {
var height = document.documentElement.clientHeight;
height -= pageY(ifr) + buffer;
height = (height < 0) ? 0 : height;
ifr.style.height = height + 'px';
};
if (ifr) {
ifr.onload = resizeIframe;
window.onresize = resizeIframe;
document.addEventListener('readystatechange', () => {
if (document.readyState === 'complete') {
const
buffer = 0, //was 5 but this was creating a white space of 5px at the bottom of the page
ifr = document.getElementById('rliframe'),
pageY = elem => elem.offsetParent ? (elem.offsetTop + pageY(elem.offsetParent)) : elem.offsetTop,
resizeIframe = () => {
var height = document.documentElement.clientHeight;
height -= pageY(ifr) + buffer;
height = (height < 0) ? 0 : height;
ifr.style.height = height + 'px';
};
if (ifr) {
ifr.onload = resizeIframe;
window.onresize = resizeIframe;
}
}
})();
});

View file

@ -1 +1,3 @@
<iframe id="rliframe" style="border: none; width: 100%; height: 100%; position: relative;" tabindex="-1" frameborder="0" src="<?php echo $_['snappymail-iframe-url']; ?>"></iframe><?php OCP\Util::addScript('snappymail', 'resize');
<iframe id="rliframe" style="border: none; width: 100%; min-height: 100%; position: relative;" tabindex="-1" frameborder="0" src="<?php echo $_['snappymail-iframe-url']; ?>"></iframe>
<?php
// OCP\Util::addScript('snappymail', 'resize');