Changeset 492 for trunk/popups


Ignore:
Timestamp:
04/30/06 03:29:24 (13 years ago)
Author:
gogo
Message:

Added the ability to specify an absolute dimension for the popup, win_dim is an object of the following form

var win_dim = {top: <int>, left: <int>, width: <int>, height: <int>}

where top and left specify the co-ordinates of the top and left sides of the window in pixels (starting from 0,0 as top-left of screen) and width and height specify the width and height of the window in pixels.

Related to ticket:603

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/popups/popup.js

    r446 r492  
    3636} 
    3737 
    38 function __dlg_init(bottom) { 
     38function __dlg_init(bottom, win_dim) { 
     39  if(window.__dlg_init_done) return true; 
     40   
    3941  if(window.opener._editor_skin != "") { 
    4042    var head = document.getElementsByTagName("head")[0]; 
     
    4648  } 
    4749        window.dialogArguments = opener.Dialog._arguments; 
     50 
     51  var body        = document.body; 
    4852   
    49         var body = document.body; 
    50         if (window.sizeToContent) { 
     53  if(win_dim) 
     54  { 
     55    window.resizeTo(win_dim.width, win_dim.height); 
     56    if(win_dim.top && win_dim.left) 
     57    { 
     58      window.moveTo(win_dim.left,win_dim.top); 
     59    } 
     60    else 
     61    { 
     62      var x = opener.screenX + (opener.outerWidth - win_dim.width) / 2; 
     63      var y = opener.screenY + (opener.outerHeight - win_dim.height) / 2; 
     64      window.moveTo(x,y); 
     65    } 
     66  } 
     67  else if (window.sizeToContent) { 
    5168                window.sizeToContent(); 
    5269                window.sizeToContent(); // for reasons beyond understanding, 
     
    6481                var body_height = body.scrollHeight; 
    6582     
    66                 window.resizeTo(body.offsetWidth, body_height); 
     83                window.resizeTo(body.scrollWidth, body_height); 
    6784                var ch = docElm && docElm.clientHeight ? docElm.clientHeight : body.clientHeight; 
    6885                var cw = docElm && docElm.clientWidth  ? docElm.clientWidth  : body.clientWidth; 
     
    7693        } 
    7794        HTMLArea.addDom0Event(document.body, 'keypress', __dlg_close_on_esc); 
     95  window.__dlg_init_done = true; 
    7896} 
    7997 
Note: See TracChangeset for help on using the changeset viewer.