1 // htmlArea v3.0 - Copyright (c) 2002, 2003 interactivetools.com, inc.
2 // This copyright notice MUST stay intact for use (see license.txt).
4 // Portions (c) dynarch.com, 2003
6 // A free WYSIWYG editor replacement for <textarea> fields.
7 // For full source code and docs, visit http://www.interactivetools.com/
9 // Version 3.0 developed by Mihai Bazon.
10 // http://dynarch.com/mishoo
14 function getAbsolutePos(el) {
15 var r = { x: el.offsetLeft, y: el.offsetTop };
16 if (el.offsetParent) {
17 var tmp = getAbsolutePos(el.offsetParent);
24 function comboSelectValue(c, val) {
25 var ops = c.getElementsByTagName("option");
26 for (var i = ops.length; --i >= 0;) {
28 op.selected = (op.value == val);
33 function __dlg_onclose() {
34 opener.Dialog._return(null);
37 function __dlg_init(bottom) {
38 var body = document.body;
40 if (typeof bottom == "undefined") {
41 var div = document.createElement("div");
42 body.appendChild(div);
43 var pos = getAbsolutePos(div);
46 var pos = getAbsolutePos(bottom);
47 body_height = pos.y + bottom.offsetHeight;
49 window.dialogArguments = opener.Dialog._arguments;
51 document.body.onkeypress = __dlg_close_on_esc;
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;) {
61 if (span.firstChild && span.firstChild.data) {
62 var txt = i18n[span.firstChild.data];
64 span.firstChild.data = txt;
68 var txt = i18n[document.title];
73 // closes the dialog and passes the return info upper.
74 function __dlg_close(val) {
75 opener.Dialog._return(val);
79 function __dlg_close_on_esc(ev) {
80 ev || (ev = window.event);
81 if (ev.keyCode == 27) {