[ Index ]
 

Code source de GeekLog 1.4.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/public_html/fckeditor/editor/_source/classes/ -> fcktoolbarfontformatcombo.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: fcktoolbarfontformatcombo.js
  14   *     FCKToolbarPanelButton Class: Handles the Fonts combo selector.
  15   * 
  16   * File Authors:
  17   *         Frederico Caldeira Knabben (fredck@fckeditor.net)
  18   */
  19  
  20  var FCKToolbarFontFormatCombo = function( tooltip, style )
  21  {
  22      this.CommandName = 'FontFormat' ;
  23      this.Label        = this.GetLabel() ;
  24      this.Tooltip    = tooltip ? tooltip : this.Label ;
  25      this.Style        = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
  26      
  27      this.NormalLabel = 'Normal' ;
  28      
  29      this.PanelWidth = 190 ;
  30  }
  31  
  32  // Inherit from FCKToolbarSpecialCombo.
  33  FCKToolbarFontFormatCombo.prototype = new FCKToolbarSpecialCombo ;
  34  
  35  
  36  FCKToolbarFontFormatCombo.prototype.GetLabel = function()
  37  {
  38      return FCKLang.FontFormat ;
  39  }
  40  
  41  FCKToolbarFontFormatCombo.prototype.CreateItems = function( targetSpecialCombo )
  42  {
  43      // Get the format names from the language file.
  44      var aNames = FCKLang['FontFormats'].split(';') ;
  45      var oNames = {
  46          p        : aNames[0],
  47          pre        : aNames[1],
  48          address    : aNames[2],
  49          h1        : aNames[3],
  50          h2        : aNames[4],
  51          h3        : aNames[5],
  52          h4        : aNames[6],
  53          h5        : aNames[7],
  54          h6        : aNames[8],
  55          div        : aNames[9]
  56      } ;
  57  
  58      // Get the available formats from the configuration file.
  59      var aTags = FCKConfig.FontFormats.split(';') ;
  60      
  61      for ( var i = 0 ; i < aTags.length ; i++ )
  62      {
  63          // Support for DIV in Firefox has been reintroduced on version 2.2.
  64  //        if ( aTags[i] == 'div' && FCKBrowserInfo.IsGecko )
  65  //            continue ;
  66          
  67          var sTag    = aTags[i] ;
  68          var sLabel    = oNames[sTag] ;
  69          
  70          if ( sTag == 'p' )
  71              this.NormalLabel = sLabel ;
  72          
  73          this._Combo.AddItem( sTag, '<div class="BaseFont"><' + sTag + '>' + sLabel + '</' + sTag + '></div>', sLabel ) ;
  74      }
  75  }
  76  
  77  if ( FCKBrowserInfo.IsIE )
  78  {
  79      FCKToolbarFontFormatCombo.prototype.RefreshActiveItems = function( combo, value )
  80      {
  81  //        FCKDebug.Output( 'FCKToolbarFontFormatCombo Value: ' + value ) ;
  82  
  83          // IE returns normal for DIV and P, so to avoid confusion, we will not show it if normal.
  84          if ( value == this.NormalLabel )
  85          {
  86              if ( combo.Label != '&nbsp;' )
  87                  combo.DeselectAll(true) ;
  88          }
  89          else
  90          {
  91              if ( this._LastValue == value )
  92                  return ;
  93  
  94              combo.SelectItemByLabel( value, true ) ;
  95          }
  96  
  97          this._LastValue = value ;
  98      }
  99  }


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