]> git.mxchange.org Git - friendica.git/commitdiff
don't resize iframe if we can't find a final size greater than 0
authorfabrixxm <fabrix.xm@gmail.com>
Mon, 28 Dec 2015 17:27:24 +0000 (18:27 +0100)
committerfabrixxm <fabrix.xm@gmail.com>
Mon, 28 Dec 2015 17:27:24 +0000 (18:27 +0100)
js/main.js

index f106b3daf43e93141a24cf3bf68d4e60cde08d2f..ca4cc770cdef20c27f88e6ce2126164b6c023a17 100644 (file)
@@ -1,22 +1,22 @@
-  function resizeIframe(obj) {
-    obj.style.height = 0;
-       _resizeIframe(obj, 0);
-  }
-  
-  function _resizeIframe(obj, desth) {
-       var h = obj.style.height;
-       var ch = obj.contentWindow.document.body.scrollHeight + 'px';
-       if (h==ch) {
-               return;
+       function resizeIframe(obj) {
+               //obj.style.height = 0;
+               _resizeIframe(obj, 0);
        }
-       console.log("_resizeIframe", obj, desth, ch);
-       if (desth!=ch) {
-               setTimeout(_resizeIframe, 500, obj, ch);
-       } else {
-               obj.style.height  = ch;
-               setTimeout(_resizeIframe, 1000, obj, ch);
+
+       function _resizeIframe(obj, desth) {
+               var h = obj.style.height;
+               var ch = obj.contentWindow.document.body.scrollHeight + 'px';
+               if (h==ch) {
+                       return;
+               }
+               console.log("_resizeIframe", obj, desth, ch);
+               if (desth!=ch) {
+                       setTimeout(_resizeIframe, 500, obj, ch);
+               } else {
+                       if (ch>0) obj.style.height  = ch;
+                       setTimeout(_resizeIframe, 1000, obj, ch);
+               }
        }
-  }
 
   function openClose(theID) {
     if(document.getElementById(theID).style.display == "block") {