| 1075 |
ddelon |
1 |
/*
|
|
|
2 |
* FCKeditor - The text editor for internet
|
|
|
3 |
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
|
|
4 |
*
|
|
|
5 |
* Licensed under the terms of the GNU Lesser General Public License:
|
|
|
6 |
* http://www.opensource.org/licenses/lgpl-license.php
|
|
|
7 |
*
|
|
|
8 |
* For further information visit:
|
|
|
9 |
* http://www.fckeditor.net/
|
|
|
10 |
*
|
|
|
11 |
* "Support Open Source software. What about a donation today?"
|
|
|
12 |
*
|
|
|
13 |
* File Name: fckevents.js
|
|
|
14 |
* FCKEvents Class: used to handle events is a advanced way.
|
|
|
15 |
*
|
|
|
16 |
* File Authors:
|
|
|
17 |
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
|
|
18 |
*/
|
|
|
19 |
|
|
|
20 |
var FCKEvents ;
|
|
|
21 |
|
|
|
22 |
FCKEvents = function( eventsOwner )
|
|
|
23 |
{
|
|
|
24 |
this.Owner = eventsOwner ;
|
|
|
25 |
this.RegisteredEvents = new Object() ;
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
FCKEvents.prototype.AttachEvent = function( eventName, functionPointer )
|
|
|
29 |
{
|
|
|
30 |
var aTargets ;
|
|
|
31 |
|
|
|
32 |
if ( !( aTargets = this.RegisteredEvents[ eventName ] ) )
|
|
|
33 |
this.RegisteredEvents[ eventName ] = [ functionPointer ] ;
|
|
|
34 |
else
|
|
|
35 |
aTargets.push( functionPointer ) ;
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
FCKEvents.prototype.FireEvent = function( eventName, params )
|
|
|
39 |
{
|
|
|
40 |
var bReturnValue = true ;
|
|
|
41 |
|
|
|
42 |
var oCalls = this.RegisteredEvents[ eventName ] ;
|
|
|
43 |
|
|
|
44 |
if ( oCalls )
|
|
|
45 |
{
|
|
|
46 |
for ( var i = 0 ; i < oCalls.length ; i++ )
|
|
|
47 |
bReturnValue = ( oCalls[ i ]( this.Owner, params ) && bReturnValue ) ;
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
return bReturnValue ;
|
|
|
51 |
}
|