Make sure the dom is rendered and is ready to append to it

This commit is contained in:
Hadi Nategh 2015-01-30 15:37:48 +00:00
parent 74eee4d061
commit ec13220449

View File

@ -163,7 +163,7 @@
this.$iFrame.attr('src',_url); this.$iFrame.attr('src',_url);
var self = this; var self = this;
//After the popup is fully loaded //After the popup is fully loaded
this.$iFrame.on('onpopupload', function (){ this.$iFrame.on('onpopupload', function (){
var popupWindow = this.contentWindow; var popupWindow = this.contentWindow;
@ -176,16 +176,16 @@
.click(function (){self.close(framework.popup_idx(self.$iFrame[0].contentWindow));}); .click(function (){self.close(framework.popup_idx(self.$iFrame[0].contentWindow));});
if ($appHeader.length > 0) if ($appHeader.length > 0)
{ {
$appHeader.addClass('egw_fw_mobile_popup_appHeader').prepend($closeBtn); setTimeout(function(){$appHeader.addClass('egw_fw_mobile_popup_appHeader').prepend($closeBtn)},0);
} }
} }
//Remove the loading class //Remove the loading class
self.$container.removeClass('egw_fw_mobile_popup_loader'); self.$container.removeClass('egw_fw_mobile_popup_loader');
self.$iFrame.css({visibility:'visible'}); self.$iFrame.css({visibility:'visible'});
}); });
this.$iFrame.on('load', this.$iFrame.on('load',
//In this function we can override all popup window objects //In this function we can override all popup window objects
function () function ()
@ -204,8 +204,8 @@
} }
); );
this.$container.show(); this.$container.show();
}, },
/** /**
* Close popup * Close popup
* @param {type} _idx remove the given popup index from the popups array * @param {type} _idx remove the given popup index from the popups array
@ -217,7 +217,7 @@
//Remove the closed popup from popups array //Remove the closed popup from popups array
window.framework.popups.splice(_idx,1); window.framework.popups.splice(_idx,1);
}, },
/** /**
* Resize the iFrame popup * Resize the iFrame popup
* @param {type} _width actuall width * @param {type} _width actuall width
@ -284,12 +284,12 @@
} }
this.sideboxSizeCallback(_sideboxStartSize); this.sideboxSizeCallback(_sideboxStartSize);
// Check if user runs the app in full screen or not, then prompt user base on the mode // Check if user runs the app in full screen or not, then prompt user base on the mode
var fullScreen = this.isNotFullScreen() var fullScreen = this.isNotFullScreen()
if (fullScreen) egw.message(fullScreen,'info'); if (fullScreen) egw.message(fullScreen,'info');
}, },
/** /**
* *
* @returns {undefined} * @returns {undefined}
@ -364,7 +364,7 @@
orientation: function () orientation: function ()
{ {
this.arrangeToolbar(this.isLandscape()?'landscape':'portrait'); this.arrangeToolbar(this.isLandscape()?'landscape':'portrait');
//Mail splitter needs to be docked after oriantation //Mail splitter needs to be docked after oriantation
if (this.activeApp.appName === 'mail' && egwIsMobile()) if (this.activeApp.appName === 'mail' && egwIsMobile())
{ {
@ -406,7 +406,7 @@
this.setToggleMenuState('on'); this.setToggleMenuState('on');
if (!this.isLandscape()) $tabs.removeClass('tabs-header-portrait-collapsed'); if (!this.isLandscape()) $tabs.removeClass('tabs-header-portrait-collapsed');
} }
//Audio effect for toggleMenu //Audio effect for toggleMenu
var audio = $j('#egw_fw_menuAudioTag'); var audio = $j('#egw_fw_menuAudioTag');
if (egw.preference('audio_effect','common') == '1') audio[0].play(); if (egw.preference('audio_effect','common') == '1') audio[0].play();
@ -565,7 +565,7 @@
if (_iframe) if (_iframe)
{ {
height +=25; height +=25;
// Fix for iFrame Scrollbar for iOS // Fix for iFrame Scrollbar for iOS
// ATM safari does not support regular scrolling content insdie an iframe, therefore // ATM safari does not support regular scrolling content insdie an iframe, therefore
// we need to wrap them all with a div and apply overflow:scroll // we need to wrap them all with a div and apply overflow:scroll
@ -583,7 +583,7 @@
} }
} }
height += jQuery('#egw_fw_sidebar').offset().top; height += jQuery('#egw_fw_sidebar').offset().top;
// fullScreen iOS need to be set with different height as safari adds an extra bottom border // fullScreen iOS need to be set with different height as safari adds an extra bottom border
if (this.getUserAgent() === 'iOS' && !this.isNotFullScreen()) if (this.getUserAgent() === 'iOS' && !this.isNotFullScreen())
{ {
@ -593,9 +593,9 @@
{ {
height +=20; height +=20;
} }
if (!this.isLandscape()) return height - 30; if (!this.isLandscape()) return height - 30;
return height; return height;
}, },
@ -636,11 +636,11 @@
openPopup: function(_url, _width, _height, _windowName, _app, _returnID, _status, _parentWnd) openPopup: function(_url, _width, _height, _windowName, _app, _returnID, _status, _parentWnd)
{ {
if (typeof _returnID == 'undefined') _returnID = false; if (typeof _returnID == 'undefined') _returnID = false;
var $wnd = jQuery(_parentWnd.top); var $wnd = jQuery(_parentWnd.top);
var positionLeft = ($wnd.outerWidth()/2)-(_width/2)+_parentWnd.screenX; var positionLeft = ($wnd.outerWidth()/2)-(_width/2)+_parentWnd.screenX;
var positionTop = ($wnd.outerHeight()/2)-(_height/2)+_parentWnd.screenY; var positionTop = ($wnd.outerHeight()/2)-(_height/2)+_parentWnd.screenY;
var navigate = false; var navigate = false;
if (typeof _app != 'undefined' && _app !== false) if (typeof _app != 'undefined' && _app !== false)
{ {
@ -715,7 +715,7 @@
window.framework.popups[i].close(i); window.framework.popups[i].close(i);
} }
}, },
resize_popup: function (_w,_h, _wnd) resize_popup: function (_w,_h, _wnd)
{ {
var i = this.popup_idx(_wnd); var i = this.popup_idx(_wnd);
@ -753,10 +753,10 @@
return egw.lang('For better experience please install mobile template in your device: tap on chrome setting and then select Add to Home Screen'); return egw.lang('For better experience please install mobile template in your device: tap on chrome setting and then select Add to Home Screen');
} }
case 'unknown': case 'unknown':
} }
}, },
/** /**
* get the device platform * get the device platform
* @returns {string} returns device platform name * @returns {string} returns device platform name
@ -767,7 +767,7 @@
// iOS and safari // iOS and safari
if( userAgent.match( /iPad/i ) || userAgent.match( /iPhone/i ) || userAgent.match( /iPod/i ) ) if( userAgent.match( /iPad/i ) || userAgent.match( /iPhone/i ) || userAgent.match( /iPod/i ) )
{ {
return 'iOS'; return 'iOS';
} }
// Android // Android
if (userAgent.match(/android/i)) if (userAgent.match(/android/i))
@ -776,10 +776,10 @@
} }
return 'unknown' return 'unknown'
}, },
/** /**
* Calculate the excess height available on popup frame. The excess height will be use in etemplate2 resize handler * Calculate the excess height available on popup frame. The excess height will be use in etemplate2 resize handler
* *
* @param {type} _wnd current window * @param {type} _wnd current window
* @returns {Number} excess height * @returns {Number} excess height
*/ */
@ -792,14 +792,14 @@
var excess_height = egw(_wnd).is_popup()? $j(_wnd).height() - $popup.find('#popupMainDiv').height() - $appHeader.outerHeight()+10: false; var excess_height = egw(_wnd).is_popup()? $j(_wnd).height() - $popup.find('#popupMainDiv').height() - $appHeader.outerHeight()+10: false;
// Recalculate excess height if the appheader is shown, e.g. mobile framework dialogs // Recalculate excess height if the appheader is shown, e.g. mobile framework dialogs
if ($appHeader.length > 0 && $appHeader.is(':visible')) excess_height -= $appHeader.outerHeight()-9; if ($appHeader.length > 0 && $appHeader.is(':visible')) excess_height -= $appHeader.outerHeight()-9;
return excess_height; return excess_height;
}, },
/** /**
* Function runs after etemplate is fully loaded * Function runs after etemplate is fully loaded
* - Triggers onpopupload framework popup's event * - Triggers onpopupload framework popup's event
* *
* @param {type} _wnd local window * @param {type} _wnd local window
*/ */
et2_loadingFinished: function (_wnd) et2_loadingFinished: function (_wnd)