2
* FCKeditor - The text editor for internet
3
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
5
* Licensed under the terms of the GNU Lesser General Public License:
6
* http://www.opensource.org/licenses/lgpl-license.php
8
* For further information visit:
9
* http://www.fckeditor.net/
11
* "Support Open Source software. What about a donation today?"
13
* File Name: fckdialog_gecko.js
14
* Dialog windows operations. (Gecko specific implementations)
17
* Frederico Caldeira Knabben (fredck@fckeditor.net)
20
FCKDialog.Show = function( dialogInfo, dialogName, pageUrl, dialogWidth, dialogHeight, parentWindow, resizable )
22
var iTop = (FCKConfig.ScreenHeight - dialogHeight) / 2 ;
23
var iLeft = (FCKConfig.ScreenWidth - dialogWidth) / 2 ;
25
var sOption = "location=no,menubar=no,toolbar=no,dependent=yes,dialog=yes,minimizable=no,modal=yes,alwaysRaised=yes" +
26
",resizable=" + ( resizable ? 'yes' : 'no' ) +
27
",width=" + dialogWidth +
28
",height=" + dialogHeight +
33
parentWindow = window ;
35
var oWindow = parentWindow.open( '', 'FCKeditorDialog_' + dialogName, sOption, true ) ;
39
alert( FCKLang.DialogBlocked ) ;
43
oWindow.moveTo( iLeft, iTop ) ;
44
oWindow.resizeTo( dialogWidth, dialogHeight ) ;
46
oWindow.location.href = pageUrl ;
48
oWindow.dialogArguments = dialogInfo ;
50
// On some Gecko browsers (probably over slow connections) the
51
// "dialogArguments" are not set to the target window so we must
52
// put it in the opener window so it can be used by the target one.
53
parentWindow.FCKLastDialogInfo = dialogInfo ;
55
this.Window = oWindow ;
57
// Try/Catch must be used to avoit an error when using a frameset
58
// on a different domain:
59
// "Permission denied to get property Window.releaseEvents".
62
window.top.captureEvents( Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS ) ;
63
window.top.parent.addEventListener( 'mousedown', this.CheckFocus, true ) ;
64
window.top.parent.addEventListener( 'mouseup', this.CheckFocus, true ) ;
65
window.top.parent.addEventListener( 'click', this.CheckFocus, true ) ;
66
window.top.parent.addEventListener( 'focus', this.CheckFocus, true ) ;
72
FCKDialog.CheckFocus = function()
74
// It is strange, but we have to check the FCKDialog existence to avoid a
75
// random error: "FCKDialog is not defined".
76
if ( typeof( FCKDialog ) != "object" )
79
if ( FCKDialog.Window && !FCKDialog.Window.closed )
80
FCKDialog.Window.focus() ;
83
// Try/Catch must be used to avoit an error when using a frameset
84
// on a different domain:
85
// "Permission denied to get property Window.releaseEvents".
88
window.top.releaseEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS) ;
89
window.top.parent.removeEventListener( 'onmousedown', FCKDialog.CheckFocus, true ) ;
90
window.top.parent.removeEventListener( 'mouseup', FCKDialog.CheckFocus, true ) ;
91
window.top.parent.removeEventListener( 'click', FCKDialog.CheckFocus, true ) ;
92
window.top.parent.removeEventListener( 'onfocus', FCKDialog.CheckFocus, true ) ;