File:  [LON-CAPA] / loncom / html / htmlarea / Attic / dialog.js
Revision 1.2: download - view: text, annotated - select for diffs
Tue Jun 1 23:46:10 2004 UTC (20 years, 1 month ago) by www
Branches: MAIN
CVS tags: version_2_5_X, version_2_5_99_0, version_2_5_2, version_2_5_1, version_2_5_0, version_2_4_X, version_2_4_99_0, version_2_4_2, version_2_4_1, version_2_4_0, version_2_3_X, version_2_3_99_0, version_2_3_2, version_2_3_1, version_2_3_0, version_2_2_X, version_2_2_99_1, version_2_2_99_0, version_2_2_2, version_2_2_1, version_2_2_0, version_2_1_X, version_2_1_99_3, version_2_1_99_2, version_2_1_99_1, version_2_1_99_0, version_2_1_3, version_2_1_2, version_2_1_1, version_2_1_0, version_2_0_X, version_2_0_99_1, version_2_0_2, version_2_0_1, version_2_0_0, version_1_99_3, version_1_99_2, version_1_99_1_tmcc, version_1_99_1, version_1_99_0_tmcc, version_1_99_0, version_1_3_X, version_1_3_3, version_1_3_2, version_1_3_1, version_1_3_0, version_1_2_X, version_1_2_99_1, version_1_2_99_0, version_1_2_1, version_1_2_0, version_1_1_99_5, version_1_1_99_4, version_1_1_99_3, version_1_1_99_2, version_1_1_99_1, version_1_1_99_0, HEAD
Next version HTMLArea.

    1: // htmlArea v3.0 - Copyright (c) 2003-2004 interactivetools.com, inc.
    2: // This copyright notice MUST stay intact for use (see license.txt).
    3: //
    4: // Portions (c) dynarch.com, 2003-2004
    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: dialog.js,v 1.2 2004/06/01 23:46:10 www Exp $
   13: 
   14: // Though "Dialog" looks like an object, it isn't really an object.  Instead
   15: // it's just namespace for protecting global symbols.
   16: 
   17: function Dialog(url, action, init) {
   18: 	if (typeof init == "undefined") {
   19: 		init = window;	// pass this window object by default
   20: 	}
   21: 	Dialog._geckoOpenModal(url, action, init);
   22: };
   23: 
   24: Dialog._parentEvent = function(ev) {
   25: 	if (Dialog._modal && !Dialog._modal.closed) {
   26: 		Dialog._modal.focus();
   27: 		HTMLArea._stopEvent(ev);
   28: 	}
   29: };
   30: 
   31: // should be a function, the return handler of the currently opened dialog.
   32: Dialog._return = null;
   33: 
   34: // constant, the currently opened dialog
   35: Dialog._modal = null;
   36: 
   37: // the dialog will read it's args from this variable
   38: Dialog._arguments = null;
   39: 
   40: Dialog._geckoOpenModal = function(url, action, init) {
   41: 	var dlg = window.open(url, "hadialog",
   42: 			      "toolbar=no,menubar=no,personalbar=no,width=10,height=10," +
   43: 			      "scrollbars=no,resizable=yes");
   44: 	Dialog._modal = dlg;
   45: 	Dialog._arguments = init;
   46: 
   47: 	// capture some window's events
   48: 	function capwin(w) {
   49: 		HTMLArea._addEvent(w, "click", Dialog._parentEvent);
   50: 		HTMLArea._addEvent(w, "mousedown", Dialog._parentEvent);
   51: 		HTMLArea._addEvent(w, "focus", Dialog._parentEvent);
   52: 	};
   53: 	// release the captured events
   54: 	function relwin(w) {
   55: 		HTMLArea._removeEvent(w, "click", Dialog._parentEvent);
   56: 		HTMLArea._removeEvent(w, "mousedown", Dialog._parentEvent);
   57: 		HTMLArea._removeEvent(w, "focus", Dialog._parentEvent);
   58: 	};
   59: 	capwin(window);
   60: 	// capture other frames
   61: 	for (var i = 0; i < window.frames.length; capwin(window.frames[i++]));
   62: 	// make up a function to be called when the Dialog ends.
   63: 	Dialog._return = function (val) {
   64: 		if (val && action) {
   65: 			action(val);
   66: 		}
   67: 		relwin(window);
   68: 		// capture other frames
   69: 		for (var i = 0; i < window.frames.length; relwin(window.frames[i++]));
   70: 		Dialog._modal = null;
   71: 	};
   72: };

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>