version 1.1, 2004/02/18 08:07:15
|
version 1.2, 2004/06/01 23:46:10
|
Line 1
|
Line 1
|
|
// htmlArea v3.0 - Copyright (c) 2003-2004 interactivetools.com, inc. |
|
// This copyright notice MUST stay intact for use (see license.txt). |
|
// |
|
// Portions (c) dynarch.com, 2003-2004 |
|
// |
|
// A free WYSIWYG editor replacement for <textarea> fields. |
|
// For full source code and docs, visit http://www.interactivetools.com/ |
|
// |
|
// Version 3.0 developed by Mihai Bazon. |
|
// http://dynarch.com/mishoo |
|
// |
|
// $Id$ |
|
|
// Though "Dialog" looks like an object, it isn't really an object. Instead |
// Though "Dialog" looks like an object, it isn't really an object. Instead |
// it's just namespace for protecting global symbols. |
// it's just namespace for protecting global symbols. |
|
|
Line 5 function Dialog(url, action, init) {
|
Line 18 function Dialog(url, action, init) {
|
if (typeof init == "undefined") { |
if (typeof init == "undefined") { |
init = window; // pass this window object by default |
init = window; // pass this window object by default |
} |
} |
if (document.all) { // here we hope that Mozilla will never support document.all |
Dialog._geckoOpenModal(url, action, init); |
var value = |
|
showModalDialog(url, init, |
|
// window.open(url, '_blank', |
|
"resizable: no; help: no; status: no; scroll: no"); |
|
if (action) { |
|
action(value); |
|
} |
|
} else { |
|
return Dialog._geckoOpenModal(url, action, init); |
|
} |
|
}; |
}; |
|
|
Dialog._parentEvent = function(ev) { |
Dialog._parentEvent = function(ev) { |
if (Dialog._modal && !Dialog._modal.closed) { |
if (Dialog._modal && !Dialog._modal.closed) { |
Dialog._modal.focus(); |
Dialog._modal.focus(); |
// we get here in Mozilla only, anyway, so we can safely use |
HTMLArea._stopEvent(ev); |
// the DOM version. |
|
ev.preventDefault(); |
|
ev.stopPropagation(); |
|
} |
} |
}; |
}; |
|
|
Line 38 Dialog._modal = null;
|
Line 38 Dialog._modal = null;
|
Dialog._arguments = null; |
Dialog._arguments = null; |
|
|
Dialog._geckoOpenModal = function(url, action, init) { |
Dialog._geckoOpenModal = function(url, action, init) { |
var dlg = window.open(url, "ha_dialog", |
var dlg = window.open(url, "hadialog", |
"toolbar=no,menubar=no,personalbar=no,width=10,height=10," + |
"toolbar=no,menubar=no,personalbar=no,width=10,height=10," + |
"scrollbars=no,resizable=no"); |
"scrollbars=no,resizable=yes"); |
Dialog._modal = dlg; |
Dialog._modal = dlg; |
Dialog._arguments = init; |
Dialog._arguments = init; |
|
|
// capture some window's events |
// capture some window's events |
function capwin(w) { |
function capwin(w) { |
w.addEventListener("click", Dialog._parentEvent, true); |
HTMLArea._addEvent(w, "click", Dialog._parentEvent); |
w.addEventListener("mousedown", Dialog._parentEvent, true); |
HTMLArea._addEvent(w, "mousedown", Dialog._parentEvent); |
w.addEventListener("focus", Dialog._parentEvent, true); |
HTMLArea._addEvent(w, "focus", Dialog._parentEvent); |
}; |
}; |
// release the captured events |
// release the captured events |
function relwin(w) { |
function relwin(w) { |
w.removeEventListener("focus", Dialog._parentEvent, true); |
HTMLArea._removeEvent(w, "click", Dialog._parentEvent); |
w.removeEventListener("mousedown", Dialog._parentEvent, true); |
HTMLArea._removeEvent(w, "mousedown", Dialog._parentEvent); |
w.removeEventListener("click", Dialog._parentEvent, true); |
HTMLArea._removeEvent(w, "focus", Dialog._parentEvent); |
}; |
}; |
capwin(window); |
capwin(window); |
// capture other frames |
// capture other frames |