diff options
Diffstat (limited to 'web/js/ui.js')
-rw-r--r-- | web/js/ui.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/web/js/ui.js b/web/js/ui.js index d04184c1..20bba472 100644 --- a/web/js/ui.js +++ b/web/js/ui.js @@ -122,9 +122,9 @@ function Ui() { return promise; }; - self.showWindow = function(el_window, raise=true) { - if (!__isWindowOnPage(el_window) || el_window.hasAttribute("data-centered")) { - var view = __getViewGeometry(); + self.showWindow = function(el_window, raise=true, center=false) { + if (!__isWindowOnPage(el_window) || el_window.hasAttribute("data-centered") || center) { + var view = self.getViewGeometry(); var rect = el_window.getBoundingClientRect(); el_window.style.top = Math.max($("ctl").clientHeight, Math.round((view.bottom - rect.height) / 2)) + "px"; el_window.style.left = Math.round((view.right - rect.width) / 2) + "px"; @@ -136,8 +136,17 @@ function Ui() { } }; + self.getViewGeometry = function() { + return { + top: $("ctl").clientHeight, + bottom: Math.max(document.documentElement.clientHeight, window.innerHeight || 0), + left: 0, + right: Math.max(document.documentElement.clientWidth, window.innerWidth || 0), + }; + }; + var __isWindowOnPage = function(el_window) { - var view = __getViewGeometry(); + var view = self.getViewGeometry(); var rect = el_window.getBoundingClientRect(); return ( @@ -148,15 +157,6 @@ function Ui() { ); }; - var __getViewGeometry = function() { - return { - top: $("ctl").clientHeight, - bottom: Math.max(document.documentElement.clientHeight, window.innerHeight || 0), - left: 0, - right: Math.max(document.documentElement.clientWidth, window.innerWidth || 0), - }; - }; - var __toggleMenu = function(el_a) { var all_hidden = true; @@ -211,7 +211,7 @@ function Ui() { }; var __organizeWindowsOnResize = function(orientation) { - var view = __getViewGeometry(); + var view = self.getViewGeometry(); Array.prototype.forEach.call($$("window"), function(el_window) { if (el_window.style.visibility === "visible" && (orientation || el_window.hasAttribute("data-centered"))) { var rect = el_window.getBoundingClientRect(); |