[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/include/fckeditor/editor/_source/internals/ -> fck_onload.js (source)

   1  /*
   2   * FCKeditor - The text editor for internet
   3   * Copyright (C) 2003-2005 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: fck_onload.js
  14   *     This is the script that is called when the editor page is loaded inside
  15   *     its IFRAME. It's the editor startup.
  16   * 
  17   * File Authors:
  18   *         Frederico Caldeira Knabben (fredck@fckeditor.net)
  19   */
  20  
  21  // Disable the context menu in the editor (areas outside the editor area).
  22  function Window_OnContextMenu( e )
  23  {
  24      if ( e )
  25          e.preventDefault() ;    // The Gecko way.
  26      else
  27      {
  28          if ( event.srcElement == document.getElementById('eSourceField') )
  29              return true ;
  30      }
  31  
  32      return false ;                // The IE way.
  33  }
  34  window.document.oncontextmenu = Window_OnContextMenu ;
  35  
  36  // Gecko browsers doens't calculate well that IFRAME size so we must
  37  // recalculate it every time the window size changes.
  38  if ( FCKBrowserInfo.IsGecko )
  39  {
  40  	function Window_OnResize()
  41      {
  42          var oFrame = document.getElementById('eEditorArea') ;
  43          oFrame.height = 0 ;
  44  
  45          var oCell = document.getElementById( FCK.EditMode == FCK_EDITMODE_WYSIWYG ? 'eWysiwygCell' : 'eSource' ) ;
  46          var iHeight = oCell.offsetHeight ;
  47  
  48          oFrame.height = iHeight - 2 ;
  49      }
  50      window.onresize = Window_OnResize ;
  51  }
  52  
  53  if ( FCKBrowserInfo.IsIE )
  54  {
  55      var aCleanupDocs = new Array() ;
  56      aCleanupDocs[0] = document ;
  57  
  58      // On IE, some circular references must be cleared to avoid memory leak.
  59  	function Window_OnBeforeUnload()
  60      {
  61  //        if ( typeof( FCKToolbarSet ) != 'undefined' )
  62  //            FCKToolbarSet.Collapse() ;
  63  
  64          var d, e ;
  65  
  66          var j = 0 ;
  67          while ( ( d = aCleanupDocs[j++] ) )
  68          {
  69              var i = 0 ;
  70              while ( ( e = d.getElementsByTagName("DIV").item(i++) ) )
  71              {
  72                  if ( e.FCKToolbarButton )
  73                      e.FCKToolbarButton = null ;
  74  
  75                  if ( e.FCKSpecialCombo )
  76                      e.FCKSpecialCombo = null ;
  77  
  78                  if ( e.Command )
  79                      e.Command = null ;
  80              }
  81  
  82              i = 0 ;
  83              while ( ( e = d.getElementsByTagName("TR").item(i++) ) )
  84              {
  85                  if ( e.FCKContextMenuItem )
  86                      e.FCKContextMenuItem = null ;
  87              }
  88  
  89              aCleanupDocs[j] = null ;
  90          }
  91          
  92          if ( typeof( FCKTempBin ) != 'undefined' )
  93              FCKTempBin.Reset() ;
  94      }
  95      window.attachEvent( "onunload", Window_OnBeforeUnload ) ;
  96  }
  97  
  98  // The editor startup follows these steps:
  99  //        1. Load the editor main page (fckeditor.html).
 100  //        2. Load the main configuration file (fckconfig.js)
 101  //        3. Process the configurations set directly in the page code (just load then).
 102  //        4. Override the configurations with the custom config file (if set).
 103  //        5. Override the configurations with that ones set directly in the page code.
 104  //        6. Load the editor skin styles CSS files.
 105  //        7. Load the first part of tha main scripts.
 106  //        8. Load the language file.
 107  //        9. Start the editor.
 108  
 109  // Start the editor as soon as the window is loaded.
 110  function Window_OnLoad()
 111  {
 112      // There is a bug on Netscape when rendering the frame. It goes over the
 113      // right border. So we must correct it.
 114      if ( FCKBrowserInfo.IsNetscape )
 115          document.getElementById('eWysiwygCell').style.paddingRight = '2px' ;
 116  
 117      LoadConfigFile() ;
 118  }
 119  window.onload = Window_OnLoad ;
 120  
 121  function LoadConfigFile()
 122  {
 123      FCKScriptLoader.OnEmpty = ProcessHiddenField ;
 124  
 125      // First of all load the configuration file.
 126      FCKScriptLoader.AddScript( '../fckconfig.js' ) ;
 127  }
 128  
 129  function ProcessHiddenField()
 130  {
 131      FCKConfig.ProcessHiddenField() ;
 132  
 133      LoadCustomConfigFile() ;
 134  }
 135  
 136  function LoadCustomConfigFile()
 137  {
 138      // Load the custom configurations file (if defined).
 139      if ( FCKConfig.CustomConfigurationsPath.length > 0 )
 140      {
 141          // Wait for the configuration file to be loaded to call the "LoadPageConfig".
 142          FCKScriptLoader.OnEmpty = LoadPageConfig ;
 143  
 144          FCKScriptLoader.AddScript( FCKConfig.CustomConfigurationsPath ) ;
 145      }
 146      else
 147      {
 148          // Load the page defined configurations immediately.
 149          LoadPageConfig() ;
 150      }
 151  }
 152  
 153  function LoadPageConfig()
 154  {
 155      FCKConfig.LoadPageConfig() ;
 156      
 157      if ( FCKConfig.AllowQueryStringDebug && (/fckdebug=true/i).test( window.top.location.search ) )
 158          FCKConfig.Debug = true ;
 159  
 160      // Load the styles for the configured skin.
 161      LoadStyles() ;
 162  }
 163  
 164  function LoadStyles()
 165  {
 166      if( window.console ) window.console.log( 'LoadStyles()' ) ;    // @Packager.Compactor.RemoveLine
 167  
 168      FCKScriptLoader.OnEmpty = LoadScripts ;
 169  
 170      // Load the active skin CSS.
 171      FCKScriptLoader.AddScript( FCKConfig.SkinPath + 'fck_editor.css' ) ;
 172      FCKScriptLoader.AddScript( FCKConfig.SkinPath + 'fck_contextmenu.css' ) ;
 173  }
 174  
 175  function LoadScripts()
 176  {
 177      if( window.console ) window.console.log( 'LoadScripts()' ) ;    // @Packager.Compactor.RemoveLine
 178  
 179      FCKScriptLoader.OnEmpty = null ;
 180  
 181      // @Packager.Compactor.Remove.Start
 182      var sSuffix = FCKBrowserInfo.IsIE ? 'ie' : 'gecko' ;
 183  
 184      FCKScriptLoader.AddScript( '_source/internals/fckdebug.js' ) ;
 185      FCKScriptLoader.AddScript( '_source/internals/fcktools.js' ) ;
 186      FCKScriptLoader.AddScript( '_source/internals/fcktools_' + sSuffix + '.js' ) ;
 187      FCKScriptLoader.AddScript( '_source/internals/fckregexlib.js' ) ;
 188      FCKScriptLoader.AddScript( '_source/internals/fcklanguagemanager.js' ) ;
 189      FCKScriptLoader.AddScript( '_source/classes/fckevents.js' ) ;
 190      FCKScriptLoader.AddScript( '_source/internals/fckxhtmlentities.js' ) ;
 191      FCKScriptLoader.AddScript( '_source/internals/fckxhtml.js' ) ;
 192      FCKScriptLoader.AddScript( '_source/internals/fckxhtml_' + sSuffix + '.js' ) ;
 193      FCKScriptLoader.AddScript( '_source/internals/fckcodeformatter.js' ) ;
 194      FCKScriptLoader.AddScript( '_source/internals/fckundo_' + sSuffix + '.js' ) ;
 195      FCKScriptLoader.AddScript( '_source/internals/fck_1.js' ) ;
 196      FCKScriptLoader.AddScript( '_source/internals/fck_1_' + sSuffix + '.js' ) ;
 197      // @Packager.Compactor.Remove.End
 198  
 199      /* @Packager.Compactor.RemoveLine
 200      if ( FCKBrowserInfo.IsIE )
 201          FCKScriptLoader.AddScript( 'js/fckeditorcode_ie_1.js' ) ;
 202      else
 203          FCKScriptLoader.AddScript( 'js/fckeditorcode_gecko_1.js' ) ;
 204      @Packager.Compactor.RemoveLine */
 205  }
 206  
 207  function LoadLanguageFile()
 208  {
 209      if( window.console ) window.console.log( 'LoadLanguageFile()' ) ;    // @Packager.Compactor.RemoveLine
 210  
 211      FCKScriptLoader.OnEmpty = LoadEditor ;
 212  
 213      if( window.console ) window.console.log( 'Active Language: ' + FCKLanguageManager.ActiveLanguage.Code ) ;    // @Packager.Compactor.RemoveLine
 214  
 215      FCKScriptLoader.AddScript( 'lang/' + FCKLanguageManager.ActiveLanguage.Code + '.js' ) ;
 216  }
 217  
 218  function LoadEditor()
 219  {
 220      if( window.console ) window.console.log( 'LoadEditor()' ) ;    // @Packager.Compactor.RemoveLine
 221  
 222      // Removes the OnEmpty listener.
 223      FCKScriptLoader.OnEmpty = null ;
 224  
 225      // Correct the editor layout to the correct language direction.
 226      if ( FCKLang )
 227          window.document.dir = FCKLang.Dir ;
 228  
 229      // Starts the editor.
 230      FCK.StartEditor() ;
 231  }


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7