Вход Регистрация
Файл: fckeditor/editor/_source/fckjscoreextensions.js
Строк: 166
<?php

/*
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
 *
 * Extensions to the JavaScript Core.
 *
 * All custom extensions functions are PascalCased to differ from the standard
 * camelCased ones.
 */

String.prototype.Contains = function( textToCheck )
{
    return ( 
this.indexOftextToCheck ) > -) ;
}

String.prototype.Equals = function()
{
    var 
aArgs arguments ;

    
// The arguments could also be a single array.
    
if ( aArgs.length == && aArgs[0].pop )
        
aArgs aArgs[0] ;

    for ( var 
aArgs.length i++ )
    {
        if ( 
this == aArgs[i] )
            return 
true ;
    }
    return 
false ;
}

String.prototype.IEquals = function()
{
    var 
thisUpper this.toUpperCase() ;

    var 
aArgs arguments ;

    
// The arguments could also be a single array.
    
if ( aArgs.length == && aArgs[0].pop )
        
aArgs aArgs[0] ;

    for ( var 
aArgs.length i++ )
    {
        if ( 
thisUpper == aArgs[i].toUpperCase() )
            return 
true ;
    }
    return 
false ;
}

String.prototype.ReplaceAll = function( searchArrayreplaceArray )
{
    var 
replaced this ;

    for ( var 
searchArray.length i++ )
    {
        
replaced replaced.replacesearchArray[i], replaceArray[i] ) ;
    }

    return 
replaced ;
}

String.prototype.StartsWith = function( value )
{
    return ( 
this.substr0value.length ) == value ) ;
}

// Extends the String object, creating a "EndsWith" method on it.
String.prototype.EndsWith = function( valueignoreCase )
{
    var 
L1 this.length ;
    var 
L2 value.length ;

    if ( 
L2 L1 )
        return 
false ;

    if ( 
ignoreCase )
    {
        var 
oRegex = new RegExpvalue '$' 'i' ) ;
        return 
oRegex.testthis ) ;
    }
    else
        return ( 
L2 == || this.substrL1 L2L2 ) == value ) ;
}

String.prototype.Remove = function( startlength )
{
    var 
'' ;

    if ( 
start )
        
this.substring0start ) ;

    if ( 
start length this.length )
        
+= this.substringstart length this.length ) ;

    return 
;
}

String.prototype.Trim = function()
{
    
// We are not using s because we don't want "non-breaking spaces to be caught".
    
return this.replace( /(^[ tnr]*)|([ tnr]*$)/g'' ) ;
}

String.prototype.LTrim = function()
{
    
// We are not using s because we don't want "non-breaking spaces to be caught".
    
return this.replace( /^[ tnr]*/g'' ) ;
}

String.prototype.RTrim = function()
{
    
// We are not using s because we don't want "non-breaking spaces to be caught".
    
return this.replace( /[ tnr]*$/g'' ) ;
}

String.prototype.ReplaceNewLineChars = function( replacement )
{
    return 
this.replace( /n/greplacement ) ;
}

String.prototype.Replace = function( regExpreplacementthisObj )
{
    if ( 
typeof replacement == 'function' )
    {
        return 
this.replaceregExp,
            function()
            {
                return 
replacement.applythisObj || thisarguments ) ;
            } ) ;
    }
    else
        return 
this.replaceregExpreplacement ) ;
}

Array.
prototype.AddItem = function( item )
{
    var 
this.length ;
    
this] = item ;
    return 
;
}

Array.
prototype.IndexOf = function( value )
{
    for ( var 
this.length i++ )
    {
        if ( 
this[i] == value )
            return 
;
    }
    return -
;
}
?>
Онлайн: 0
Реклама