[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/services/editor/htmlarea/popups/ -> popup.js (source)

   1  // htmlArea v3.0 - Copyright (c) 2002, 2003 interactivetools.com, inc.
   2  // This copyright notice MUST stay intact for use (see license.txt).
   3  //
   4  // Portions (c) dynarch.com, 2003
   5  //
   6  // A free WYSIWYG editor replacement for <textarea> fields.
   7  // For full source code and docs, visit http://www.htmlarea.com/
   8  //
   9  // Version 3.0 developed by Mihai Bazon.
  10  //   http://dynarch.com/mishoo
  11  //
  12  // $Id: popup.js,v 1.12 2005/01/24 18:29:48 itools Exp $
  13  
  14  function getAbsolutePos(el) {
  15      var r = { x: el.offsetLeft, y: el.offsetTop };
  16      if (el.offsetParent) {
  17          var tmp = getAbsolutePos(el.offsetParent);
  18          r.x += tmp.x;
  19          r.y += tmp.y;
  20      }
  21      return r;
  22  };
  23  
  24  function comboSelectValue(c, val) {
  25      var ops = c.getElementsByTagName("option");
  26      for (var i = ops.length; --i >= 0;) {
  27          var op = ops[i];
  28          op.selected = (op.value == val);
  29      }
  30      c.value = val;
  31  };
  32  
  33  function __dlg_onclose() {
  34      opener.Dialog._return(null);
  35  };
  36  
  37  function __dlg_init(bottom) {
  38      var body = document.body;
  39      var body_height = 0;
  40      if (typeof bottom == "undefined") {
  41          var div = document.createElement("div");
  42          body.appendChild(div);
  43          var pos = getAbsolutePos(div);
  44          body_height = pos.y;
  45      } else {
  46          var pos = getAbsolutePos(bottom);
  47          body_height = pos.y + bottom.offsetHeight;
  48      }
  49      window.dialogArguments = opener.Dialog._arguments;
  50      if (!document.all) {
  51          window.sizeToContent();
  52          window.sizeToContent();    // for reasons beyond understanding,
  53                      // only if we call it twice we get the
  54                      // correct size.
  55          window.addEventListener("unload", __dlg_onclose, true);
  56          window.innerWidth = body.offsetWidth + 5;
  57          window.innerHeight = body_height + 2;
  58          // center on parent
  59          var x = opener.screenX + (opener.outerWidth - window.outerWidth) / 2;
  60          var y = opener.screenY + (opener.outerHeight - window.outerHeight) / 2;
  61          window.moveTo(x, y);
  62      } else {
  63          // window.dialogHeight = body.offsetHeight + 50 + "px";
  64          // window.dialogWidth = body.offsetWidth + "px";
  65          window.resizeTo(body.offsetWidth, body_height);
  66          var ch = body.clientHeight;
  67          var cw = body.clientWidth;
  68          window.resizeBy(body.offsetWidth - cw, body_height - ch);
  69          var W = body.offsetWidth;
  70          var H = 2 * body_height - ch;
  71          var x = (screen.availWidth - W) / 2;
  72          var y = (screen.availHeight - H) / 2;
  73          window.moveTo(x, y);
  74      }
  75      document.body.onkeypress = __dlg_close_on_esc;
  76  };
  77  
  78  function __dlg_translate(i18n) {
  79      var types = ["input", "select", "legend", "span", "option", "td", "button", "div"];
  80      for (var type = 0; type < types.length; ++type) {
  81          var spans = document.getElementsByTagName(types[type]);
  82          for (var i = spans.length; --i >= 0;) {
  83              var span = spans[i];
  84              if (span.firstChild && span.firstChild.data) {
  85                  var txt = i18n[span.firstChild.data];
  86                  if (txt)
  87                      span.firstChild.data = txt;
  88              }
  89                          if (span.title) {
  90                  var txt = i18n[span.title];
  91                  if (txt)
  92                      span.title = txt;
  93                          }
  94          }
  95      }
  96      var txt = i18n[document.title];
  97      if (txt)
  98          document.title = txt;
  99  };
 100  
 101  // closes the dialog and passes the return info upper.
 102  function __dlg_close(val) {
 103      opener.Dialog._return(val);
 104      window.close();
 105  };
 106  
 107  function __dlg_close_on_esc(ev) {
 108      ev || (ev = window.event);
 109      if (ev.keyCode == 27) {
 110          window.close();
 111          return false;
 112      }
 113      return true;
 114  };


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7