diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-05-02 09:53:47 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-05-02 09:53:47 +0200 |
commit | 93580fab12e115bc7b39fa37c7a0bcb208229800 (patch) | |
tree | ce3c3ff01a8f0d8abf7e7cec994944eb3aa7734c /program/js | |
parent | 4741d17c7777ed64b0d90b9265125a5dc0d69432 (diff) |
Fix opened window size on small screens in browsers where height is an innerHeight (eg. Safari)
Diffstat (limited to 'program/js')
-rw-r--r-- | program/js/app.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/program/js/app.js b/program/js/app.js index 87f20679a..962651d17 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1629,13 +1629,17 @@ function rcube_webmail() this.open_window = function(url, width, height) { - var w = Math.min(width, screen.width - 10), - h = Math.min(height, screen.height - 100), - l = (screen.width - w) / 2 + (screen.left || 0), - t = Math.max(0, (screen.height - h) / 2 + (screen.top || 0) - 20), + var dh = (window.outerHeight || 0) - (window.innerHeight || 0), + dw = (window.outerWidth || 0) - (window.innerWidth || 0), + sh = screen.availHeight || screen.height, + sw = screen.availWidth || screen.width, + w = Math.min(width, sw), + h = Math.min(height, sh), + l = Math.max(0, (sw - w) / 2 + (screen.left || 0)), + t = Math.max(0, (sh - h) / 2 + (screen.top || 0)), wname = 'rcmextwin' + new Date().getTime(), extwin = window.open(url + (url.match(/\?/) ? '&' : '?') + '_extwin=1', wname, - 'width='+w+',height='+h+',top='+t+',left='+l+',resizable=yes,toolbar=no,status=no,location=no'); + 'width='+(w-dw)+',height='+(h-dh)+',top='+t+',left='+l+',resizable=yes,toolbar=no,status=no,location=no'); // write loading... message to empty windows if (!url && extwin.document) { |