Project

General

Profile

« Previous | Next » 

Revision 1630

Added by Dietmar over 12 years ago

  1. fixed fckeditorcode_ie.js in IE9 ( not the end of fixing )

View differences:

branches/2.8.x/CHANGELOG
12 12
===============================================================================
13 13

  
14 14
01 Mar-2012 Build 1628 Dietmar Woellbrink (Luisehahne)
15
# fixed fckeditorcode_ie.js in IE9 ( not the end of fixing )
16
01 Mar-2012 Build 1628 Dietmar Woellbrink (Luisehahne)
15 17
# fixed wrong file format, fckeditor and outputfilter
16 18
01 Mar-2012 Build 1628 Dietmar Woellbrink (Luisehahne)
17 19
! forgot changelog and version in Revision 1627
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1629');
54
if(!defined('REVISION')) define('REVISION', '1630');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/fckeditor/fckeditor/editor/dialog/fck_image/fck_image.js
1
/*
2
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
 * Copyright (C) 2003-2010 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
 * Scripts related to the Image dialog window (see fck_image.html).
22
 */
23

  
24
var dialog		= window.parent ;
25
var oEditor		= dialog.InnerDialogLoaded() ;
26
var FCK			= oEditor.FCK ;
27
var FCKLang		= oEditor.FCKLang ;
28
var FCKConfig	= oEditor.FCKConfig ;
29
var FCKDebug	= oEditor.FCKDebug ;
30
var FCKTools	= oEditor.FCKTools ;
31
var FCKRegexLib	= oEditor.FCKRegexLib ;
32

  
33
var bImageButton = ( document.location.search.length > 0 && document.location.search.substr(1) == 'ImageButton' ) ;
34

  
35
//#### Dialog Tabs
36

  
37
// Set the dialog tabs.
38
dialog.AddTab( 'Info', FCKLang.DlgImgInfoTab ) ;
39

  
40
if ( !bImageButton && !FCKConfig.ImageDlgHideLink )
41
	dialog.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ;
42

  
43
if ( FCKConfig.ImageUpload )
44
	dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ;
45

  
46
if ( !FCKConfig.ImageDlgHideAdvanced )
47
	dialog.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ;
48

  
49
// Function called when a dialog tag is selected.
50
function OnDialogTabChange( tabCode )
51
{
52
	ShowE('divInfo'		, ( tabCode == 'Info' ) ) ;
53
	ShowE('divLink'		, ( tabCode == 'Link' ) ) ;
54
	ShowE('divUpload'	, ( tabCode == 'Upload' ) ) ;
55
	ShowE('divAdvanced'	, ( tabCode == 'Advanced' ) ) ;
56
}
57

  
58
// Get the selected image (if available).
59
var oImage = dialog.Selection.GetSelectedElement() ;
60

  
61
if ( oImage && oImage.tagName != 'IMG' && !( oImage.tagName == 'INPUT' && oImage.type == 'image' ) )
62
	oImage = null ;
