Вход Регистрация
Файл: fckeditor/editor/_source/internals/fcktools_ie.js
Строк: 264
<?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 ==
 *
 * Utility functions. (IE version).
 */

FCKTools.CancelEvent = function( )
{
    return 
false ;
}

// Appends one or more CSS files to a document.
FCKTools._AppendStyleSheet = function( documentElementcssFileUrl )
{
    return 
documentElement.createStyleSheetcssFileUrl ).owningElement ;
}

// Appends a CSS style string to a document.
FCKTools.AppendStyleString = function( documentElementcssStyles )
{
    if ( !
cssStyles )
        return 
null ;

    var 
documentElement.createStyleSheet"" ) ;
    
s.cssText cssStyles ;
    return 
;
}

// Removes all attributes and values from the element.
FCKTools.ClearElementAttributes = function( element )
{
    
element.clearAttributes() ;
}

FCKTools.GetAllChildrenIds = function( parentElement )
{
    var 
aIds = new Array() ;
    for ( var 
parentElement.all.length i++ )
    {
        var 
sId parentElement.all[i].id ;
        if ( 
sId && sId.length )
            
aIdsaIds.length ] = sId ;
    }
    return 
aIds ;
}

FCKTools.RemoveOuterTags = function( )
{
    
e.insertAdjacentHTML'beforeBegin'e.innerHTML ) ;
    
e.parentNode.removeChild) ;
}

FCKTools.CreateXmlObject = function( object )
{
    var 
aObjs ;

    switch ( object )
    {
        case 
'XmlHttp' :
            
// Try the native XMLHttpRequest introduced with IE7.
            
if ( document.location.protocol != 'file:' )
                try { return new 
XMLHttpRequest() ; } catch (e) {}

            
aObjs = [ 'MSXML2.XmlHttp''Microsoft.XmlHttp' ] ;
            break ;

        case 
'DOMDocument' :
            
aObjs = [ 'MSXML2.DOMDocument''Microsoft.XmlDom' ] ;
            break ;
    }

    for ( var 
i++ )
    {
        try { return new 
ActiveXObjectaObjs[i] ) ; }
        catch (
e)
        {}
    }

    if ( 
FCKLang.NoActiveX )
    {
        
alertFCKLang.NoActiveX ) ;
        
FCKLang.NoActiveX null ;
    }
    return 
null ;
}

FCKTools.DisableSelection = function( element )
{
    
element.unselectable 'on' ;

    var 
e;
    
// The extra () is to avoid a warning with strict error checking. This is ok.
    
while ( (element.alli++ ]) )
    {
        switch ( 
e.tagName )
        {
            case 
'IFRAME' :
            case 
'TEXTAREA' :
            case 
'INPUT' :
            case 
'SELECT' :
                
/* Ignore the above tags */
                
break ;
            default :
                
e.unselectable 'on' ;
        }
    }
}

FCKTools.GetScrollPosition = function( relativeWindow )
{
    var 
oDoc relativeWindow.document ;

    
// Try with the doc element.
    
var oPos = { oDoc.documentElement.scrollLeftoDoc.documentElement.scrollTop } ;

    if ( 
oPos.|| oPos.)
        return 
oPos ;

    
// If no scroll, try with the body.
    
return { oDoc.body.scrollLeftoDoc.body.scrollTop } ;
}

FCKTools.AddEventListener = function( sourceObjecteventNamelistener )
{
    
sourceObject.attachEvent'on' eventNamelistener ) ;
}

FCKTools.RemoveEventListener = function( sourceObjecteventNamelistener )
{
    
sourceObject.detachEvent'on' eventNamelistener ) ;
}

// Listeners attached with this function cannot be detached.
FCKTools.AddEventListenerEx = function( sourceObjecteventNamelistenerparamsArray )
{
    
// Ok... this is a closures party, but is the only way to make it clean of memory leaks.
    
var = new Object() ;
    
o.Source sourceObject ;
    
o.Params paramsArray || [] ;    // Memory leak if we have DOM objects here.
    
o.Listener = function( ev )
    {
        return 
listener.applyo.Source, [ ev ].concato.Params ) ) ;
    }

    if ( 
FCK.IECleanup )
        
FCK.IECleanup.AddItemnull, function() { o.Source null o.Params null ; } ) ;

    
sourceObject.attachEvent'on' eventNameo.Listener ) ;

    
sourceObject null ;    // Memory leak cleaner (because of the above closure).
    
paramsArray null ;    // Memory leak cleaner (because of the above closure).
}

// Returns and object with the "Width" and "Height" properties.
FCKTools.GetViewPaneSize = function( win )
{
    var 
oSizeSource ;

    var 
oDoc win.document.documentElement ;
    if ( 
oDoc && oDoc.clientWidth )                // IE6 Strict Mode
        
oSizeSource oDoc ;
    else
        
oSizeSource win.document.body ;        // Other IEs

    
if ( oSizeSource )
        return { 
Width oSizeSource.clientWidthHeight oSizeSource.clientHeight } ;
    else
        return { 
Width 0Height } ;
}

FCKTools.SaveStyles = function( element )
{
    var 
data FCKTools.ProtectFormStyleselement ) ;

    var 
oSavedStyles = new Object() ;

    if ( 
element.className.length )
    {
        
oSavedStyles.Class = element.className ;
        
element.className '' ;
    }

    var 
sInlineStyle element.style.cssText ;

    if ( 
sInlineStyle.length )
    {
        
oSavedStyles.Inline sInlineStyle ;
        
element.style.cssText '' ;
    }

    
FCKTools.RestoreFormStyleselementdata ) ;
    return 
oSavedStyles ;
}

FCKTools.RestoreStyles = function( elementsavedStyles )
{
    var 
data FCKTools.ProtectFormStyleselement ) ;
    
element.className        savedStyles.Class || '' ;
    
element.style.cssText    savedStyles.Inline || '' ;
    
FCKTools.RestoreFormStyleselementdata ) ;
}

FCKTools.RegisterDollarFunction = function( targetWindow )
{
    
targetWindow.$ = targetWindow.document.getElementById ;
}

FCKTools.AppendElement = function( targetelementName )
{
    return 
target.appendChildthis.GetElementDocumenttarget ).createElementelementName ) ) ;
}

// This function may be used by Regex replacements.
FCKTools.ToLowerCase = function( strValue )
{
    return 
strValue.toLowerCase() ;
}
?>
Онлайн: 3
Реклама