MDL-23617 improved YUI resizing
authorPetr Skoda <skodak@moodle.org>
Fri, 15 Oct 2010 08:55:24 +0000 (08:55 +0000)
committerPetr Skoda <skodak@moodle.org>
Fri, 15 Oct 2010 08:55:24 +0000 (08:55 +0000)
lib/javascript-static.js

index e027ee3..f8831c6 100644 (file)
@@ -316,18 +316,14 @@ M.util.init_maximised_embed = function(Y, id) {
         } else {
             obj.setStyle('width', '600px');
         }
-        var pageheight = get_htmlelement_size('page', 'height');
-        var objheight = get_htmlelement_size(obj, 'height');
-        var newheight = objheight + parseInt(obj.get('winHeight')) - pageheight - 30;
-        if (newheight > 400) {
-            if (newheight > 768) {
-                obj.setStyle('height', '768px');
-            } else {
-                obj.setStyle('height', newheight + 'px');
-            }
-        } else {
-            obj.setStyle('height', '400px');
+
+        var headerheight = get_htmlelement_size('page-header', 'height');
+        var footerheight = get_htmlelement_size('page-footer', 'height');
+        var newheight = parseInt(YAHOO.util.Dom.getViewportHeight()) - footerheight - headerheight - 20;
+        if (newheight < 400) {
+            newheight = 400;
         }
+        obj.setStyle('height', newheight+'px');
     };
 
     resize_object();