Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit cf8cdc2

Browse files
author
the-djmaze
committed
Nextcloud different iframe height approach for #96
1 parent 921ce94 commit cf8cdc2

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
(()=>{
2-
3-
const
4-
buffer = 0, //was 5 but this was creating a white space of 5px at the bottom of the page
5-
ifr = document.getElementById('rliframe'),
6-
pageY = elem => elem.offsetParent ? (elem.offsetTop + pageY(elem.offsetParent)) : elem.offsetTop,
7-
resizeIframe = () => {
8-
var height = document.documentElement.clientHeight;
9-
height -= pageY(ifr) + buffer;
10-
height = (height < 0) ? 0 : height;
11-
ifr.style.height = height + 'px';
12-
};
13-
if (ifr) {
14-
ifr.onload = resizeIframe;
15-
window.onresize = resizeIframe;
1+
document.addEventListener('readystatechange', () => {
2+
if (document.readyState === 'complete') {
3+
const
4+
buffer = 0, //was 5 but this was creating a white space of 5px at the bottom of the page
5+
ifr = document.getElementById('rliframe'),
6+
pageY = elem => elem.offsetParent ? (elem.offsetTop + pageY(elem.offsetParent)) : elem.offsetTop,
7+
resizeIframe = () => {
8+
var height = document.documentElement.clientHeight;
9+
height -= pageY(ifr) + buffer;
10+
height = (height < 0) ? 0 : height;
11+
ifr.style.height = height + 'px';
12+
};
13+
if (ifr) {
14+
ifr.onload = resizeIframe;
15+
window.onresize = resizeIframe;
16+
}
1617
}
17-
18-
})();
18+
});
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
<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');
1+
<iframe id="rliframe" style="border: none; width: 100%; min-height: 100%; position: relative;" tabindex="-1" frameborder="0" src="<?php echo $_['snappymail-iframe-url']; ?>"></iframe>
2+
<?php
3+
// OCP\Util::addScript('snappymail', 'resize');

0 commit comments

Comments
 (0)