63

  
64
// Get the active link.
65
var oLink = dialog.Selection.GetSelection().MoveToAncestorNode( 'A' ) ;
66

  
67
var oImageOriginal ;
68

  
69
function UpdateOriginal( resetSize )
70
{
71
	if ( !eImgPreview )
72
		return ;
73

  
74
	if ( GetE('txtUrl').value.length == 0 )
75
	{
76
		oImageOriginal = null ;
77
		return ;
78
	}
79

  
80
	oImageOriginal = document.createElement( 'IMG' ) ;	// new Image() ;
81

  
82
	if ( resetSize )
83
	{
84
		oImageOriginal.onload = function()
85
		{
86
			this.onload = null ;
87
			ResetSizes() ;
88
		}
89
	}
90

  
91
	oImageOriginal.src = eImgPreview.src ;
92
}
93

  
94
var bPreviewInitialized ;
95

  
96
window.onload = function()
97
{
98
	// Translate the dialog box texts.
99
	oEditor.FCKLanguageManager.TranslatePage(document) ;
100

  
101
	GetE('btnLockSizes').title = FCKLang.DlgImgLockRatio ;
102
	GetE('btnResetSize').title = FCKLang.DlgBtnResetSize ;
103

  
104
	// Load the selected element information (if any).
105
	LoadSelection() ;
106

  
107
	// Show/Hide the "Browse Server" button.
108
	GetE('tdBrowse').style.display				= FCKConfig.ImageBrowser	? '' : 'none' ;
109
	GetE('divLnkBrowseServer').style.display	= FCKConfig.LinkBrowser		? '' : 'none' ;
110

  
111
	UpdateOriginal() ;
112

  
113
	// Set the actual uploader URL.
114
	if ( FCKConfig.ImageUpload )
115
		GetE('frmUpload').action = FCKConfig.ImageUploadURL ;
116

  
117
	dialog.SetAutoSize( true ) ;
118

  
119
	// Activate the "OK" button.
120
	dialog.SetOkButton( true ) ;
121

  
122
	SelectField( 'txtUrl' ) ;
123
}
124

  
125
function LoadSelection()
126
{
127
	if ( ! oImage ) return ;
128

  
129
	var sUrl = oImage.getAttribute( '_fcksavedurl' ) ;
130
	if ( sUrl == null )
131
		sUrl = GetAttribute( oImage, 'src', '' ) ;
132

  
133
	GetE('txtUrl').value    = sUrl ;
134
	GetE('txtAlt').value    = GetAttribute( oImage, 'alt', '' ) ;
135
	GetE('txtVSpace').value	= GetAttribute( oImage, 'vspace', '' ) ;
136
	GetE('txtHSpace').value	= GetAttribute( oImage, 'hspace', '' ) ;
137
	GetE('txtBorder').value	= GetAttribute( oImage, 'border', '' ) ;
138
	GetE('cmbAlign').value	= GetAttribute( oImage, 'align', '' ) ;
139

  
140
	var iWidth, iHeight ;
141

  
142
	var regexSize = /^\s*(\d+)px\s*$/i ;
143

  
144
	if ( oImage.style.width )
145
	{
146
		var aMatchW  = oImage.style.width.match( regexSize ) ;
147
		if ( aMatchW )
148
		{
149
			iWidth = aMatchW[1] ;
150
			oImage.style.width = '' ;
151
			SetAttribute( oImage, 'width' , iWidth ) ;
152
		}
153
	}
154

  
155
	if ( oImage.style.height )
156
	{
157
		var aMatchH  = oImage.style.height.match( regexSize ) ;
158
		if ( aMatchH )
159
		{
160
			iHeight = aMatchH[1] ;
161
			oImage.style.height = '' ;
162
			SetAttribute( oImage, 'height', iHeight ) ;
163
		}
164
	}
165

  
166
	GetE('txtWidth').value	= iWidth ? iWidth : GetAttribute( oImage, "width", '' ) ;
167
	GetE('txtHeight').value	= iHeight ? iHeight : GetAttribute( oImage, "height", '' ) ;
168

  
169
	// Get Advances Attributes
170
	GetE('txtAttId').value			= oImage.id ;
171
	GetE('cmbAttLangDir').value		= oImage.dir ;
172
	GetE('txtAttLangCode').value	= oImage.lang ;
173
	GetE('txtAttTitle').value		= oImage.title ;
174
	GetE('txtLongDesc').value		= oImage.longDesc ;
175

  
176
	if ( oEditor.FCKBrowserInfo.IsIE )
177
	{
178
		GetE('txtAttClasses').value = oImage.className || '' ;
179
		GetE('txtAttStyle').value = oImage.style.cssText ;
180
	}
181
	else
182
	{
183
		GetE('txtAttClasses').value = oImage.getAttribute('class',2) || '' ;
184
		GetE('txtAttStyle').value = oImage.getAttribute('style',2) ;
185
	}
186

  
187
	if ( oLink )
188
	{
189
		var sLinkUrl = oLink.getAttribute( '_fcksavedurl' ) ;
190
		if ( sLinkUrl == null )
191
			sLinkUrl = oLink.getAttribute('href',2) ;
192

  
193
		var sLinkRel = GetE('cmbLnkContentRel');
194

  
195
		if ( sLinkRel.lenght == null ) 
196
		{
197
			var myselect = document.getElementById("cmbLnkContentRel")
198
			var found = false;
199

  
200
			for (var i=0; i < myselect.options.length; i++)
201
			{
202
				if (myselect.options[i].value == oLink.rel)
203
				{
204
				  found = true;
205
				  break;
206
				} 
207
			}			
208

  
209
			if ( found == false ) 
210
			{
211
				try {
212
					myselect.add(new Option(oLink.rel, oLink.rel,true ), myselect.options[1]) //add new option to beginning of "cmbLnkContentRel"
213
					}
214
				catch(e) { //in IE, try the below version instead of add()
215
					myselect.add(new Option( oLink.rel, oLink.rel,true ),1 ) //add new option to beginning of "cmbLnkContentRel"
216
					//myselect.options[1].selected=true;
217
					}
218
			}
219
		} 
220
		GetE('txtLnkUrl').value		= sLinkUrl ;
221
		GetE('cmbLnkTarget').value	= oLink.target ;
222
		// Get Advances Attributes
223
		GetE('txtLnkTitle').value		= oLink.title ;
224
		GetE('cmbLnkContentRel').value	= oLink.rel ;
225
		GetE('txtLnkCharSet').value		= oLink.charset ;
226
		GetE('txtLnkId').value			= oLink.id ;
227
		GetE('txtLnkLangCode').value	= oLink.lang ;
228

  
229
		var sClass ;
230
		if ( oEditor.FCKBrowserInfo.IsIE )
231
		{
232
			sClass	= oLink.getAttribute('className',2) || '' ;
233
			// Clean up temporary classes for internal use:
234
			sClass = sClass.replace( FCKRegexLib.FCK_Class, '' ) ;
235
			GetE('txtLnkStyle').value	= oLink.style.cssText ;
236
		}
237
		else
238
		{
239
			sClass	= oLink.getAttribute('class',2) || '' ;
240
			GetE('txtLnkStyle').value	= oLink.getAttribute('style',2) || '' ;
241
		}
242
		GetE('txtLnkClasses').value	= sClass ;
243
	}
244
	UpdatePreview() ;
245
}
246

  
247
//#### The OK button was hit.
248
function Ok()
249
{
250
	if ( GetE('txtUrl').value.length == 0 )
251
	{
252
		dialog.SetSelectedTab( 'Info' ) ;
253
		GetE('txtUrl').focus() ;
254

  
255
		alert( FCKLang.DlgImgAlertUrl ) ;
256

  
257
		return false ;
258
	}
259

  
260
	var bHasImage = ( oImage != null ) ;
261

  
262
	if ( bHasImage && bImageButton && oImage.tagName == 'IMG' )
263
	{
264
		if ( confirm( 'Do you want to transform the selected image on a image button?' ) )
265
			oImage = null ;
266
	}
267
	else if ( bHasImage && !bImageButton && oImage.tagName == 'INPUT' )
268
	{
269
		if ( confirm( 'Do you want to transform the selected image button on a simple image?' ) )
270
			oImage = null ;
271
	}
272

  
273
	oEditor.FCKUndo.SaveUndoStep() ;
274
	if ( !bHasImage )
275
	{
276
		if ( bImageButton )
277
		{
278
			oImage = FCK.EditorDocument.createElement( 'input' ) ;
279
			oImage.type = 'image' ;
280
			oImage = FCK.InsertElement( oImage ) ;
281
		}
282
		else
283
			oImage = FCK.InsertElement( 'img' ) ;
284
	}
285

  
286
	UpdateImage( oImage ) ;
287

  
288
	var sLnkUrl = GetE('txtLnkUrl').value.Trim() ;
289
	if ( sLnkUrl.length == 0 )
290
	{
291
		if ( oLink )
292
			FCK.ExecuteNamedCommand( 'Unlink' ) ;
293
	}
294
	else
295
	{
296
		if ( oLink )	// Modifying an existent link.
297
		{
298
			oLink.href = sLnkUrl ;
299
		}
300
		else			// Creating a new link.
301
		{
302
			if ( !bHasImage )
303
				oEditor.FCKSelection.SelectNode( oImage ) ;
304

  
305
			oLink = oEditor.FCK.CreateLink( sLnkUrl )[0] ;
306

  
307
			if ( !bHasImage )
308
			{
309
				oEditor.FCKSelection.SelectNode( oLink ) ;
310
				oEditor.FCKSelection.Collapse( false ) ;
311
			}
312
		}
313

  
314
		// Target
315
		if( GetE('cmbLnkTarget').value != 'popup' )
316
			SetAttribute( oLink, 'target', GetE('cmbLnkTarget').value ) ;
317
		else
318
			SetAttribute( oLink, 'target', null ) ;
319

  
320
		SetAttribute( oLink, '_fcksavedurl', sLnkUrl ) ;
321
		// Advances Attributes
322
		SetAttribute( oLink, 'title'	, GetE('txtLnkTitle').value ) ;
323
		SetAttribute( oLink, 'rel'		, GetE('cmbLnkContentRel').value ) ;
324
		SetAttribute( oLink, 'lang'		, GetE('txtLnkLangCode').value ) ;
325
		SetAttribute( oLink, 'charset'	, GetE('txtLnkCharSet').value ) ;
326
/*
327
		alert( FCKLang.DlgImgAlertUrl ) ;
328
		SetAttribute( oLink, 'name'		, GetE('txtLnkName').value ) ;
329
		SetAttribute( oLink, 'target', GetE('cmbLnkTarget').value ) ;
330
*/
331
		if ( oEditor.FCKBrowserInfo.IsIE )
332
		{
333
			var sClass = GetE('txtLnkClasses').value ;
334
			// If it's also an anchor add an internal class
335

  
336
			if ( GetE('cmbLnkTarget').value.length != 0 )
337
				sClass += ' FCK__AnchorC' ;
338

  
339
			SetAttribute( oLink, 'className', sClass ) ;
340
			oLink.style.cssText = GetE('txtLnkStyle').value ;
341
		}
342
		else
343
		{
344
			SetAttribute( oLink, 'class', GetE('txtLnkClasses').value ) ;
345
			SetAttribute( oLink, 'style', GetE('txtLnkStyle').value ) ;
346
		}
347

  
348
	}
349

  
350
	// Select the (first) link.
351
	// oEditor.FCKSelection.SelectNode( aLinks[0] );
352

  
353
	return true ;
354
}
355

  
356
function UpdateImage( e, skipId )
357
{
358
	e.src = GetE('txtUrl').value ;
359
	SetAttribute( e, "_fcksavedurl", GetE('txtUrl').value ) ;
360
	SetAttribute( e, "alt"   , GetE('txtAlt').value ) ;
361
	SetAttribute( e, "width" , GetE('txtWidth').value ) ;
362
	SetAttribute( e, "height", GetE('txtHeight').value ) ;
363
	SetAttribute( e, "vspace", GetE('txtVSpace').value ) ;
364
	SetAttribute( e, "hspace", GetE('txtHSpace').value ) ;
365
	SetAttribute( e, "border", GetE('txtBorder').value ) ;
366
	SetAttribute( e, "align" , GetE('cmbAlign').value ) ;
367

  
368
	// Advances Attributes
369

  
370
	if ( ! skipId )
371
		SetAttribute( e, 'id', GetE('txtAttId').value ) ;
372

  
373
	SetAttribute( e, 'dir'		, GetE('cmbAttLangDir').value ) ;
374
	SetAttribute( e, 'lang'		, GetE('txtAttLangCode').value ) ;
375
	SetAttribute( e, 'title'	, GetE('txtAttTitle').value ) ;
376
	SetAttribute( e, 'longDesc'	, GetE('txtLongDesc').value ) ;
377

  
378
	if ( oEditor.FCKBrowserInfo.IsIE )
379
	{
380
		e.className = GetE('txtAttClasses').value ;
381
		e.style.cssText = GetE('txtAttStyle').value ;
382
	}
383
	else
384
	{
385
		SetAttribute( e, 'class'	, GetE('txtAttClasses').value ) ;
386
		SetAttribute( e, 'style', GetE('txtAttStyle').value ) ;
387
	}
388
}
389

  
390
var eImgPreview ;
391
var eImgPreviewLink ;
392

  
393
function SetPreviewElements( imageElement, linkElement )
394
{
395
	eImgPreview = imageElement ;
396
	eImgPreviewLink = linkElement ;
397

  
398
	UpdatePreview() ;
399
	UpdateOriginal() ;
400

  
401
	bPreviewInitialized = true ;
402
}
403

  
404
function UpdatePreview()
405
{
406
	if ( !eImgPreview || !eImgPreviewLink )
407
		return ;
408

  
409
	if ( GetE('txtUrl').value.length == 0 )
410
		eImgPreviewLink.style.display = 'none' ;
411
	else
412
	{
413
		UpdateImage( eImgPreview, true ) ;
414

  
415
		if ( GetE('txtLnkUrl').value.Trim().length > 0 )
416
			eImgPreviewLink.href = 'javascript:void(null);' ;
417
		else
418
			SetAttribute( eImgPreviewLink, 'href', '' ) ;
419

  
420
		eImgPreviewLink.style.display = '' ;
421
	}
422
}
423

  
424
var bLockRatio = true ;
425

  
426
function SwitchLock( lockButton )
427
{
428
	bLockRatio = !bLockRatio ;
429
	lockButton.className = bLockRatio ? 'BtnLocked' : 'BtnUnlocked' ;
430
	lockButton.title = bLockRatio ? 'Lock sizes' : 'Unlock sizes' ;
431

  
432
	if ( bLockRatio )
433
	{
434
		if ( GetE('txtWidth').value.length > 0 )
435
			OnSizeChanged( 'Width', GetE('txtWidth').value ) ;
436
		else
437
			OnSizeChanged( 'Height', GetE('txtHeight').value ) ;
438
	}
439
}
440

  
441
// Fired when the width or height input texts change
442
function OnSizeChanged( dimension, value )
443
{
444
	// Verifies if the aspect ration has to be maintained
445
	if ( oImageOriginal && bLockRatio )
446
	{
447
		var e = dimension == 'Width' ? GetE('txtHeight') : GetE('txtWidth') ;
448

  
449
		if ( value.length == 0 || isNaN( value ) )
450
		{
451
			e.value = '' ;
452
			return ;
453
		}
454

  
455
		if ( dimension == 'Width' )
456
			value = value == 0 ? 0 : Math.round( oImageOriginal.height * ( value  / oImageOriginal.width ) ) ;
457
		else
458
			value = value == 0 ? 0 : Math.round( oImageOriginal.width  * ( value / oImageOriginal.height ) ) ;
459

  
460
		if ( !isNaN( value ) )
461
			e.value = value ;
462
	}
463

  
464
	UpdatePreview() ;
465
}
466

  
467
// Fired when the Reset Size button is clicked
468
function ResetSizes()
469
{
470
	if ( ! oImageOriginal ) return ;
471
	if ( oEditor.FCKBrowserInfo.IsGecko && !oImageOriginal.complete )
472
	{
473
		setTimeout( ResetSizes, 50 ) ;
474
		return ;
475
	}
476

  
477
	GetE('txtWidth').value  = oImageOriginal.width ;
478
	GetE('txtHeight').value = oImageOriginal.height ;
479

  
480
	UpdatePreview() ;
481
}
482

  
483
function BrowseServer()
484
{
485
	OpenServerBrowser(
486
		'Image',
487
		FCKConfig.ImageBrowserURL,
488
		FCKConfig.ImageBrowserWindowWidth,
489
		FCKConfig.ImageBrowserWindowHeight ) ;
490
}
491

  
492
function LnkBrowseServer()
493
{
494
	OpenServerBrowser(
495
		'Link',
496
		FCKConfig.LinkBrowserURL,
497
		FCKConfig.LinkBrowserWindowWidth,
498
		FCKConfig.LinkBrowserWindowHeight ) ;
499
}
500

  
501
function OpenServerBrowser( type, url, width, height )
502
{
503
	sActualBrowser = type ;
504
	OpenFileBrowser( url, width, height ) ;
505
}
506

  
507
var sActualBrowser ;
508

  
509
function SetUrl( url, width, height, alt )
510
{
511
	if ( sActualBrowser == 'Link' )
512
	{
513
		GetE('txtLnkUrl').value = url ;
514
		UpdatePreview() ;
515
	}
516
	else
517
	{
518
		GetE('txtUrl').value = url ;
519
		GetE('txtWidth').value = width ? width : '' ;
520
		GetE('txtHeight').value = height ? height : '' ;
521

  
522
		if ( alt )
523
			GetE('txtAlt').value = alt;
524

  
525
		UpdatePreview() ;
526
		UpdateOriginal( true ) ;
527
	}
528

  
529
	dialog.SetSelectedTab( 'Info' ) ;
530
}
531

  
532
function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
533
{
534
	// Remove animation
535
	window.parent.Throbber.Hide() ;
536
	GetE( 'divUpload' ).style.display  = '' ;
537

  
538
	switch ( errorNumber )
539
	{
540
		case 0 :	// No errors
541
			alert( 'Your file has been successfully uploaded' ) ;
542
			break ;
543
		case 1 :	// Custom error
544
			alert( customMsg ) ;
545
			return ;
546
		case 101 :	// Custom warning
547
			alert( customMsg ) ;
548
			break ;
549
		case 201 :
550
			alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
551
			break ;
552
		case 202 :
553
			alert( 'Invalid file type' ) ;
554
			return ;
555
		case 203 :
556
			alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ;
557
			return ;
558
		case 500 :
559
			alert( 'The connector is disabled' ) ;
560
			break ;
561
		default :
562
			alert( 'Error on file upload. Error number: ' + errorNumber ) ;
563
			return ;
564
	}
565

  
566
	sActualBrowser = '' ;
567
	SetUrl( fileUrl ) ;
568
	GetE('frmUpload').reset() ;
569
}
570

  
571
var oUploadAllowedExtRegex	= new RegExp( FCKConfig.ImageUploadAllowedExtensions, 'i' ) ;
572
var oUploadDeniedExtRegex	= new RegExp( FCKConfig.ImageUploadDeniedExtensions, 'i' ) ;
573

  
574
function CheckUpload()
575
{
576
	var sFile = GetE('txtUploadFile').value ;
577

  
578
	if ( sFile.length == 0 )
579
	{
580
		alert( 'Please select a file to upload' ) ;
581
		return false ;
582
	}
583

  
584
	if ( ( FCKConfig.ImageUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) ||
585
		( FCKConfig.ImageUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) )
586
	{
587
		OnUploadCompleted( 202 ) ;
588
		return false ;
589
	}
590

  
591
	// Show animation
592
	window.parent.Throbber.Show( 100 ) ;
593
	GetE( 'divUpload' ).style.display  = 'none' ;
594

  
595
	return true ;
596
}
1
/*
2
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
 * Copyright (C) 2003-2010 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
 * Scripts related to the Image dialog window (see fck_image.html).
22
 */
23

  
24
var dialog		= window.parent ;
25
var oEditor		= dialog.InnerDialogLoaded() ;
26
var FCK			= oEditor.FCK ;
27
var FCKLang		= oEditor.FCKLang ;
28
var FCKConfig	= oEditor.FCKConfig ;
29
var FCKDebug	= oEditor.FCKDebug ;
30
var FCKTools	= oEditor.FCKTools ;
31
var FCKRegexLib	= oEditor.FCKRegexLib ;
32

  
33
var bImageButton = ( document.location.search.length > 0 && document.location.search.substr(1) == 'ImageButton' ) ;
34

  
35
//#### Dialog Tabs
36

  
37
// Set the dialog tabs.
38
dialog.AddTab( 'Info', FCKLang.DlgImgInfoTab ) ;
39

  
40
if ( !bImageButton && !FCKConfig.ImageDlgHideLink )
41
	dialog.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ;
42

  
43
if ( FCKConfig.ImageUpload )
44
	dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ;
45

  
46
if ( !FCKConfig.ImageDlgHideAdvanced )
47
	dialog.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ;
48

  
49
// Function called when a dialog tag is selected.
50
function OnDialogTabChange( tabCode )
51
{
52
	ShowE('divInfo'		, ( tabCode == 'Info' ) ) ;
53
	ShowE('divLink'		, ( tabCode == 'Link' ) ) ;
54
	ShowE('divUpload'	, ( tabCode == 'Upload' ) ) ;
55
	ShowE('divAdvanced'	, ( tabCode == 'Advanced' ) ) ;
56
}
57

  
58
// Get the selected image (if available).
59
var oImage = dialog.Selection.GetSelectedElement() ;
60

  
61
if ( oImage && oImage.tagName != 'IMG' && !( oImage.tagName == 'INPUT' && oImage.type == 'image' ) )
62
	oImage = null ;
63

  
64
// Get the active link.
65
var oLink = dialog.Selection.GetSelection().MoveToAncestorNode( 'A' ) ;
66

  
67
var oImageOriginal ;
68

  
69
function UpdateOriginal( resetSize )
70
{
71
	if ( !eImgPreview )
72
		return ;
73

  
74
	if ( GetE('txtUrl').value.length == 0 )
75
	{
76
		oImageOriginal = null ;
77
		return ;
78
	}
79

  
80
	oImageOriginal = document.createElement( 'IMG' ) ;	// new Image() ;
81

  
82
	if ( resetSize )
83
	{
84
		oImageOriginal.onload = function()
85
		{
86
			this.onload = null ;
87
			ResetSizes() ;
88
		}
89
	}
90

  
91
	oImageOriginal.src = eImgPreview.src ;
92
}
93

  
94
var bPreviewInitialized ;
95

  
96
window.onload = function()
97
{
98
	// Translate the dialog box texts.
99
	oEditor.FCKLanguageManager.TranslatePage(document) ;
100

  
101
	GetE('btnLockSizes').title = FCKLang.DlgImgLockRatio ;
102
	GetE('btnResetSize').title = FCKLang.DlgBtnResetSize ;
103

  
104
	// Load the selected element information (if any).
105
	LoadSelection() ;
106

  
107
	// Show/Hide the "Browse Server" button.
108
	GetE('tdBrowse').style.display				= FCKConfig.ImageBrowser	? '' : 'none' ;
109
	GetE('divLnkBrowseServer').style.display	= FCKConfig.LinkBrowser		? '' : 'none' ;
110

  
111
	UpdateOriginal() ;
112

  
113
	// Set the actual uploader URL.
114
	if ( FCKConfig.ImageUpload )
115
		GetE('frmUpload').action = FCKConfig.ImageUploadURL ;
116

  
117
	dialog.SetAutoSize( true ) ;
118

  
119
	// Activate the "OK" button.
120
	dialog.SetOkButton( true ) ;
121

  
122
	SelectField( 'txtUrl' ) ;
123
}
124

  
125
function LoadSelection()
126
{
127
	if ( ! oImage ) return ;
128

  
129
	var sUrl = oImage.getAttribute( '_fcksavedurl' ) ;
130
	if ( sUrl == null )
131
		sUrl = GetAttribute( oImage, 'src', '' ) ;
132

  
133
	GetE('txtUrl').value    = sUrl ;
134
	GetE('txtAlt').value    = GetAttribute( oImage, 'alt', '' ) ;
135
	GetE('txtVSpace').value	= GetAttribute( oImage, 'vspace', '' ) ;
136
	GetE('txtHSpace').value	= GetAttribute( oImage, 'hspace', '' ) ;
137
	GetE('txtBorder').value	= GetAttribute( oImage, 'border', '' ) ;
138
	GetE('cmbAlign').value	= GetAttribute( oImage, 'align', '' ) ;
139

  
140
	var iWidth, iHeight ;
141

  
142
	var regexSize = /^\s*(\d+)px\s*$/i ;
143

  
144
	if ( oImage.style.width )
145
	{
146
		var aMatchW  = oImage.style.width.match( regexSize ) ;
147
		if ( aMatchW )
148
		{
149
			iWidth = aMatchW[1] ;
150
			oImage.style.width = '' ;
151
			SetAttribute( oImage, 'width' , iWidth ) ;
152
		}
153
	}
154

  
155
	if ( oImage.style.height )
156
	{
157
		var aMatchH  = oImage.style.height.match( regexSize ) ;
158
		if ( aMatchH )
159
		{
160
			iHeight = aMatchH[1] ;
161
			oImage.style.height = '' ;
162
			SetAttribute( oImage, 'height', iHeight ) ;
163
		}
164
	}
165

  
166
	GetE('txtWidth').value	= iWidth ? iWidth : GetAttribute( oImage, "width", '' ) ;
167
	GetE('txtHeight').value	= iHeight ? iHeight : GetAttribute( oImage, "height", '' ) ;
168

  
169
	// Get Advances Attributes
170
	GetE('txtAttId').value			= oImage.id ;
171
	GetE('cmbAttLangDir').value		= oImage.dir ;
172
	GetE('txtAttLangCode').value	= oImage.lang ;
173
	GetE('txtAttTitle').value		= oImage.title ;
174
	GetE('txtLongDesc').value		= oImage.longDesc ;
175

  
176
	if ( oEditor.FCKBrowserInfo.IsIE )
177
	{
178
		GetE('txtAttClasses').value = oImage.className || '' ;
179
		GetE('txtAttStyle').value = oImage.style.cssText ;
180
	}
181
	else
182
	{
183
		GetE('txtAttClasses').value = oImage.getAttribute('class',2) || '' ;
184
		GetE('txtAttStyle').value = oImage.getAttribute('style',2) ;
185
	}
186

  
187
	if ( oLink )
188
	{
189
		var sLinkUrl = oLink.getAttribute( '_fcksavedurl' ) ;
190
		if ( sLinkUrl == null )
191
			sLinkUrl = oLink.getAttribute('href',2) ;
192

  
193
		var sLinkRel = GetE('cmbLnkContentRel');
194

  
195
		if ( sLinkRel.lenght == null ) 
196
		{
197
			var myselect = document.getElementById("cmbLnkContentRel")
198
			var found = false;
199

  
200
			for (var i=0; i < myselect.options.length; i++)
201
			{
202
				if (myselect.options[i].value == oLink.rel)
203
				{
204
				  found = true;
205
				  break;
206
				} 
207
			}			
208

  
209
			if ( found == false ) 
210
			{
211
				try {
212
					myselect.add(new Option(oLink.rel, oLink.rel,true ), myselect.options[1]) //add new option to beginning of "cmbLnkContentRel"
213
					}
214
				catch(e) { //in IE, try the below version instead of add()
215
					myselect.add(new Option( oLink.rel, oLink.rel,true ),1 ) //add new option to beginning of "cmbLnkContentRel"
216
					//myselect.options[1].selected=true;
217
					}
218
			}
219
		} 
220
		GetE('txtLnkUrl').value		= sLinkUrl ;
221
		GetE('cmbLnkTarget').value	= oLink.target ;
222
		// Get Advances Attributes
223
		GetE('txtLnkTitle').value		= oLink.title ;
224
		GetE('cmbLnkContentRel').value	= oLink.rel ;
225
		GetE('txtLnkCharSet').value		= oLink.charset ;
226
		GetE('txtLnkId').value			= oLink.id ;
227
		GetE('txtLnkLangCode').value	= oLink.lang ;
228

  
229
		var sClass ;
230
		if ( oEditor.FCKBrowserInfo.IsIE )
231
		{
232
			sClass	= oLink.getAttribute('className',2) || '' ;
233
			// Clean up temporary classes for internal use:
234
			sClass = sClass.replace( FCKRegexLib.FCK_Class, '' ) ;
235
			GetE('txtLnkStyle').value	= oLink.style.cssText ;
236
		}
237
		else
238
		{
239
			sClass	= oLink.getAttribute('class',2) || '' ;
240
			GetE('txtLnkStyle').value	= oLink.getAttribute('style',2) || '' ;
241
		}
242
		GetE('txtLnkClasses').value	= sClass ;
243
	}
244
	UpdatePreview() ;
245
}
246

  
247
//#### The OK button was hit.
248
function Ok()
249
{
250
	if ( GetE('txtUrl').value.length == 0 )
251
	{
252
		dialog.SetSelectedTab( 'Info' ) ;
253
		GetE('txtUrl').focus() ;
254

  
255
		alert( FCKLang.DlgImgAlertUrl ) ;
256

  
257
		return false ;
258
	}
259

  
260
	var bHasImage = ( oImage != null ) ;
261

  
262
	if ( bHasImage && bImageButton && oImage.tagName == 'IMG' )
263
	{
264
		if ( confirm( 'Do you want to transform the selected image on a image button?' ) )
265
			oImage = null ;
266
	}
267
	else if ( bHasImage && !bImageButton && oImage.tagName == 'INPUT' )
268
	{
269
		if ( confirm( 'Do you want to transform the selected image button on a simple image?' ) )
270
			oImage = null ;
271
	}
272

  
273
	oEditor.FCKUndo.SaveUndoStep() ;
274
	if ( !bHasImage )
275
	{
276
		if ( bImageButton )
277
		{
278
			oImage = FCK.EditorDocument.createElement( 'input' ) ;
279
			oImage.type = 'image' ;
280
			oImage = FCK.InsertElement( oImage ) ;
281
		}
282
		else
283
			oImage = FCK.InsertElement( 'img' ) ;
284
	}
285

  
286
	UpdateImage( oImage ) ;
287

  
288
	var sLnkUrl = GetE('txtLnkUrl').value.Trim() ;
289
	if ( sLnkUrl.length == 0 )
290
	{
291
		if ( oLink )
292
			FCK.ExecuteNamedCommand( 'Unlink' ) ;
293
	}
294
	else
295
	{
296
		if ( oLink )	// Modifying an existent link.
297
		{
298
			oLink.href = sLnkUrl ;
299
		}
300
		else			// Creating a new link.
301
		{
302
			if ( !bHasImage )
303
				oEditor.FCKSelection.SelectNode( oImage ) ;
304

  
305
			oLink = oEditor.FCK.CreateLink( sLnkUrl )[0] ;
306

  
307
			if ( !bHasImage )
308
			{
309
				oEditor.FCKSelection.SelectNode( oLink ) ;
310
				oEditor.FCKSelection.Collapse( false ) ;
311
			}
312
		}
313

  
314
		// Target
315
		if( GetE('cmbLnkTarget').value != 'popup' )
316
			SetAttribute( oLink, 'target', GetE('cmbLnkTarget').value ) ;
317
		else
318
			SetAttribute( oLink, 'target', null ) ;
319

  
320
		SetAttribute( oLink, '_fcksavedurl', sLnkUrl ) ;
321
		// Advances Attributes
322
		SetAttribute( oLink, 'title'	, GetE('txtLnkTitle').value ) ;
323
		SetAttribute( oLink, 'rel'		, GetE('cmbLnkContentRel').value ) ;
324
		SetAttribute( oLink, 'lang'		, GetE('txtLnkLangCode').value ) ;
325
		SetAttribute( oLink, 'charset'	, GetE('txtLnkCharSet').value ) ;
326
/*
327
		alert( FCKLang.DlgImgAlertUrl ) ;
328
		SetAttribute( oLink, 'name'		, GetE('txtLnkName').value ) ;
329
		SetAttribute( oLink, 'target', GetE('cmbLnkTarget').value ) ;
330
*/
331
		if ( oEditor.FCKBrowserInfo.IsIE )
332
		{
333
			var sClass = GetE('txtLnkClasses').value ;
334
			// If it's also an anchor add an internal class
335

  
336
			if ( GetE('cmbLnkTarget').value.length != 0 )
337
				sClass += ' FCK__AnchorC' ;
338

  
339
			SetAttribute( oLink, 'className', sClass ) ;
340
			oLink.style.cssText = GetE('txtLnkStyle').value ;
341
		}
342
		else
343
		{
344
			SetAttribute( oLink, 'class', GetE('txtLnkClasses').value ) ;
345
			SetAttribute( oLink, 'style', GetE('txtLnkStyle').value ) ;
346
		}
347

  
348
	}
349

  
350
	// Select the (first) link.
351
	// oEditor.FCKSelection.SelectNode( aLinks[0] );
352

  
353
	return true ;
354
}
355

  
356
function UpdateImage( e, skipId )
357
{
358
	e.src = GetE('txtUrl').value ;
359
	SetAttribute( e, "_fcksavedurl", GetE('txtUrl').value ) ;
360
	SetAttribute( e, "alt"   , GetE('txtAlt').value ) ;
361
	SetAttribute( e, "width" , GetE('txtWidth').value ) ;
362
	SetAttribute( e, "height", GetE('txtHeight').value ) ;
363
	SetAttribute( e, "vspace", GetE('txtVSpace').value ) ;
364
	SetAttribute( e, "hspace", GetE('txtHSpace').value ) ;
365
	SetAttribute( e, "border", GetE('txtBorder').value ) ;
366
	SetAttribute( e, "align" , GetE('cmbAlign').value ) ;
367

  
368
	// Advances Attributes
369

  
370
	if ( ! skipId )
371
		SetAttribute( e, 'id', GetE('txtAttId').value ) ;
372

  
373
	SetAttribute( e, 'dir'		, GetE('cmbAttLangDir').value ) ;
374
	SetAttribute( e, 'lang'		, GetE('txtAttLangCode').value ) ;
375
	SetAttribute( e, 'title'	, GetE('txtAttTitle').value ) ;
376
	SetAttribute( e, 'longDesc'	, GetE('txtLongDesc').value ) ;
377

  
378
	if ( oEditor.FCKBrowserInfo.IsIE )
379
	{
380
		e.className = GetE('txtAttClasses').value ;
381
		e.style.cssText = GetE('txtAttStyle').value ;
382
	}
383
	else
384
	{
385
		SetAttribute( e, 'class'	, GetE('txtAttClasses').value ) ;
386
		SetAttribute( e, 'style', GetE('txtAttStyle').value ) ;
387
	}
388
}
389

  
390
var eImgPreview ;
391
var eImgPreviewLink ;
392

  
393
function SetPreviewElements( imageElement, linkElement )
394
{
395
	eImgPreview = imageElement ;
396
	eImgPreviewLink = linkElement ;
397

  
398
	UpdatePreview() ;
399
	UpdateOriginal() ;
400

  
401
	bPreviewInitialized = true ;
402
}
403

  
404
function UpdatePreview()
405
{
406
	if ( !eImgPreview || !eImgPreviewLink )
407
		return ;
408

  
409
	if ( GetE('txtUrl').value.length == 0 )
410
		eImgPreviewLink.style.display = 'none' ;
411
	else
412
	{
413
		UpdateImage( eImgPreview, true ) ;
414

  
415
		if ( GetE('txtLnkUrl').value.Trim().length > 0 )
416
			eImgPreviewLink.href = 'javascript:void(null);' ;
417
		else
418
			SetAttribute( eImgPreviewLink, 'href', '' ) ;
419

  
420
		eImgPreviewLink.style.display = '' ;
421
	}
422
}
423

  
424
var bLockRatio = true ;
425

  
426
function SwitchLock( lockButton )
427
{
428
	bLockRatio = !bLockRatio ;
429
	lockButton.className = bLockRatio ? 'BtnLocked' : 'BtnUnlocked' ;
430
	lockButton.title = bLockRatio ? 'Lock sizes' : 'Unlock sizes' ;
431

  
432
	if ( bLockRatio )
433
	{
434
		if ( GetE('txtWidth').value.length > 0 )
435
			OnSizeChanged( 'Width', GetE('txtWidth').value ) ;
436
		else
437
			OnSizeChanged( 'Height', GetE('txtHeight').value ) ;
438
	}
439
}
440

  
441
// Fired when the width or height input texts change
442
function OnSizeChanged( dimension, value )
443
{
444
	// Verifies if the aspect ration has to be maintained
445
	if ( oImageOriginal && bLockRatio )
446
	{
447
		var e = dimension == 'Width' ? GetE('txtHeight') : GetE('txtWidth') ;
448

  
449
		if ( value.length == 0 || isNaN( value ) )
450
		{
451
			e.value = '' ;
452
			return ;
453
		}
454

  
455
		if ( dimension == 'Width' )
456
			value = value == 0 ? 0 : Math.round( oImageOriginal.height * ( value  / oImageOriginal.width ) ) ;
457
		else
458
			value = value == 0 ? 0 : Math.round( oImageOriginal.width  * ( value / oImageOriginal.height ) ) ;
459

  
460
		if ( !isNaN( value ) )
461
			e.value = value ;
462
	}
463

  
464
	UpdatePreview() ;
465
}
466

  
467
// Fired when the Reset Size button is clicked
468
function ResetSizes()
469
{
470
	if ( ! oImageOriginal ) return ;
471
	if ( oEditor.FCKBrowserInfo.IsGecko && !oImageOriginal.complete )
472
	{
473
		setTimeout( ResetSizes, 50 ) ;
474
		return ;
475
	}
476

  
477
	GetE('txtWidth').value  = oImageOriginal.width ;
478
	GetE('txtHeight').value = oImageOriginal.height ;
479

  
480
	UpdatePreview() ;
481
}
482

  
483
function BrowseServer()
484
{
485
	OpenServerBrowser(
486
		'Image',
487
		FCKConfig.ImageBrowserURL,
488
		FCKConfig.ImageBrowserWindowWidth,
489
		FCKConfig.ImageBrowserWindowHeight ) ;
490
}
491

  
492
function LnkBrowseServer()
493
{
494
	OpenServerBrowser(
495
		'Link',
496
		FCKConfig.LinkBrowserURL,
497
		FCKConfig.LinkBrowserWindowWidth,
498
		FCKConfig.LinkBrowserWindowHeight ) ;
499
}
500

  
501
function OpenServerBrowser( type, url, width, height )
502
{
503
	sActualBrowser = type ;
504
	OpenFileBrowser( url, width, height ) ;
505
}
506

  
507
var sActualBrowser ;
508

  
509
function SetUrl( url, width, height, alt )
510
{
511
	if ( sActualBrowser == 'Link' )
512
	{
513
		GetE('txtLnkUrl').value = url ;
514
		UpdatePreview() ;
515
	}
516
	else
517
	{
518
		GetE('txtUrl').value = url ;
519
		GetE('txtWidth').value = width ? width : '' ;
520
		GetE('txtHeight').value = height ? height : '' ;
521

  
522
		if ( alt )
523
			GetE('txtAlt').value = alt;
524

  
525
		UpdatePreview() ;
526
		UpdateOriginal( true ) ;
527
	}
528

  
529
	dialog.SetSelectedTab( 'Info' ) ;
530
}
531

  
532
function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
533
{
534
	// Remove animation
535
	window.parent.Throbber.Hide() ;
536
	GetE( 'divUpload' ).style.display  = '' ;
537

  
538
	switch ( errorNumber )
539
	{
540
		case 0 :	// No errors
541
			alert( 'Your file has been successfully uploaded' ) ;
542
			break ;
543
		case 1 :	// Custom error
544
			alert( customMsg ) ;
545
			return ;
546
		case 101 :	// Custom warning
547
			alert( customMsg ) ;
548
			break ;
549
		case 201 :
550
			alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ;
551
			break ;
552
		case 202 :
553
			alert( 'Invalid file type' ) ;
554
			return ;
555
		case 203 :
556
			alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ;
557
			return ;
558
		case 500 :
559
			alert( 'The connector is disabled' ) ;
560
			break ;
561
		default :
562
			alert( 'Error on file upload. Error number: ' + errorNumber ) ;
563
			return ;
564
	}
565

  
566
	sActualBrowser = '' ;
567
	SetUrl( fileUrl ) ;
568
	GetE('frmUpload').reset() ;
569
}
570

  
571
var oUploadAllowedExtRegex	= new RegExp( FCKConfig.ImageUploadAllowedExtensions, 'i' ) ;
572
var oUploadDeniedExtRegex	= new RegExp( FCKConfig.ImageUploadDeniedExtensions, 'i' ) ;
573

  
574
function CheckUpload()
575
{
576
	var sFile = GetE('txtUploadFile').value ;
577

  
578
	if ( sFile.length == 0 )
579
	{
580
		alert( 'Please select a file to upload' ) ;
581
		return false ;
582
	}
583

  
584
	if ( ( FCKConfig.ImageUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) ||
585
		( FCKConfig.ImageUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) )
586
	{
587
		OnUploadCompleted( 202 ) ;
588
		return false ;
589
	}
590

  
591
	// Show animation
592
	window.parent.Throbber.Show( 100 ) ;
593
	GetE( 'divUpload' ).style.display  = 'none' ;
594

  
595
	return true ;
596
}
branches/2.8.x/wb/modules/fckeditor/fckeditor/editor/dialog/fck_image.html
170 170
		</form>
171 171
	</div>
172 172
	<div id="divLink" style="display: none">
173
		<table cellspacing="1" cellpadding="1" border="0" width="100%">
173
		<table summary="" cellspacing="1" cellpadding="1" border="0" width="100%">
174 174
			<tr>
175 175
				<td style="width: 100%" colspan="2">
176 176
					<div valign="middle">
branches/2.8.x/wb/modules/fckeditor/fckeditor/editor/js/fckeditorcode_ie.js
35 35
var FCKDebug={Output:function(){},OutputObject:function(){}};
36 36
var FCKDomTools={MoveChildren:function(A,B,C){if (A==B) return;var D;if (C){while ((D=A.lastChild)) B.insertBefore(A.removeChild(D),B.firstChild);}else{while ((D=A.firstChild)) B.appendChild(A.removeChild(D));}},MoveNode:function(A,B,C){if (C) B.insertBefore(FCKDomTools.RemoveNode(A),B.firstChild);else B.appendChild(FCKDomTools.RemoveNode(A));},TrimNode:function(A){this.LTrimNode(A);this.RTrimNode(A);},LTrimNode:function(A){var B;while ((B=A.firstChild)){if (B.nodeType==3){var C=B.nodeValue.LTrim();var D=B.nodeValue.length;if (C.length==0){A.removeChild(B);continue;}else if (C.length<D){B.splitText(D-C.length);A.removeChild(A.firstChild);}};break;}},RTrimNode:function(A){var B;while ((B=A.lastChild)){if (B.nodeType==3){var C=B.nodeValue.RTrim();var D=B.nodeValue.length;if (C.length==0){B.parentNode.removeChild(B);continue;}else if (C.length<D){B.splitText(C.length);A.lastChild.parentNode.removeChild(A.lastChild);}};break;};if (!FCKBrowserInfo.IsIE&&!FCKBrowserInfo.IsOpera){B=A.lastChild;if (B&&B.nodeType==1&&B.nodeName.toLowerCase()=='br'){B.parentNode.removeChild(B);}}},RemoveNode:function(A,B){if (B){var C;while ((C=A.firstChild)) A.parentNode.insertBefore(A.removeChild(C),A);};return A.parentNode.removeChild(A);},GetFirstChild:function(A,B){if (typeof (B)=='string') B=[B];var C=A.firstChild;while(C){if (C.nodeType==1&&C.tagName.Equals.apply(C.tagName,B)) return C;C=C.nextSibling;};return null;},GetLastChild:function(A,B){if (typeof (B)=='string') B=[B];var C=A.lastChild;while(C){if (C.nodeType==1&&(!B||C.tagName.Equals(B))) return C;C=C.previousSibling;};return null;},GetPreviousSourceElement:function(A,B,C,D){if (!A) return null;if (C&&A.nodeType==1&&A.nodeName.IEquals(C)) return null;if (A.previousSibling) A=A.previousSibling;else return this.GetPreviousSourceElement(A.parentNode,B,C,D);while (A){if (A.nodeType==1){if (C&&A.nodeName.IEquals(C)) break;if (!D||!A.nodeName.IEquals(D)) return A;}else if (B&&A.nodeType==3&&A.nodeValue.RTrim().length>0) break;if (A.lastChild) A=A.lastChild;else return this.GetPreviousSourceElement(A,B,C,D);};return null;},GetNextSourceElement:function(A,B,C,D,E){while((A=this.GetNextSourceNode(A,E))){if (A.nodeType==1){if (C&&A.nodeName.IEquals(C)) break;if (D&&A.nodeName.IEquals(D)) return this.GetNextSourceElement(A,B,C,D);return A;}else if (B&&A.nodeType==3&&A.nodeValue.RTrim().length>0) break;};return null;},GetNextSourceNode:function(A,B,C,D){if (!A) return null;var E;if (!B&&A.firstChild) E=A.firstChild;else{if (D&&A==D) return null;E=A.nextSibling;if (!E&&(!D||D!=A.parentNode)) return this.GetNextSourceNode(A.parentNode,true,C,D);};if (C&&E&&E.nodeType!=C) return this.GetNextSourceNode(E,false,C,D);return E;},GetPreviousSourceNode:function(A,B,C,D){if (!A) return null;var E;if (!B&&A.lastChild) E=A.lastChild;else{if (D&&A==D) return null;E=A.previousSibling;if (!E&&(!D||D!=A.parentNode)) return this.GetPreviousSourceNode(A.parentNode,true,C,D);};if (C&&E&&E.nodeType!=C) return this.GetPreviousSourceNode(E,false,C,D);return E;},InsertAfterNode:function(A,B){return A.parentNode.insertBefore(B,A.nextSibling);},GetParents:function(A){var B=[];while (A){B.unshift(A);A=A.parentNode;};return B;},GetCommonParents:function(A,B){var C=this.GetParents(A);var D=this.GetParents(B);var E=[];for (var i=0;i<C.length;i++){if (C[i]==D[i]) E.push(C[i]);};return E;},GetCommonParentNode:function(A,B,C){var D={};if (!C.pop) C=[C];while (C.length>0) D[C.pop().toLowerCase()]=1;var E=this.GetCommonParents(A,B);var F=null;while ((F=E.pop())){if (D[F.nodeName.toLowerCase()]) return F;};return null;},GetIndexOf:function(A){var B=A.parentNode?A.parentNode.firstChild:null;var C=-1;while (B){C++;if (B==A) return C;B=B.nextSibling;};return-1;},PaddingNode:null,EnforcePaddingNode:function(A,B){try{if (!A||!A.body) return;}catch (e){return;};this.CheckAndRemovePaddingNode(A,B,true);try{if (A.body.lastChild&&(A.body.lastChild.nodeType!=1||A.body.lastChild.tagName.toLowerCase()==B.toLowerCase())) return;}catch (e){return;};var C=A.createElement(B);if (FCKBrowserInfo.IsGecko&&FCKListsLib.NonEmptyBlockElements[B]) FCKTools.AppendBogusBr(C);this.PaddingNode=C;if (A.body.childNodes.length==1&&A.body.firstChild.nodeType==1&&A.body.firstChild.tagName.toLowerCase()=='br'&&(A.body.firstChild.getAttribute('_moz_dirty')!=null||A.body.firstChild.getAttribute('type')=='_moz')) A.body.replaceChild(C,A.body.firstChild);else A.body.appendChild(C);},CheckAndRemovePaddingNode:function(A,B,C){var D=this.PaddingNode;if (!D) return;try{if (D.parentNode!=A.body||D.tagName.toLowerCase()!=B||(D.childNodes.length>1)||(D.firstChild&&D.firstChild.nodeValue!='\xa0'&&String(D.firstChild.tagName).toLowerCase()!='br')){this.PaddingNode=null;return;}}catch (e){this.PaddingNode=null;return;};if (!C){if (D.parentNode.childNodes.length>1) D.parentNode.removeChild(D);this.PaddingNode=null;}},HasAttribute:function(A,B){if (A.hasAttribute) return A.hasAttribute(B);else{var C=A.attributes[B];return (C!=undefined&&C.specified);}},HasAttributes:function(A){var B=A.attributes;for (var i=0;i<B.length;i++){if (FCKBrowserInfo.IsIE){var C=B[i].nodeName;if (C.StartsWith('_fck')){continue;};if (C=='class'){if (A.className.length>0) return true;continue;}};if (B[i].specified) return true;};return false;},RemoveAttribute:function(A,B){if (FCKBrowserInfo.IsIE&&B.toLowerCase()=='class') B='className';return A.removeAttribute(B,0);},RemoveAttributes:function (A,B){for (var i=0;i<B.length;i++) this.RemoveAttribute(A,B[i]);},GetAttributeValue:function(A,B){var C=B;if (typeof B=='string') B=A.attributes[B];else C=B.nodeName;if (B&&B.specified){if (C=='style') return A.style.cssText;else if (C=='class'||C.indexOf('on')==0) return B.nodeValue;else{return A.getAttribute(C,2);}};return null;},Contains:function(A,B){if (A.contains&&B.nodeType==1) return A.contains(B);while ((B=B.parentNode)){if (B==A) return true;};return false;},BreakParent:function(A,B,C){var D=C||new FCKDomRange(FCKTools.GetElementWindow(A));D.SetStart(A,4);D.SetEnd(B,4);var E=D.ExtractContents();D.InsertNode(A.parentNode.removeChild(A));E.InsertAfterNode(A);D.Release(!!C);},GetNodeAddress:function(A,B){var C=[];while (A&&A!=FCKTools.GetElementDocument(A).documentElement){var D=A.parentNode;var E=-1;for(var i=0;i<D.childNodes.length;i++){var F=D.childNodes[i];if (B===true&&F.nodeType==3&&F.previousSibling&&F.previousSibling.nodeType==3) continue;E++;if (D.childNodes[i]==A) break;};C.unshift(E);A=A.parentNode;};return C;},GetNodeFromAddress:function(A,B,C){var D=A.documentElement;for (var i=0;i<B.length;i++){var E=B[i];if (!C){D=D.childNodes[E];continue;};var F=-1;for (var j=0;j<D.childNodes.length;j++){var G=D.childNodes[j];if (C===true&&G.nodeType==3&&G.previousSibling&&G.previousSibling.nodeType==3) continue;F++;if (F==E){D=G;break;}}};return D;},CloneElement:function(A){A=A.cloneNode(false);A.removeAttribute('id',false);return A;},ClearElementJSProperty:function(A,B){if (FCKBrowserInfo.IsIE) A.removeAttribute(B);else delete A[B];},SetElementMarker:function (A,B,C,D){var E=String(parseInt(Math.random()*0xffffffff,10));B._FCKMarkerId=E;B[C]=D;if (!A[E]) A[E]={ 'element':B,'markers':{} };A[E]['markers'][C]=D;},ClearElementMarkers:function(A,B,C){var D=B._FCKMarkerId;if (!D) return;this.ClearElementJSProperty(B,'_FCKMarkerId');for (var j in A[D]['markers']) this.ClearElementJSProperty(B,j);if (C) delete A[D];},ClearAllMarkers:function(A){for (var i in A) this.ClearElementMarkers(A,A[i]['element'],true);},ListToArray:function(A,B,C,D,E){if (!A.nodeName.IEquals(['ul','ol'])) return [];if (!D) D=0;if (!C) C=[];for (var i=0;i<A.childNodes.length;i++){var F=A.childNodes[i];if (!F.nodeName.IEquals('li')) continue;var G={ 'parent':A,'indent':D,'contents':[] };if (!E){G.grandparent=A.parentNode;if (G.grandparent&&G.grandparent.nodeName.IEquals('li')) G.grandparent=G.grandparent.parentNode;}else G.grandparent=E;if (B) this.SetElementMarker(B,F,'_FCK_ListArray_Index',C.length);C.push(G);for (var j=0;j<F.childNodes.length;j++){var H=F.childNodes[j];if (H.nodeName.IEquals(['ul','ol'])) this.ListToArray(H,B,C,D+1,G.grandparent);else G.contents.push(H);}};return C;},ArrayToList:function(A,B,C){if (C==undefined) C=0;if (!A||A.length<C+1) return null;var D=FCKTools.GetElementDocument(A[C].parent);var E=D.createDocumentFragment();var F=null;var G=C;var H=Math.max(A[C].indent,0);var I=null;while (true){var J=A[G];if (J.indent==H){if (!F||A[G].parent.nodeName!=F.nodeName){F=A[G].parent.cloneNode(false);E.appendChild(F);};I=D.createElement('li');F.appendChild(I);for (var i=0;i<J.contents.length;i++) I.appendChild(J.contents[i].cloneNode(true));G++;}else if (J.indent==Math.max(H,0)+1){var K=this.ArrayToList(A,null,G);I.appendChild(K.listNode);G=K.nextIndex;}else if (J.indent==-1&&C==0&&J.grandparent){var I;if (J.grandparent.nodeName.IEquals(['ul','ol'])) I=D.createElement('li');else{if (FCKConfig.EnterMode.IEquals(['div','p'])&&!J.grandparent.nodeName.IEquals('td')) I=D.createElement(FCKConfig.EnterMode);else I=D.createDocumentFragment();};for (var i=0;i<J.contents.length;i++) I.appendChild(J.contents[i].cloneNode(true));if (I.nodeType==11){if (I.lastChild&&I.lastChild.getAttribute&&I.lastChild.getAttribute('type')=='_moz') I.removeChild(I.lastChild);I.appendChild(D.createElement('br'));};if (I.nodeName.IEquals(FCKConfig.EnterMode)&&I.firstChild){this.TrimNode(I);if (FCKListsLib.BlockBoundaries[I.firstChild.nodeName.toLowerCase()]){var M=D.createDocumentFragment();while (I.firstChild) M.appendChild(I.removeChild(I.firstChild));I=M;}};if (FCKBrowserInfo.IsGeckoLike&&I.nodeName.IEquals(['div','p'])) FCKTools.AppendBogusBr(I);E.appendChild(I);F=null;G++;}else return null;if (A.length<=G||Math.max(A[G].indent,0)<H){break;}};if (B){var N=E.firstChild;while (N){if (N.nodeType==1) this.ClearElementMarkers(B,N);N=this.GetNextSourceNode(N);}};return { 'listNode':E,'nextIndex':G };},GetNextSibling:function(A,B){A=A.nextSibling;while (A&&!B&&A.nodeType!=1&&(A.nodeType!=3||A.nodeValue.length==0)) A=A.nextSibling;return A;},GetPreviousSibling:function(A,B){A=A.previousSibling;while (A&&!B&&A.nodeType!=1&&(A.nodeType!=3||A.nodeValue.length==0)) A=A.previousSibling;return A;},CheckIsEmptyElement:function(A,B){var C=A.firstChild;var D;while (C){if (C.nodeType==1){if (D||!FCKListsLib.InlineNonEmptyElements[C.nodeName.toLowerCase()]) return false;if (!B||B(C)===true) D=C;}else if (C.nodeType==3&&C.nodeValue.length>0) return false;C=C.nextSibling;};return D?this.CheckIsEmptyElement(D,B):true;},SetElementStyles:function(A,B){var C=A.style;for (var D in B) C[D]=B[D];},SetOpacity:function(A,B){if (FCKBrowserInfo.IsIE){B=Math.round(B*100);A.style.filter=(B>100?'':'progid:DXImageTransform.Microsoft.Alpha(opacity='+B+')');}else A.style.opacity=B;},GetCurrentElementStyle:function(A,B){if (FCKBrowserInfo.IsIE) return A.currentStyle[B];else return A.ownerDocument.defaultView.getComputedStyle(A,'').getPropertyValue(B);},GetPositionedAncestor:function(A){var B=A;while (B!=FCKTools.GetElementDocument(B).documentElement){if (this.GetCurrentElementStyle(B,'position')!='static') return B;if (B==FCKTools.GetElementDocument(B).documentElement&&currentWindow!=w) B=currentWindow.frameElement;else B=B.parentNode;};return null;},ScrollIntoView:function(A,B){var C=FCKTools.GetElementWindow(A);var D=FCKTools.GetViewPaneSize(C).Height;var E=D*-1;if (B===false){E+=A.offsetHeight||0;E+=parseInt(this.GetCurrentElementStyle(A,'marginBottom')||0,10)||0;};var F=FCKTools.GetDocumentPosition(C,A);E+=F.y;var G=FCKTools.GetScrollPosition(C).Y;if (E>0&&(E>G||E<G-D)) C.scrollTo(0,E);},CheckIsEditable:function(A){var B=A.nodeName.toLowerCase();var C=FCK.DTD[B]||FCK.DTD.span;return (C['#']&&!FCKListsLib.NonEditableElements[B]);},GetSelectedDivContainers:function(){var A=[];var B=new FCKDomRange(FCK.EditorWindow);B.MoveToSelection();var C=B.GetTouchedStartNode();var D=B.GetTouchedEndNode();var E=C;if (C==D){while (D.nodeType==1&&D.lastChild) D=D.lastChild;D=FCKDomTools.GetNextSourceNode(D);}while (E&&E!=D){if (E.nodeType!=3||!/^[ \t\n]*$/.test(E.nodeValue)){var F=new FCKElementPath(E);var G=F.BlockLimit;if (G&&G.nodeName.IEquals('div')&&A.IndexOf(G)==-1) A.push(G);};E=FCKDomTools.GetNextSourceNode(E);};return A;}};
37 37
var FCKTools={};FCKTools.CreateBogusBR=function(A){var B=A.createElement('br');B.setAttribute('type','_moz');return B;};FCKTools.FixCssUrls=function(A,B){if (!A||A.length==0) return B;return B.replace(/url\s*\(([\s'"]*)(.*?)([\s"']*)\)/g,function(C,D,E,F){if (/^\/|^\w?:/.test(E)) return C;else return 'url('+D+A+E+F+')';});};FCKTools._GetUrlFixedCss=function(A,B){var C=A.match(/^([^|]+)\|([\s\S]*)/);if (C) return FCKTools.FixCssUrls(C[1],C[2]);else return A;};FCKTools.AppendStyleSheet=function(A,B){if (!B) return [];if (typeof(B)=='string'){if (/[\\\/\.][^{}]*$/.test(B)){return this.AppendStyleSheet(A,B.split(','));}else return [this.AppendStyleString(A,FCKTools._GetUrlFixedCss(B))];}else{var C=[];for (var i=0;i<B.length;i++) C.push(this._AppendStyleSheet(A,B[i]));return C;}};FCKTools.GetStyleHtml=(function(){var A=function(D,E){if (D.length==0) return '';var F=E?' _fcktemp="true"':'';return '<style type="text/css"'+F+'>'+D+'</style>';};var B=function(G,H){if (G.length==0) return '';var I=H?' _fcktemp="true"':'';return '<link href="'+G+'" type="text/css" rel="stylesheet" '+I+'/>';};return function(J,K){if (!J) return '';if (typeof(J)=='string'){if (/[\\\/\.][^{}]*$/.test(J)){return this.GetStyleHtml(J.split(','),K);}else return A(this._GetUrlFixedCss(J),K);}else{var C='';for (var i=0;i<J.length;i++) C+=B(J[i],K);return C;}}})();FCKTools.GetElementDocument=function (A){return A.ownerDocument||A.document;};FCKTools.GetElementWindow=function(A){return this.GetDocumentWindow(this.GetElementDocument(A));};FCKTools.GetDocumentWindow=function(A){if (FCKBrowserInfo.IsSafari&&!A.parentWindow) this.FixDocumentParentWindow(window.top);return A.parentWindow||A.defaultView;};FCKTools.FixDocumentParentWindow=function(A){if (A.document) A.document.parentWindow=A;for (var i=0;i<A.frames.length;i++) FCKTools.FixDocumentParentWindow(A.frames[i]);};FCKTools.HTMLEncode=function(A){if (!A) return '';A=A.replace(/&/g,'&amp;');A=A.replace(/</g,'&lt;');A=A.replace(/>/g,'&gt;');return A;};FCKTools.HTMLDecode=function(A){if (!A) return '';A=A.replace(/&gt;/g,'>');A=A.replace(/&lt;/g,'<');A=A.replace(/&amp;/g,'&');return A;};FCKTools._ProcessLineBreaksForPMode=function(A,B,C,D,E){var F=0;var G="<p>";var H="</p>";var I="<br />";if (C){G="<li>";H="</li>";F=1;}while (D&&D!=A.FCK.EditorDocument.body){if (D.tagName.toLowerCase()=='p'){F=1;break;};D=D.parentNode;};for (var i=0;i<B.length;i++){var c=B.charAt(i);if (c=='\r') continue;if (c!='\n'){E.push(c);continue;};var n=B.charAt(i+1);if (n=='\r'){i++;n=B.charAt(i+1);};if (n=='\n'){i++;if (F) E.push(H);E.push(G);F=1;}else E.push(I);}};FCKTools._ProcessLineBreaksForDivMode=function(A,B,C,D,E){var F=0;var G="<div>";var H="</div>";if (C){G="<li>";H="</li>";F=1;}while (D&&D!=A.FCK.EditorDocument.body){if (D.tagName.toLowerCase()=='div'){F=1;break;};D=D.parentNode;};for (var i=0;i<B.length;i++){var c=B.charAt(i);if (c=='\r') continue;if (c!='\n'){E.push(c);continue;};if (F){if (E[E.length-1]==G){E.push("&nbsp;");};E.push(H);};E.push(G);F=1;};if (F) E.push(H);};FCKTools._ProcessLineBreaksForBrMode=function(A,B,C,D,E){var F=0;var G="<br />";var H="";if (C){G="<li>";H="</li>";F=1;};for (var i=0;i<B.length;i++){var c=B.charAt(i);if (c=='\r') continue;if (c!='\n'){E.push(c);continue;};if (F&&H.length) E.push (H);E.push(G);F=1;}};FCKTools.ProcessLineBreaks=function(A,B,C){var D=B.EnterMode.toLowerCase();var E=[];var F=0;var G=new A.FCKDomRange(A.FCK.EditorWindow);G.MoveToSelection();var H=G._Range.startContainer;while (H&&H.nodeType!=1) H=H.parentNode;if (H&&H.tagName.toLowerCase()=='li') F=1;if (D=='p') this._ProcessLineBreaksForPMode(A,C,F,H,E);else if (D=='div') this._ProcessLineBreaksForDivMode(A,C,F,H,E);else if (D=='br') this._ProcessLineBreaksForBrMode(A,C,F,H,E);return E.join("");};FCKTools.AddSelectOption=function(A,B,C){var D=FCKTools.GetElementDocument(A).createElement("OPTION");D.text=B;D.value=C;A.options.add(D);return D;};FCKTools.RunFunction=function(A,B,C,D){if (A) this.SetTimeout(A,0,B,C,D);};FCKTools.SetTimeout=function(A,B,C,D,E){return (E||window).setTimeout(function(){if (D) A.apply(C,[].concat(D));else A.apply(C);},B);};FCKTools.SetInterval=function(A,B,C,D,E){return (E||window).setInterval(function(){A.apply(C,D||[]);},B);};FCKTools.ConvertStyleSizeToHtml=function(A){return A.EndsWith('%')?A:parseInt(A,10);};FCKTools.ConvertHtmlSizeToStyle=function(A){return A.EndsWith('%')?A:(A+'px');};FCKTools.GetElementAscensor=function(A,B){var e=A;var C=","+B.toUpperCase()+",";while (e){if (C.indexOf(","+e.nodeName.toUpperCase()+",")!=-1) return e;e=e.parentNode;};return null;};FCKTools.CreateEventListener=function(A,B){var f=function(){var C=[];for (var i=0;i<arguments.length;i++) C.push(arguments[i]);A.apply(this,C.concat(B));};return f;};FCKTools.IsStrictMode=function(A){return ('CSS1Compat'==(A.compatMode||(FCKBrowserInfo.IsSafari?'CSS1Compat':null)));};FCKTools.ArgumentsToArray=function(A,B,C){B=B||0;C=C||A.length;var D=[];for (var i=B;i<B+C&&i<A.length;i++) D.push(A[i]);return D;};FCKTools.CloneObject=function(A){var B=function() {};B.prototype=A;return new B;};FCKTools.AppendBogusBr=function(A){if (!A) return;var B=this.GetLastItem(A.getElementsByTagName('br'));if (!B||(B.getAttribute('type',2)!='_moz'&&B.getAttribute('_moz_dirty')==null)){var C=this.GetElementDocument(A);if (FCKBrowserInfo.IsOpera) A.appendChild(C.createTextNode(''));else A.appendChild(this.CreateBogusBR(C));}};FCKTools.GetLastItem=function(A){if (A.length>0) return A[A.length-1];return null;};FCKTools.GetDocumentPosition=function(w,A){var x=0;var y=0;var B=A;var C=null;var D=FCKTools.GetElementWindow(B);while (B&&!(D==w&&(B==w.document.body||B==w.document.documentElement))){x+=B.offsetLeft-B.scrollLeft;y+=B.offsetTop-B.scrollTop;if (!FCKBrowserInfo.IsOpera){var E=C;while (E&&E!=B){x-=E.scrollLeft;y-=E.scrollTop;E=E.parentNode;}};C=B;if (B.offsetParent) B=B.offsetParent;else{if (D!=w){B=D.frameElement;C=null;if (B) D=B.contentWindow.parent;}else B=null;}};if (FCKDomTools.GetCurrentElementStyle(w.document.body,'position')!='static'||(FCKBrowserInfo.IsIE&&FCKDomTools.GetPositionedAncestor(A)==null)){x+=w.document.body.offsetLeft;y+=w.document.body.offsetTop;};return { "x":x,"y":y };};FCKTools.GetWindowPosition=function(w,A){var B=this.GetDocumentPosition(w,A);var C=FCKTools.GetScrollPosition(w);B.x-=C.X;B.y-=C.Y;return B;};FCKTools.ProtectFormStyles=function(A){if (!A||A.nodeType!=1||A.tagName.toLowerCase()!='form') return [];var B=[];var C=['style','className'];for (var i=0;i<C.length;i++){var D=C[i];if (A.elements.namedItem(D)){var E=A.elements.namedItem(D);B.push([E,E.nextSibling]);A.removeChild(E);}};return B;};FCKTools.RestoreFormStyles=function(A,B){if (!A||A.nodeType!=1||A.tagName.toLowerCase()!='form') return;if (B.length>0){for (var i=B.length-1;i>=0;i--){var C=B[i][0];var D=B[i][1];if (D) A.insertBefore(C,D);else A.appendChild(C);}}};FCKTools.GetNextNode=function(A,B){if (A.firstChild) return A.firstChild;else if (A.nextSibling) return A.nextSibling;else{var C=A.parentNode;while (C){if (C==B) return null;if (C.nextSibling) return C.nextSibling;else C=C.parentNode;}};return null;};FCKTools.GetNextTextNode=function(A,B,C){node=this.GetNextNode(A,B);if (C&&node&&C(node)) return null;while (node&&node.nodeType!=3){node=this.GetNextNode(node,B);if (C&&node&&C(node)) return null;};return node;};FCKTools.Merge=function(){var A=arguments;var o=A[0];for (var i=1;i<A.length;i++){var B=A[i];for (var p in B) o[p]=B[p];};return o;};FCKTools.IsArray=function(A){return (A instanceof Array);};FCKTools.AppendLengthProperty=function(A,B){var C=0;for (var n in A) C++;return A[B||'length']=C;};FCKTools.NormalizeCssText=function(A){var B=document.createElement('span');B.style.cssText=A;return B.style.cssText;};FCKTools.Bind=function(A,B){return function(){ return B.apply(A,arguments);};};FCKTools.GetVoidUrl=function(){if (FCK_IS_CUSTOM_DOMAIN) return "javascript: void( function(){document.open();document.write('<html><head><title></title></head><body></body></html>');document.domain = '"+FCK_RUNTIME_DOMAIN+"';document.close();}() ) ;";if (FCKBrowserInfo.IsIE){if (FCKBrowserInfo.IsIE7||!FCKBrowserInfo.IsIE6) return "";else return "javascript: '';";};return "javascript: void(0);";};FCKTools.ResetStyles=function(A){A.style.cssText='margin:0;padding:0;border:0;background-color:transparent;background-image:none;';};
38
FCKTools.CancelEvent=function(e){return false;};FCKTools._AppendStyleSheet=function(A,B){return A.createStyleSheet(B).owningElement;};FCKTools.AppendStyleString=function(A,B){if (!B) return null;var s=A.createStyleSheet("");s.cssText=B;return s;};FCKTools.ClearElementAttributes=function(A){A.clearAttributes();};FCKTools.GetAllChildrenIds=function(A){var B=[];for (var i=0;i<A.all.length;i++){var C=A.all[i].id;if (C&&C.length>0) B[B.length]=C;};return B;};FCKTools.RemoveOuterTags=function(e){e.insertAdjacentHTML('beforeBegin',e.innerHTML);e.parentNode.removeChild(e);};FCKTools.CreateXmlObject=function(A){var B;switch (A){case 'XmlHttp':if (document.location.protocol!='file:') try { return new XMLHttpRequest();} catch (e) {};B=['MSXML2.XmlHttp','Microsoft.XmlHttp'];break;case 'DOMDocument':B=['MSXML2.DOMDocument','Microsoft.XmlDom'];break;};for (var i=0;i<2;i++){try { return new ActiveXObject(B[i]);}catch (e){}};if (FCKLang.NoActiveX){alert(FCKLang.NoActiveX);FCKLang.NoActiveX=null;};return null;};FCKTools.DisableSelection=function(A){A.unselectable='on';var e,i=0;while ((e=A.all[i++])){switch (e.tagName){case 'IFRAME':case 'TEXTAREA':case 'INPUT':case 'SELECT':break;default:e.unselectable='on';}}};FCKTools.GetScrollPosition=function(A){var B=A.document;var C={ X:B.documentElement.scrollLeft,Y:B.documentElement.scrollTop };if (C.X>0||C.Y>0) return C;return { X:B.body.scrollLeft,Y:B.body.scrollTop };};FCKTools.AddEventListener=function(A,B,C){A.attachEvent('on'+B,C);};FCKTools.RemoveEventListener=function(A,B,C){A.detachEvent('on'+B,C);};FCKTools.AddEventListenerEx=function(A,B,C,D){var o={};o.Source=A;o.Params=D||[];o.Listener=function(E){return C.apply(o.Source,[E].concat(o.Params));};if (FCK.IECleanup) FCK.IECleanup.AddItem(null,function() { o.Source=null;o.Params=null;});A.attachEvent('on'+B,o.Listener);A=null;D=null;};FCKTools.GetViewPaneSize=function(A){var B;var C=A.document.documentElement;if (C&&C.clientWidth) B=C;else B=A.document.body;if (B) return { Width:B.clientWidth,Height:B.clientHeight };else return { Width:0,Height:0 };};FCKTools.SaveStyles=function(A){var B=FCKTools.ProtectFormStyles(A);var C={};if (A.className.length>0){C.Class=A.className;A.className='';};var D=A.style.cssText;if (D.length>0){C.Inline=D;A.style.cssText='';};FCKTools.RestoreFormStyles(A,B);return C;};FCKTools.RestoreStyles=function(A,B){var C=FCKTools.ProtectFormStyles(A);A.className=B.Class||'';A.style.cssText=B.Inline||'';FCKTools.RestoreFormStyles(A,C);};FCKTools.RegisterDollarFunction=function(A){A.$=A.document.getElementById;};FCKTools.AppendElement=function(A,B){return A.appendChild(this.GetElementDocument(A).createElement(B));};FCKTools.ToLowerCase=function(A){return A.toLowerCase();};
38
FCKTools.CancelEvent=function(e){return false;};FCKTools._AppendStyleSheet=function(A,B){return A.createStyleSheet(B).owningElement;};FCKTools.AppendStyleString=function(A,B){if (!B) return null;var s=A.createStyleSheet("");s.cssText=B;return s;};FCKTools.ClearElementAttributes=function(A){A.clearAttributes();};FCKTools.GetAllChildrenIds=function(A){var B=[];for (var i=0;i<A.all.length;i++){var C=A.all[i].id;if (C&&C.length>0) B[B.length]=C;};return B;};FCKTools.RemoveOuterTags=function(e){e.insertAdjacentHTML('beforeBegin',e.innerHTML);e.parentNode.removeChild(e);};FCKTools.CreateXmlObject=function(A){var B;switch (A){case 'XmlHttp':if (document.location.protocol!='file:') try { return new XMLHttpRequest();} catch (e) {};B=['MSXML2.XmlHttp','Microsoft.XmlHttp'];break;case 'DOMDocument':B=['MSXML2.DOMDocument','Microsoft.XmlDom'];break;};for (var i=0;i<2;i++){try { return new ActiveXObject(B[i]);}catch (e){}};if (FCKLang.NoActiveX){alert(FCKLang.NoActiveX);FCKLang.NoActiveX=null;};return null;};FCKTools.DisableSelection=function(A){A.unselectable='on';var e,i=0;while ((e=A.all[i++])){switch (e.tagName){case 'IFRAME':case 'TEXTAREA':case 'INPUT':case 'SELECT':break;default:e.unselectable='on';}}};FCKTools.GetScrollPosition=function(A){var B=A.document;var C={ X:B.documentElement.scrollLeft,Y:B.documentElement.scrollTop };if (C.X>0||C.Y>0) return C;return { X:B.body.scrollLeft,Y:B.body.scrollTop };};FCKTools.AddEventListener=function(A,B,C){A.attachEvent('on'+B,C);};FCKTools.RemoveEventListener=function(A,B,C){A.detachEvent('on'+B,C);};FCKTools.AddEventListenerEx=function(A,B,C,D){var o={};o.Source=A;o.Params=D||[];o.Listener=function(E){return C.apply(o.Source,[E].concat(o.Params));};if (FCK.IECleanup) FCK.IECleanup.AddItem(null,function() { o.Source=null;o.Params=null;});A.attachEvent('on'+B,o.Listener);A=null;D=null;};FCKTools.GetViewPaneSize=function(A){var B;var C=A.document.documentElement;if (C&&C.clientWidth) B=C;else B=A.document.body;if (B) return { Width:B.clientWidth,Height:B.clientHeight };else return { Width:0,Height:0 };};FCKTools.SaveStyles=function(A){var B=FCKTools.ProtectFormStyles(A);var C={};if (A.className.length>0){C.Class=A.className;A.className='';};var D=A.style.cssText;if (D.length>0){C.Inline=D;A.style.cssText='';};FCKTools.RestoreFormStyles(A,B);return C;};FCKTools.RestoreStyles=function(A,B){var C=FCKTools.ProtectFormStyles(A);A.className=B.Class||'';A.style.cssText=B.Inline||'';FCKTools.RestoreFormStyles(A,C);};FCKTools.RegisterDollarFunction=function(A){if (FCKBrowserInfo.IsIE9) {A.$=function(B){return A.document.getElementById(B);}} else {A.$=A.document.getElementById;};};FCKTools.AppendElement=function(target,elementName){FCKTools.AppendElement=function(A,B){return A.appendChild(this.GetElementDocument(A).createElement(B));};FCKTools.ToLowerCase=function(A){return A.toLowerCase();};
39 39
var FCKeditorAPI;function InitializeAPI(){var A=window.parent;if (!(FCKeditorAPI=A.FCKeditorAPI)){var B='window.FCKeditorAPI = {Version : "[Development]",VersionBuild : "[DEV]",Instances : window.FCKeditorAPI && window.FCKeditorAPI.Instances || {},GetInstance : function( name ){return this.Instances[ name ];},_FormSubmit : function(){for ( var name in FCKeditorAPI.Instances ){var oEditor = FCKeditorAPI.Instances[ name ] ;if ( oEditor.GetParentForm && oEditor.GetParentForm() == this )oEditor.UpdateLinkedField() ;}this._FCKOriginalSubmit() ;},_FunctionQueue	: window.FCKeditorAPI && window.FCKeditorAPI._FunctionQueue || {Functions : new Array(),IsRunning : false,Add : function( f ){this.Functions.push( f );if ( !this.IsRunning )this.StartNext();},StartNext : function(){var aQueue = this.Functions ;if ( aQueue.length > 0 ){this.IsRunning = true;aQueue[0].call();}else this.IsRunning = false;},Remove : function( f ){var aQueue = this.Functions;var i = 0, fFunc;while( (fFunc = aQueue[ i ]) ){if ( fFunc == f )aQueue.splice( i,1 );i++ ;}this.StartNext();}}}';if (A.execScript) A.execScript(B,'JavaScript');else{if (FCKBrowserInfo.IsGecko10){eval.call(A,B);}else if(FCKBrowserInfo.IsAIR){FCKAdobeAIR.FCKeditorAPI_Evaluate(A,B);}else if (FCKBrowserInfo.IsSafari){var C=A.document;var D=C.createElement('script');D.appendChild(C.createTextNode(B));C.documentElement.appendChild(D);}else A.eval(B);};FCKeditorAPI=A.FCKeditorAPI;FCKeditorAPI.__Instances=FCKeditorAPI.Instances;};FCKeditorAPI.Instances[FCK.Name]=FCK;};function _AttachFormSubmitToAPI(){var A=FCK.GetParentForm();if (A){FCKTools.AddEventListener(A,'submit',FCK.UpdateLinkedField);if (!A._FCKOriginalSubmit&&(typeof(A.submit)=='function'||(!A.submit.tagName&&!A.submit.length))){A._FCKOriginalSubmit=A.submit;A.submit=FCKeditorAPI._FormSubmit;}}};function FCKeditorAPI_Cleanup(){if (window.FCKConfig&&FCKConfig.MsWebBrowserControlCompat&&!window.FCKUnloadFlag) return;delete FCKeditorAPI.Instances[FCK.Name];};function FCKeditorAPI_ConfirmCleanup(){if (window.FCKConfig&&FCKConfig.MsWebBrowserControlCompat) window.FCKUnloadFlag=true;};FCKTools.AddEventListener(window,'unload',FCKeditorAPI_Cleanup);FCKTools.AddEventListener(window,'beforeunload',FCKeditorAPI_ConfirmCleanup);
40 40
var FCKImagePreloader=function(){this._Images=[];};FCKImagePreloader.prototype={AddImages:function(A){if (typeof(A)=='string') A=A.split(';');this._Images=this._Images.concat(A);},Start:function(){var A=this._Images;this._PreloadCount=A.length;for (var i=0;i<A.length;i++){var B=document.createElement('img');FCKTools.AddEventListenerEx(B,'load',_FCKImagePreloader_OnImage,this);FCKTools.AddEventListenerEx(B,'error',_FCKImagePreloader_OnImage,this);B.src=A[i];_FCKImagePreloader_ImageCache.push(B);}}};var _FCKImagePreloader_ImageCache=[];function _FCKImagePreloader_OnImage(A,B){if ((--B._PreloadCount)==0&&B.OnComplete) B.OnComplete();};
41 41
var FCKRegexLib={AposEntity:/&apos;/gi,ObjectElements:/^(?:IMG|TABLE|TR|TD|TH|INPUT|SELECT|TEXTAREA|HR|OBJECT|A|UL|OL|LI)$/i,NamedCommands:/^(?:Cut|Copy|Paste|Print|SelectAll|RemoveFormat|Unlink|Undo|Redo|Bold|Italic|Underline|StrikeThrough|Subscript|Superscript|JustifyLeft|JustifyCenter|JustifyRight|JustifyFull|Outdent|Indent|InsertOrderedList|InsertUnorderedList|InsertHorizontalRule)$/i,BeforeBody:/(^[\s\S]*\<body[^\>]*\>)/i,AfterBody:/(\<\/body\>[\s\S]*$)/i,ToReplace:/___fcktoreplace:([\w]+)/ig,MetaHttpEquiv:/http-equiv\s*=\s*["']?([^"' ]+)/i,HasBaseTag:/<base /i,HasBodyTag:/<body[\s|>]/i,HtmlOpener:/<html\s?[^>]*>/i,HeadOpener:/<head\s?[^>]*>/i,HeadCloser:/<\/head\s*>/i,FCK_Class:/\s*FCK__[^ ]*(?=\s+|$)/,ElementName:/(^[a-z_:][\w.\-:]*\w$)|(^[a-z_]$)/,ForceSimpleAmpersand:/___FCKAmp___/g,SpaceNoClose:/\/>/g,EmptyParagraph:/^<(p|div|address|h\d|center)(?=[ >])[^>]*>\s*(<\/\1>)?$/,EmptyOutParagraph:/^<(p|div|address|h\d|center)(?=[ >])[^>]*>(?:\s*|&nbsp;|&#160;)(<\/\1>)?$/,TagBody:/></,GeckoEntitiesMarker:/#\?-\:/g,ProtectUrlsImg:/<img(?=\s).*?\ssrc=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi,ProtectUrlsA:/<a(?=\s).*?\shref=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi,ProtectUrlsArea:/<area(?=\s).*?\shref=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi,Html4DocType:/HTML 4\.0 Transitional/i,DocTypeTag:/<!DOCTYPE[^>]*>/i,HtmlDocType:/DTD HTML/,TagsWithEvent:/<[^\>]+ on\w+[\s\r\n]*=[\s\r\n]*?('|")[\s\S]+?\>/g,EventAttributes:/\s(on\w+)[\s\r\n]*=[\s\r\n]*?('|")([\s\S]*?)\2/g,ProtectedEvents:/\s\w+_fckprotectedatt="([^"]+)"/g,StyleProperties:/\S+\s*:/g,InvalidSelfCloseTags:/(<(?!base|meta|link|hr|br|param|img|area|input)([a-zA-Z0-9:]+)[^>]*)\/>/gi,StyleVariableAttName:/#\(\s*("|')(.+?)\1[^\)]*\s*\)/g,RegExp:/^\/(.*)\/([gim]*)$/,HtmlTag:/<[^\s<>](?:"[^"]*"|'[^']*'|[^<])*>/};

Also available in: Unified diff