[ Index ] |
|
Code source de Horde 3.1.3 |
1 // htmlArea v3.0 - Copyright (c) 2003-2005 dynarch.com 2 // 2002-2003 interactivetools.com, inc. 3 // This copyright notice MUST stay intact for use (see license.txt). 4 // 5 // Portions (c) dynarch.com, 2003-2004 6 // 7 // A free WYSIWYG editor replacement for <textarea> fields. 8 // For full source code and docs, visit http://www.interactivetools.com/ 9 // 10 // Version 3.0 developed by Mihai Bazon. 11 // http://dynarch.com/mishoo 12 // 13 // $Id: dialog.js,v 1.7 2005/01/20 17:49:04 mishoo Exp $ 14 15 // Though "Dialog" looks like an object, it isn't really an object. Instead 16 // it's just namespace for protecting global symbols. 17 18 function Dialog(url, action, init) { 19 if (typeof init == "undefined") { 20 init = window; // pass this window object by default 21 } 22 Dialog._geckoOpenModal(url, action, init); 23 }; 24 25 Dialog._parentEvent = function(ev) { 26 setTimeout( function() { if (Dialog._modal && !Dialog._modal.closed) { Dialog._modal.focus() } }, 50); 27 if (Dialog._modal && !Dialog._modal.closed) { 28 HTMLArea._stopEvent(ev); 29 } 30 }; 31 32 33 // should be a function, the return handler of the currently opened dialog. 34 Dialog._return = null; 35 36 // constant, the currently opened dialog 37 Dialog._modal = null; 38 39 // the dialog will read it's args from this variable 40 Dialog._arguments = null; 41 42 Dialog._geckoOpenModal = function(url, action, init) { 43 var dlg = window.open(url, "hadialog", 44 "toolbar=no,menubar=no,personalbar=no,width=10,height=10," + 45 "scrollbars=no,resizable=yes,modal=yes,dependable=yes"); 46 Dialog._modal = dlg; 47 Dialog._arguments = init; 48 49 // capture some window's events 50 function capwin(w) { 51 HTMLArea._addEvent(w, "click", Dialog._parentEvent); 52 HTMLArea._addEvent(w, "mousedown", Dialog._parentEvent); 53 HTMLArea._addEvent(w, "focus", Dialog._parentEvent); 54 }; 55 // release the captured events 56 function relwin(w) { 57 HTMLArea._removeEvent(w, "click", Dialog._parentEvent); 58 HTMLArea._removeEvent(w, "mousedown", Dialog._parentEvent); 59 HTMLArea._removeEvent(w, "focus", Dialog._parentEvent); 60 }; 61 capwin(window); 62 // capture other frames 63 for (var i = 0; i < window.frames.length; capwin(window.frames[i++])); 64 // make up a function to be called when the Dialog ends. 65 Dialog._return = function (val) { 66 if (val && action) { 67 action(val); 68 } 69 relwin(window); 70 // capture other frames 71 for (var i = 0; i < window.frames.length; relwin(window.frames[i++])); 72 Dialog._modal = null; 73 }; 74 };
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |