diff options
Diffstat (limited to 'web/share/js/wm.js')
-rw-r--r-- | web/share/js/wm.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/web/share/js/wm.js b/web/share/js/wm.js index c292ece7..5dae326d 100644 --- a/web/share/js/wm.js +++ b/web/share/js/wm.js @@ -141,7 +141,7 @@ function WindowManager() { var view = self.getViewGeometry(); var rect = el_window.getBoundingClientRect(); - el_window.style.top = Math.max($("menu").clientHeight, Math.round((view.bottom - rect.height) / 2)) + "px"; + el_window.style.top = Math.max(__getMenuHeight(), Math.round((view.bottom - rect.height) / 2)) + "px"; el_window.style.left = Math.round((view.right - rect.width) / 2) + "px"; el_window.setAttribute("data-centered", ""); } @@ -154,13 +154,18 @@ function WindowManager() { self.getViewGeometry = function() { return { - top: $("menu").clientHeight, + top: __getMenuHeight(), bottom: Math.max(document.documentElement.clientHeight, window.innerHeight || 0), left: 0, right: Math.max(document.documentElement.clientWidth, window.innerWidth || 0), }; }; + var __getMenuHeight = function() { + var el_menu = $("menu"); + return (el_menu ? el_menu.clientHeight : 0); + }; + var __isWindowOnPage = function(el_window) { var view = self.getViewGeometry(); var rect = el_window.getBoundingClientRect(); @@ -257,7 +262,7 @@ function WindowManager() { if (el_window.style.visibility === "visible" && (orientation || el_window.hasAttribute("data-centered"))) { var rect = el_window.getBoundingClientRect(); - el_window.style.top = Math.max($("menu").clientHeight, Math.round((view.bottom - rect.height) / 2)) + "px"; + el_window.style.top = Math.max(__getMenuHeight(), Math.round((view.bottom - rect.height) / 2)) + "px"; el_window.style.left = Math.round((view.right - rect.width) / 2) + "px"; el_window.setAttribute("data-centered", ""); } |