[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/lib/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.interactivetools.com/
   8  //
   9  // Version 3.0 developed by Mihai Bazon.
  10  //   http://dynarch.com/mishoo
  11  //
  12  // $Id: popup.js,v 1.1 2006/03/04 15:24:17 julmis 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  
  51      document.body.onkeypress = __dlg_close_on_esc;
  52      window.focus();
  53  };
  54  
  55  function __dlg_translate(i18n) {
  56      var types = ["span", "option", "td", "button", "div"];
  57      for (var type in types) {
  58          var spans = document.getElementsByTagName(types[type]);
  59          for (var i = spans.length; --i >= 0;) {
  60              var span = spans[i];
  61              if (span.firstChild && span.firstChild.data) {
  62                  var txt = i18n[span.firstChild.data];
  63                  if (txt)
  64                      span.firstChild.data = txt;
  65              }
  66          }
  67      }
  68      var txt = i18n[document.title];
  69      if (txt)
  70          document.title = txt;
  71  };
  72  
  73  // closes the dialog and passes the return info upper.
  74  function __dlg_close(val) {
  75          opener.Dialog._return(val);
  76      window.close();
  77  };
  78  
  79  function __dlg_close_on_esc(ev) {
  80      ev || (ev = window.event);
  81      if (ev.keyCode == 27) {
  82          window.close();
  83          return false;
  84      }
  85      return true;
  86  };


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7