From cf8cdc25c3dd1dbaf4844870169c1eeae786a2a1 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Wed, 12 Oct 2022 00:14:13 +0200 Subject: [PATCH] Nextcloud different iframe height approach for #96 --- .../nextcloud/snappymail/js/resize.js | 34 +++++++++---------- .../nextcloud/snappymail/templates/index.php | 4 ++- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/integrations/nextcloud/snappymail/js/resize.js b/integrations/nextcloud/snappymail/js/resize.js index bacff7aa0..93a2d2741 100644 --- a/integrations/nextcloud/snappymail/js/resize.js +++ b/integrations/nextcloud/snappymail/js/resize.js @@ -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; + } } - -})(); +}); diff --git a/integrations/nextcloud/snappymail/templates/index.php b/integrations/nextcloud/snappymail/templates/index.php index fcdd98db2..f304654fb 100755 --- a/integrations/nextcloud/snappymail/templates/index.php +++ b/integrations/nextcloud/snappymail/templates/index.php @@ -1 +1,3 @@ -"> +