Project

General

Profile

1
/*
2
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
 * Copyright (C) 2003-2008 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

    
22
(function()
23
{
24
	// IE6 doens't handle absolute positioning properly (it is always in quirks
25
	// mode). This function fixes the sizes and positions of many elements that
26
	// compose the skin (this is skin specific).
27
	var fixSizes = window.DoResizeFixes = function()
28
	{
29
		var fckDlg = window.document.body ;
30

    
31
		for ( var i = 0 ; i < fckDlg.childNodes.length ; i++ )
32
		{
33
			var child = fckDlg.childNodes[i] ;
34
			switch ( child.className )
35
			{
36
				case 'contents' :
37
					child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 ) ;	// -left -right
38
					child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 ) ;	// -bottom -top
39
					break ;
40

    
41
				case 'blocker' :
42
				case 'cover' :
43
					child.style.width = Math.max( 0, fckDlg.offsetWidth - 16 - 16 + 4 ) ;	// -left -right + 4
44
					child.style.height = Math.max( 0, fckDlg.clientHeight - 20 - 2 + 4 ) ;	// -bottom -top + 4
45
					break ;
46

    
47
				case 'tr' :
48
					child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ;
49
					break ;
50

    
51
				case 'tc' :
52
					child.style.width = Math.max( 0, fckDlg.clientWidth - 16 - 16 ) ;
53
					break ;
54

    
55
				case 'ml' :
56
					child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ;
57
					break ;
58

    
59
				case 'mr' :
60
					child.style.left = Math.max( 0, fckDlg.clientWidth - 16 ) ;
61
					child.style.height = Math.max( 0, fckDlg.clientHeight - 16 - 51 ) ;
62
					break ;
63

    
64
				case 'bl' :
65
					child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ;
66
					break ;
67

    
68
				case 'br' :
69
					child.style.left = Math.max( 0, fckDlg.clientWidth - 30 ) ;
70
					child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ;
71
					break ;
72

    
73
				case 'bc' :
74
					child.style.width = Math.max( 0, fckDlg.clientWidth - 30 - 30 ) ;
75
					child.style.top = Math.max( 0, fckDlg.clientHeight - 51 ) ;
76
					break ;
77
			}
78
		}
79
	}
80

    
81
	var closeButtonOver = function()
82
	{
83
		this.style.backgroundPosition = '-16px -687px' ;
84
	} ;
85

    
86
	var closeButtonOut = function()
87
	{
88
		this.style.backgroundPosition = '-16px -651px' ;
89
	} ;
90

    
91
	var fixCloseButton = function()
92
	{
93
		var closeButton = document.getElementById ( 'closeButton' ) ;
94

    
95
		closeButton.onmouseover	= closeButtonOver ;
96
		closeButton.onmouseout	= closeButtonOut ;
97
	}
98

    
99
	var onLoad = function()
100
	{
101
		fixSizes() ;
102
		fixCloseButton() ;
103

    
104
		window.attachEvent( 'onresize', fixSizes ) ;
105
		window.detachEvent( 'onload', onLoad ) ;
106
	}
107

    
108
	window.attachEvent( 'onload', onLoad ) ;
109

    
110
})() ;
(2-2/5)