[ 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/ -> fckcoreextensions.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: fckcoreextensions.js
  14   *     Some extensions to the Javascript Core.
  15   * 
  16   * File Authors:
  17   *         Frederico Caldeira Knabben (fredck@fckeditor.net)
  18   */
  19  
  20  // Extends the Array object, creating a "addItem" method on it.
  21  Array.prototype.addItem = function( item )
  22  {
  23      var i = this.length ;
  24      this[ i ] = item ;
  25      return i ;
  26  }
  27  
  28  Array.prototype.indexOf = function( value )
  29  {
  30      for ( var i = 0 ; i < this.length ; i++ )
  31      {
  32          if ( this[i] == value )
  33              return i ;
  34      }
  35      return -1 ;
  36  }
  37  
  38  String.prototype.startsWith = function( value )
  39  {
  40      return ( this.substr( 0, value.length ) == value ) ;
  41  }
  42  
  43  // Extends the String object, creating a "endsWith" method on it.
  44  String.prototype.endsWith = function( value, ignoreCase )
  45  {
  46      var L1 = this.length ;
  47      var L2 = value.length ;
  48      
  49      if ( L2 > L1 )
  50          return false ;
  51  
  52      if ( ignoreCase )
  53      {
  54          var oRegex = new RegExp( value + '$' , 'i' ) ;
  55          return oRegex.test( this ) ;
  56      }
  57      else
  58          return ( L2 == 0 || this.substr( L1 - L2, L2 ) == value ) ;
  59  }
  60  
  61  String.prototype.remove = function( start, length )
  62  {
  63      var s = '' ;
  64      
  65      if ( start > 0 )
  66          s = this.substring( 0, start ) ;
  67      
  68      if ( start + length < this.length )
  69          s += this.substring( start + length , this.length ) ;
  70          
  71      return s ;
  72  }
  73  
  74  String.prototype.trim = function()
  75  {
  76      return this.replace( /(^\s*)|(\s*$)/g, '' ) ;
  77  }
  78  
  79  String.prototype.ltrim = function()
  80  {
  81      return this.replace( /^\s*/g, '' ) ;
  82  }
  83  
  84  String.prototype.rtrim = function()
  85  {
  86      return this.replace( /\s*$/g, '' ) ;
  87  }
  88  
  89  String.prototype.replaceNewLineChars = function( replacement )
  90  {
  91      return this.replace( /\n/g, replacement ) ;
  92  }


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