From 6c7c29316ab8053d30dc89a59286b1e8f9dbbe70 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 30 Oct 2014 11:09:38 +0000 Subject: [PATCH] making popup resize a bit more relyable by using an extra timeout and trigger it for every load, not just first one --- phpgwapi/js/jsapi/egw.js | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/phpgwapi/js/jsapi/egw.js b/phpgwapi/js/jsapi/egw.js index 543e3ae844..d0576aa572 100644 --- a/phpgwapi/js/jsapi/egw.js +++ b/phpgwapi/js/jsapi/egw.js @@ -223,22 +223,23 @@ if(popup || window.opener) { // Resize popup when et2 load is done - jQuery(node).one("load",function() { - var $main_div = $j('#popupMainDiv'); - var $et2 = $j('.et2_container'); - var w = { - width: egw_getWindowInnerWidth(), - height: egw_getWindowInnerHeight() - }; - // Use et2_container for width since #popupMainDiv is full width, but we still need - // to take padding/margin into account - var delta_width = w.width - ($et2.outerWidth(true) + ($main_div.outerWidth(true) - $main_div.width())); - var delta_height = w.height - ($et2.outerHeight(true) + ($main_div.outerHeight(true) - $main_div.height())); - debugger; - if(delta_width != 0 || delta_height != 0) - { - window.resizeTo(egw_getWindowOuterWidth() - delta_width,egw_getWindowOuterHeight() - delta_height); - } + jQuery(node).on("load",function() { + window.setTimeout(function() { + var $main_div = $j('#popupMainDiv'); + var $et2 = $j('.et2_container'); + var w = { + width: egw_getWindowInnerWidth(), + height: egw_getWindowInnerHeight() + }; + // Use et2_container for width since #popupMainDiv is full width, but we still need + // to take padding/margin into account + var delta_width = w.width - ($et2.outerWidth(true) + ($main_div.outerWidth(true) - $main_div.width())); + var delta_height = w.height - ($et2.outerHeight(true) + ($main_div.outerHeight(true) - $main_div.height())); + if(delta_width != 0 || delta_height != 0) + { + window.resizeTo(egw_getWindowOuterWidth() - delta_width,egw_getWindowOuterHeight() - delta_height); + } + }, 200); }); } var et2 = new etemplate2(node, currentapp+".etemplate_new.ajax_process_content.etemplate");