[ Index ] |
|
Code source de FCKeditor 2.4 |
1 /* 2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 3 * Copyright (C) 2003-2007 Frederico Caldeira Knabben 4 * 5 * == BEGIN LICENSE == 6 * 7 * Licensed under the terms of any of the following licenses at your 8 * choice: 9 * 10 * - GNU General Public License Version 2 or later (the "GPL") 11 * http://www.gnu.org/licenses/gpl.html 12 * 13 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 14 * http://www.gnu.org/licenses/lgpl.html 15 * 16 * - Mozilla Public License Version 1.1 or later (the "MPL") 17 * http://www.mozilla.org/MPL/MPL-1.1.html 18 * 19 * == END LICENSE == 20 * 21 * File Name: fckdialog_gecko.js 22 * Dialog windows operations. (Gecko specific implementations) 23 * 24 * File Authors: 25 * Frederico Caldeira Knabben (www.fckeditor.net) 26 */ 27 28 FCKDialog.Show = function( dialogInfo, dialogName, pageUrl, dialogWidth, dialogHeight, parentWindow, resizable ) 29 { 30 var iTop = (FCKConfig.ScreenHeight - dialogHeight) / 2 ; 31 var iLeft = (FCKConfig.ScreenWidth - dialogWidth) / 2 ; 32 33 var sOption = "location=no,menubar=no,toolbar=no,dependent=yes,dialog=yes,minimizable=no,modal=yes,alwaysRaised=yes" + 34 ",resizable=" + ( resizable ? 'yes' : 'no' ) + 35 ",width=" + dialogWidth + 36 ",height=" + dialogHeight + 37 ",top=" + iTop + 38 ",left=" + iLeft ; 39 40 if ( !parentWindow ) 41 parentWindow = window ; 42 43 FCKFocusManager.Lock() ; 44 45 var oWindow = parentWindow.open( '', 'FCKeditorDialog_' + dialogName, sOption, true ) ; 46 47 if ( !oWindow ) 48 { 49 alert( FCKLang.DialogBlocked ) ; 50 FCKFocusManager.Unlock() ; 51 return ; 52 } 53 54 oWindow.moveTo( iLeft, iTop ) ; 55 oWindow.resizeTo( dialogWidth, dialogHeight ) ; 56 oWindow.focus() ; 57 oWindow.location.href = pageUrl ; 58 59 oWindow.dialogArguments = dialogInfo ; 60 61 // On some Gecko browsers (probably over slow connections) the 62 // "dialogArguments" are not set to the target window so we must 63 // put it in the opener window so it can be used by the target one. 64 parentWindow.FCKLastDialogInfo = dialogInfo ; 65 66 this.Window = oWindow ; 67 68 // Try/Catch must be used to avoit an error when using a frameset 69 // on a different domain: 70 // "Permission denied to get property Window.releaseEvents". 71 try 72 { 73 window.top.parent.addEventListener( 'mousedown', this.CheckFocus, true ) ; 74 window.top.parent.addEventListener( 'mouseup', this.CheckFocus, true ) ; 75 window.top.parent.addEventListener( 'click', this.CheckFocus, true ) ; 76 window.top.parent.addEventListener( 'focus', this.CheckFocus, true ) ; 77 } 78 catch (e) 79 {} 80 } 81 82 FCKDialog.CheckFocus = function() 83 { 84 // It is strange, but we have to check the FCKDialog existence to avoid a 85 // random error: "FCKDialog is not defined". 86 if ( typeof( FCKDialog ) != "object" ) 87 return false ; 88 89 if ( FCKDialog.Window && !FCKDialog.Window.closed ) 90 FCKDialog.Window.focus() ; 91 else 92 { 93 // Try/Catch must be used to avoit an error when using a frameset 94 // on a different domain: 95 // "Permission denied to get property Window.releaseEvents". 96 try 97 { 98 window.top.parent.removeEventListener( 'onmousedown', FCKDialog.CheckFocus, true ) ; 99 window.top.parent.removeEventListener( 'mouseup', FCKDialog.CheckFocus, true ) ; 100 window.top.parent.removeEventListener( 'click', FCKDialog.CheckFocus, true ) ; 101 window.top.parent.removeEventListener( 'onfocus', FCKDialog.CheckFocus, true ) ; 102 } 103 catch (e) 104 {} 105 } 106 return false ; 107 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 15:28:05 2007 | par Balluche grâce à PHPXref 0.7 |