[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/public_html/fckeditor/editor/_source/ -> fckeditorapi.js (source)

   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: fckeditorapi.js
  14   *     Create the FCKeditorAPI object that is available as a global object in
  15   *     the page where the editor is placed in.
  16   * 
  17   * File Authors:
  18   *         Frederico Caldeira Knabben (fredck@fckeditor.net)
  19   */
  20  
  21  var FCKeditorAPI ;
  22  
  23  function InitializeAPI()
  24  {
  25      if ( !( FCKeditorAPI = window.parent.FCKeditorAPI ) )
  26      {
  27          // Make the FCKeditorAPI object available in the parent window. Use 
  28          // eval so it is independent from this window and so it will still be 
  29          // available if the editor instance is removed ("Can't execute code
  30          // from a freed script" error).
  31          var sScript = '\
  32              var FCKeditorAPI = {\
  33                  Version            : \'2.3.1\',\
  34                  VersionBuild    : \'1062\',\
  35                  __Instances        : new Object(),\
  36                  GetInstance        : function( instanceName )\
  37                  {\
  38                      return this.__Instances[ instanceName ] ;\
  39                  },\
  40                  _FunctionQueue    : {\
  41                      Functions    : new Array(),\
  42                      IsRunning    : false,\
  43                      Add            : function( functionToAdd )\
  44                      {\
  45                          this.Functions.push( functionToAdd ) ;\
  46                          if ( !this.IsRunning )\
  47                              this.StartNext() ;\
  48                      },\
  49                      StartNext    : function()\
  50                      {\
  51                          var aQueue = this.Functions ;\
  52                          if ( aQueue.length > 0 )\
  53                          {\
  54                              this.IsRunning = true ;\
  55                              aQueue[0].call() ;\
  56                          }\
  57                          else\
  58                              this.IsRunning = false ;\
  59                      },\
  60                      Remove        : function( func )\
  61                      {\
  62                          var aQueue = this.Functions ;\
  63                          var i = 0, fFunc ;\
  64                          while( fFunc = aQueue[ i ] )\
  65                          {\
  66                              if ( fFunc == func )\
  67                                  aQueue.splice( i,1 ) ;\
  68                              i++ ;\
  69                          }\
  70                          this.StartNext() ;\
  71                      }\
  72                  }\
  73              }' ;
  74          
  75          // In IE, the "eval" function is not always available (it works with
  76          // the JavaScript samples, but not with the ASP ones, for example).
  77          // So, let's use the execScript instead.
  78          if ( window.parent.execScript )
  79              window.parent.execScript( sScript, 'JavaScript' ) ;
  80          else
  81              window.parent.eval( sScript ) ;
  82          
  83          FCKeditorAPI = window.parent.FCKeditorAPI ;
  84      }
  85  
  86      // Add the current instance to the FCKeditorAPI's instances collection.
  87      FCKeditorAPI.__Instances[ FCK.Name ] = FCK ;
  88  }
  89  
  90  function FCKeditorAPI_Cleanup()
  91  {
  92      FCKeditorAPI.__Instances[ FCK.Name ] = null ;
  93  }
  94  FCKTools.AddEventListener( window, 'unload', FCKeditorAPI_Cleanup ) ;    


Généré le : Wed Nov 21 12:27:40 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics