Вход Регистрация
Файл: fckeditor/editor/_source/classes/fckmenublock.js
Строк: 177
<?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 ==
 *
 * Renders a list of menu items.
 */

var FCKMenuBlock = function()
{
    
this._Items    = new Array() ;
}


FCKMenuBlock.prototype.Count = function()
{
    return 
this._Items.length ;
}

FCKMenuBlock.prototype.AddItem = function( namelabeliconPathOrStripInfoArrayOrIndexisDisabledcustomData )
{
    var 
oItem = new FCKMenuItemthisnamelabeliconPathOrStripInfoArrayOrIndexisDisabledcustomData ) ;

    
oItem.OnClick        FCKTools.CreateEventListenerFCKMenuBlock_Item_OnClickthis ) ;
    
oItem.OnActivate    FCKTools.CreateEventListenerFCKMenuBlock_Item_OnActivatethis ) ;

    
this._Items.pushoItem ) ;

    return 
oItem ;
}

FCKMenuBlock.prototype.AddSeparator = function()
{
    
this._Items.push( new FCKMenuSeparator() ) ;
}

FCKMenuBlock.prototype.RemoveAllItems = function()
{
    
this._Items = new Array() ;

    var 
eItemsTable this._ItemsTable ;
    if ( 
eItemsTable )
    {
        while ( 
eItemsTable.rows.length )
            
eItemsTable.deleteRow) ;
    }
}

FCKMenuBlock.prototype.Create = function( parentElement )
{
    if ( !
this._ItemsTable )
    {
        if ( 
FCK.IECleanup )
            
FCK.IECleanup.AddItemthisFCKMenuBlock_Cleanup ) ;

        
this._Window FCKTools.GetElementWindowparentElement ) ;

        var 
oDoc FCKTools.GetElementDocumentparentElement ) ;

        var 
eTable parentElement.appendChildoDoc.createElement'table' ) ) ;
        
eTable.cellPadding ;
        
eTable.cellSpacing ;

        
FCKTools.DisableSelectioneTable ) ;

        var 
oMainElement eTable.insertRow(-1).insertCell(-1) ;
        
oMainElement.className 'MN_Menu' ;

        var 
eItemsTable this._ItemsTable oMainElement.appendChildoDoc.createElement'table' ) ) ;
        
eItemsTable.cellPadding ;
        
eItemsTable.cellSpacing ;
    }

    for ( var 
this._Items.length i++ )
        
this._Items[i].Createthis._ItemsTable ) ;
}

/* Events */

function FCKMenuBlock_Item_OnClickclickedItemmenuBlock )
{
    if ( 
menuBlock.Hide )
        
menuBlock.Hide() ;

    
FCKTools.RunFunctionmenuBlock.OnClickmenuBlock, [ clickedItem ] ) ;
}

function 
FCKMenuBlock_Item_OnActivatemenuBlock )
{
    var 
oActiveItem menuBlock._ActiveItem ;

    if ( 
oActiveItem && oActiveItem != this )
    {
        
// Set the focus to this menu block window (to fire OnBlur on opened panels).
        
if ( !FCKBrowserInfo.IsIE && oActiveItem.HasSubMenu && !this.HasSubMenu )
        {
            
menuBlock._Window.focus() ;

            
// Due to the event model provided by Opera, we need to set
            // HasFocus here as the above focus() call will not fire the focus
            // event in the panel immediately (#1200).
            
menuBlock.Panel.HasFocus true ;
        }

        
oActiveItem.Deactivate() ;
    }

    
menuBlock._ActiveItem this ;
}

function 
FCKMenuBlock_Cleanup()
{
    
this._Window null ;
    
this._ItemsTable null ;
}

// ################# //

var FCKMenuSeparator = function()
{}

FCKMenuSeparator.prototype.Create = function( parentTable )
{
    var 
oDoc FCKTools.GetElementDocumentparentTable ) ;

    var 
parentTable.insertRow(-1) ;

    var 
eCell r.insertCell(-1) ;
    
eCell.className 'MN_Separator MN_Icon' ;

    
eCell r.insertCell(-1) ;
    
eCell.className 'MN_Separator' ;
    
eCell.appendChildoDoc.createElement'DIV' ) ).className 'MN_Separator_Line' ;

    
eCell r.insertCell(-1) ;
    
eCell.className 'MN_Separator' ;
    
eCell.appendChildoDoc.createElement'DIV' ) ).className 'MN_Separator_Line' ;
}
?>
Онлайн: 0
Реклама