[ Index ] |
|
Code source de GeekLog 1.4.1 |
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: fckjscoreextensions.js 14 * Extensions to the JavaScript Core. 15 * 16 * All custom extentions functions are PascalCased to differ from the standard 17 * camelCased ones. 18 * 19 * File Authors: 20 * Frederico Caldeira Knabben (fredck@fckeditor.net) 21 */ 22 23 String.prototype.Contains = function( textToCheck ) 24 { 25 return ( this.indexOf( textToCheck ) > -1 ) ; 26 } 27 28 String.prototype.Equals = function() 29 { 30 for ( var i = 0 ; i < arguments.length ; i++ ) 31 if ( this == arguments[i] ) 32 return true ; 33 34 return false ; 35 } 36 37 Array.prototype.AddItem = function( item ) 38 { 39 var i = this.length ; 40 this[ i ] = item ; 41 return i ; 42 } 43 44 Array.prototype.indexOf = function( value ) 45 { 46 for ( var i = 0 ; i < this.length ; i++ ) 47 { 48 if ( this[i] == value ) 49 return i ; 50 } 51 return -1 ; 52 } 53 54 String.prototype.startsWith = function( value ) 55 { 56 return ( this.substr( 0, value.length ) == value ) ; 57 } 58 59 // Extends the String object, creating a "endsWith" method on it. 60 String.prototype.endsWith = function( value, ignoreCase ) 61 { 62 var L1 = this.length ; 63 var L2 = value.length ; 64 65 if ( L2 > L1 ) 66 return false ; 67 68 if ( ignoreCase ) 69 { 70 var oRegex = new RegExp( value + '$' , 'i' ) ; 71 return oRegex.test( this ) ; 72 } 73 else 74 return ( L2 == 0 || this.substr( L1 - L2, L2 ) == value ) ; 75 } 76 77 String.prototype.remove = function( start, length ) 78 { 79 var s = '' ; 80 81 if ( start > 0 ) 82 s = this.substring( 0, start ) ; 83 84 if ( start + length < this.length ) 85 s += this.substring( start + length , this.length ) ; 86 87 return s ; 88 } 89 90 String.prototype.trim = function() 91 { 92 return this.replace( /(^\s*)|(\s*$)/g, '' ) ; 93 } 94 95 String.prototype.ltrim = function() 96 { 97 return this.replace( /^\s*/g, '' ) ; 98 } 99 100 String.prototype.rtrim = function() 101 { 102 return this.replace( /\s*$/g, '' ) ; 103 } 104 105 String.prototype.replaceNewLineChars = function( replacement ) 106 { 107 return this.replace( /\n/g, replacement ) ; 108 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 12:27:40 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |