Вход Регистрация
Файл: public/js/3rd_party/ckeditor/plugins/liststyle/dialogs/liststyle.js
Строк: 199
<?php

/*
 * Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.html or http://ckeditor.com/license
 */

(function()
{
    function 
getListElementeditorlistTag )
    {
        var 
range;
        try { 
range  editor.getSelection().getRanges()[ ]; }
        catch( 
) { return null; }

        
range.shrinkCKEDITOR.SHRINK_TEXT );
        return 
range.getCommonAncestor().getAscendantlistTag);
    }

    var 
listItem = function( node ) { return node.type == CKEDITOR.NODE_ELEMENT && node.is'li' ); };

    var 
mapListStyle = {
        
'a' 'lower-alpha',
        
'A' 'upper-alpha',
        
'i' 'lower-roman',
        
'I' 'upper-roman',
        
'1' 'decimal',
        
'disc' 'disc',
        
'circle''circle',
        
'square' 'square'
    
};

    function 
listStyleeditorstartupPage )
    {
        var 
lang editor.lang.list;
        if ( 
startupPage == 'bulletedListStyle' )
        {
            return {
                
title lang.bulletedTitle,
                
minWidth 300,
                
minHeight 50,
                
contents :
                [
                    {
                        
id 'info',
                        
accessKey 'I',
                        
elements :
                        [
                            {
                                
type 'select',
                                
label lang.type,
                                
id 'type',
                                
align 'center',
                                
style 'width:150px',
                                
items :
                                [
                                    [ 
lang.notset'' ],
                                    [ 
lang.circle'circle' ],
                                    [ 
lang.disc,  'disc' ],
                                    [ 
lang.square'square' ]
                                ],
                                
setup : function( element )
                                {
                                    var 
value element.getStyle'list-style-type' )
                                                || 
mapListStyleelement.getAttribute'type' ) ]
                                                || 
element.getAttribute'type' )
                                                || 
'';

                                    
this.setValuevalue );
                                },
                                
commit : function( element )
                                {
                                    var 
value this.getValue();
                                    if ( 
value )
                                        
element.setStyle'list-style-type'value );
                                    else
                                        
element.removeStyle'list-style-type' );
                                }
                            }
                        ]
                    }
                ],
                
onShow: function()
                {
                    var 
editor this.getParentEditor(),
                        
element getListElementeditor'ul' );

                    
element && this.setupContentelement );
                },
                
onOk: function()
                {
                    var 
editor this.getParentEditor(),
                        
element getListElementeditor'ul' );

                    
element && this.commitContentelement );
                }
            };
        }
        else if ( 
startupPage == 'numberedListStyle'  )
        {

            var 
listStyleOptions =
            [
                [ 
lang.notset'' ],
                [ 
lang.lowerRoman'lower-roman' ],
                [ 
lang.upperRoman'upper-roman' ],
                [ 
lang.lowerAlpha'lower-alpha' ],
                [ 
lang.upperAlpha'upper-alpha' ],
                [ 
lang.decimal'decimal' ]
            ];

            if ( !
CKEDITOR.env.ie || CKEDITOR.env.version )
            {
                
listStyleOptions.concat( [
                    [ 
lang.armenian'armenian' ],
                    [ 
lang.decimalLeadingZero'decimal-leading-zero' ],
                    [ 
lang.georgian'georgian' ],
                    [ 
lang.lowerGreek'lower-greek' ]
                ]);
            }

            return {
                
title lang.numberedTitle,
                
minWidth 300,
                
minHeight 50,
                
contents :
                [
                    {
                        
id 'info',
                        
accessKey 'I',
                        
elements :
                        [
                            {
                                
type 'hbox',
                                
widths : [ '25%''75%' ],
                                
children :
                                [
                                    {
                                        
label lang.start,
                                        
type 'text',
                                        
id 'start',
                                        
validate CKEDITOR.dialog.validate.integerlang.validateStartNumber ),
                                        
setup : function( element )
                                        {
                                            
// List item start number dominates.
                                            
var value element.getFirstlistItem ).getAttribute'value' ) || element.getAttribute'start' ) || 1;
                                            
value && this.setValuevalue );
                                        },
                                        
commit : function( element )
                                        {
                                            var 
firstItem element.getFirstlistItem );
                                            var 
oldStart firstItem.getAttribute'value' ) || element.getAttribute'start' ) || 1;

                                            
// Force start number on list root.
                                            
element.getFirstlistItem ).removeAttribute'value' );
                                            var 
val parseIntthis.getValue(), 10 );
                                            if ( 
isNaNval ) )
                                                
element.removeAttribute'start' );
                                            else
                                                
element.setAttribute'start'val );

                                            
// Update consequent list item numbering.
                                            
var nextItem firstItemconseq oldStartstartNumber isNaNval ) ? val;
                                            while ( ( 
nextItem nextItem.getNextlistItem ) ) && conseq++ )
                                            {
                                                if ( 
nextItem.getAttribute'value' ) == conseq )
                                                    
nextItem.setAttribute'value'startNumber conseq oldStart );
                                            }
                                        }
                                    },
                                    {
                                        
type 'select',
                                        
label lang.type,
                                        
id 'type',
                                        
style 'width: 100%;',
                                        
items listStyleOptions,
                                        
setup : function( element )
                                        {
                                            var 
value element.getStyle'list-style-type' )
                                                || 
mapListStyleelement.getAttribute'type' ) ]
                                                || 
element.getAttribute'type' )
                                                || 
'';

                                            
this.setValuevalue );
                                        },
                                        
commit : function( element )
                                        {
                                            var 
value this.getValue();
                                            if ( 
value )
                                                
element.setStyle'list-style-type'value );
                                            else
                                                
element.removeStyle'list-style-type' );
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                ],
                
onShow: function()
                {
                    var 
editor this.getParentEditor(),
                        
element getListElementeditor'ol' );

                    
element && this.setupContentelement );
                },
                
onOk: function()
                {
                    var 
editor this.getParentEditor(),
                        
element getListElementeditor'ol' );

                    
element && this.commitContentelement );
                }
            };
        }
    }

    
CKEDITOR.dialog.add'numberedListStyle', function( editor )
        {
            return 
listStyleeditor'numberedListStyle' );
        });

    
CKEDITOR.dialog.add'bulletedListStyle', function( editor )
        {
            return 
listStyleeditor'bulletedListStyle' );
        });
})();
?>
Онлайн: 0
Реклама