From 52655f1c14a17f0ebb9d875f1e25ef614b18724e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 3 Jun 2011 10:15:27 +0000 Subject: [PATCH] nicer workaround --- phpgwapi/js/jsapi/jsapi.js | 57 ++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/phpgwapi/js/jsapi/jsapi.js b/phpgwapi/js/jsapi/jsapi.js index 70b50d3cb9..0c3e6d790a 100644 --- a/phpgwapi/js/jsapi/jsapi.js +++ b/phpgwapi/js/jsapi/jsapi.js @@ -130,30 +130,25 @@ function egw_openWindowCentered(_url, _windowName, _width, _height) // return the left position of the window function egw_getWindowLeft() { - // workaround for https://bugzilla.mozilla.org/show_bug.cgi?format=multiple&id=648250 window.(outerHeight|outerWidth|screenX|screenY) throw exception - if(is_mozilla && navigator.userAgent.toLowerCase().indexOf('fennec') == -1) - { - return window.screenX; - } - else - { - return window.screenLeft; + // workaround for Fennec bug https://bugzilla.mozilla.org/show_bug.cgi?format=multiple&id=648250 window.(outerHeight|outerWidth|screenX|screenY) throw exception + try { + if(is_mozilla) return window.screenX; } + catch (e) {} + + return window.screenLeft; } // return the left position of the window function egw_getWindowTop() { - // workaround for https://bugzilla.mozilla.org/show_bug.cgi?format=multiple&id=648250 window.(outerHeight|outerWidth|screenX|screenY) throw exception - if(is_mozilla && navigator.userAgent.toLowerCase().indexOf('fennec') == -1) - { - return window.screenY; - } - else - { - //alert(window.screenTop); - return window.screenTop-90; + // workaround for Fennec bug https://bugzilla.mozilla.org/show_bug.cgi?format=multiple&id=648250 window.(outerHeight|outerWidth|screenX|screenY) throw exception + try { + if(is_mozilla) return window.screenY; } + catch (e) {} + + return window.screenTop-90; } // get the outerWidth of the browser window. For IE we simply return the innerWidth @@ -191,29 +186,25 @@ function egw_getWindowInnerHeight() // get the outerWidth of the browser window. For IE we simply return the innerWidth function egw_getWindowOuterWidth() { - // workaround for https://bugzilla.mozilla.org/show_bug.cgi?format=multiple&id=648250 window.(outerHeight|outerWidth|screenX|screenY) throw exception - if (is_mozilla && navigator.userAgent.toLowerCase().indexOf('fennec') == -1) - { - return window.outerWidth; - } - else - { - return egw_getWindowInnerWidth(); + // workaround for Fennec bug https://bugzilla.mozilla.org/show_bug.cgi?format=multiple&id=648250 window.(outerHeight|outerWidth|screenX|screenY) throw exception + try { + if (is_mozilla) return window.outerWidth; } + catch (e) {} + + return egw_getWindowInnerWidth(); } // get the outerHeight of the browser window. For IE we simply return the innerHeight function egw_getWindowOuterHeight() { - // workaround for https://bugzilla.mozilla.org/show_bug.cgi?format=multiple&id=648250 window.(outerHeight|outerWidth|screenX|screenY) throw exception - if (is_mozilla && navigator.userAgent.toLowerCase().indexOf('fennec') == -1) - { - return window.outerHeight; - } - else - { - return egw_getWindowInnerHeight(); + // workaround for Fennec bug https://bugzilla.mozilla.org/show_bug.cgi?format=multiple&id=648250 window.(outerHeight|outerWidth|screenX|screenY) throw exception + try { + if (is_mozilla) return window.outerHeight; } + catch (e) {} + + return egw_getWindowInnerHeight(); } // ie selectbox dropdown menu hack. as ie is not able to resize dropdown menus from selectboxes, we